Testing and Debugging Circuit boards and firmware

 

This page is to help students test and debug their circuits.

 

Once you have your “in house” PCB made the time has come to mount components and test the circuit. Be sure you read the page “How to Solder” before continuing and ensure you have the correct tools and soldering skills before attempting to build the board. The board should be drilled and cut to size. Ensure all holes are the correct size and that the components are going to fit the holes and have enough mounting room on the board.

 

HARDWARE CONSTRUCTION AND DEBUGGING

  1. Check the PCB for cracks in tracks & shorts between tracks. Cracks can be repaired using solder or by soldering a small piece of tinned copper wire over the affected part. Shorts between tracks can be cut with a blade.
  2. Ensure the PCB has been cleaned, holes de-burred and spray coated with a suitable lacquer.(see “How to Solder”)
  3. A prototype board is best constructed in a logical manner. Remember that this is not a kit board from a hobby shop that has been de-bugged and is ready to build. The construction must proceed in a way that de-bugging is made the easiest. For production, boards are constructed in the easiest way for assembly.

4. Construct and test the power supply circuit (if any).

Firstly ensure there is no short circuit between the supply track(s) and earth.

Using the buzzer on your meter:-

  Mount all power supply components and check continuity between all components.

   Check for shorts to earth once more.

Set power supply to 0V, set the current limit to around 100mA. Connect board to power supply, turn on supply and gradually wind up the voltage to the operating level ensuring that the current limit indicator is not showing. Use your meter to measure the output voltage of your power supply. If there is no voltage or it is the wrong value turn off the power supply and inspect for the fault.

5. Construct and test small signal analogue/digital circuitry (if any)

Ensure that power is going to all the component pads on the board that are connected to the power rail.

Switch off and mount all analogue components.

Switch on and test all analogue/digital circuitry for functionality. This may mean connecting to a signal source and using a CRO.

6. Construct and test all power electronics. (e.g. stepping motors drivers, power amps, transducer drivers, motor drives etc.)

7. Construct and test all control circuitry (e.g. Microprocessors, PLD’s etc), without debugged firmware this will involve checking power to the device(s), external clock operation, reset switch  etc.

 

FIRMWARE DEBUGGING

Firmware, even more than hardware, must be debugged section by section.

This information applies to uP’s as well as other PLD’s

1. Programme the device with an internal initialization routine and a loop that gives some simple output to indicate the device is working (e.g. togging a pin or flashing a LED etc.)  This will confirm that the device is working, initializing and that your programming interface (ISP, Jtag etc.) is functional)

2. Add and test device internal functions like internal clocks, timing loops, timers, PWM, signal generation etc.

3. Add and test communication output routines, (e.g. write out a string to RS232, RS485, LCD, 7 seg. display etc.)

4. Add and test communication input routines (get characters from RS232, RS485, Keypad etc. and display on an output device)

5. Add routine to test analogue/digital output circuitry (motors, steppers, relays, power amps, heaters,  etc.)

6. Add routines to test analogue/digital input circuitry. Use input device to control functions (A/D, switches etc.)

7. Introduce the programme loop that includes all I/O devices.

8. Devise a method to test all interrupts for correct operation. (N.B. this could be complicated)

9. Enable the watchdog timer if you have one.

10. Add and test calculations, signal processing, protocols etc.