Introduction To Microcontroller Design Tips
As the electronic components continue to shrink in size with the advancement of semiconductor and packaging technology, the ability of these smaller MCU to withstand the effect of electromagnetic interference is less compared to its bigger size counterparts. Hence the importance of designing electronic devices that can withstand a certain level of immunity in noisy environment has to be considered at the start of a design.
The cycle of a product development using microcontroller design starts at specifications definition, to circuit design, components selection, printed circuit board design, making prototype, reliability and EMC testing, market testing and finally product launch.
The cost of EMC consideration and solutions are lowest at design stage and will escalate exponentially when products have been launched to the market. If a device failed due to electromagnetic interference in the market, it will have to be solved on site by using more expensive solutions for instance standalone filters, shieldings etc or even recall from the market if it is a major defect. Hence it is of extreme importance that the EMC design is taken into consideration at the design stage. The followings are some tips that one may consider when designing any electronics device.
Microcontroller Design Component Selection
As far as possible, the components used should be leadless type instead of leaded type as the leaded type have more parasiticand capacitive effect at high frequencies. Surface mount resistors, capacitors, inductors, and other SMT components are preferred.
MCU selection is done based on the assurance and specifications from the manufacturer that the EMC aspects are taken into consideration in the design of the device. For instance, build in clamping diodes at the inputs of the ports to reduce the effect of electrostatic discharge on the ports.
Microcontroller Design Printed Circuit Board Design
- Placed each component as close as possible to each other as this will reduce the looping and tracks and hence the parasitic and capacitive inductance will be reduced. Each loop or track will radiate and absorb energy once it is exposed to a variation of current, voltage or electromagnetic flux.
- Place the crystal or ceramic oscillator as close possible to the microcontroller. The tracks used to connect the resonator to the clocks should be as short and close as possible.
- As far as possible, do not use any socket between the MCU and the PCB. Use of socket introduces parasitic inductance and capacitance to the circuit.
- Use a 0.1uF ceramic capacitor across the power supply(VCC-Ground) of each integrated circuit as a high frequency decoupling device. The capacitor should be placed as close as possible to the integrated circuit.
- IO ports of MCU that are not used should be tied to Ground or connected to VCC through a high impedance resistor(100-200 k ohm). This is to reduce the effect of voltage spike to the unused port that may cause wrong logic to be read by the MCU.
- Separate the grounding of digital and analog tracks.
- It is good to put a large ground underneath the MCU to create a stable tank to divert the noise to the ground.
- In critical application, use a reset IC that will reset the circuit once the power supply drops below a certain level.
- The power supply to the system should be stable by using large filtering capacitors and bypass ceramic capacitors and ensuring that the ripple is minimal(less than 100mV).
Microcontroller Design Software Consideration
- As far as possible, try to reconfigure the ports configuration, timer configuration and other registers regularly in the software loop. In a noisy environment, the setting of the registers may be flipped and changed from input to output and vice-versa.
- Place a certain value in the RAM of the MCU and check for its integrity regularly. If the values changed, it means that the noise have altered the values and the integrity of the rest of the RAM is questionable. You may make a decision to reset the RAM to a predetermine value.
- Use a MCU with a hardware reset watchdog feature. A timer routine is placed in a certain part of the software where itwill be refresh at a certain time. If this is not updated, it means that the program has runaway and a hardware reset shouldbe triggered.
- Unused memory should be filled with "1111...." or "0000...."
- Unused program memory should be filled NOP(No operation) instruction codes. This is to ensure that if the program counter of the MCU is corrupted and jumped to these areas of the program memory, it will not end in endless loop.
Microcontroller Design Home Page