PCBA Functional Testing

The Printed Circuit Board Assembly (PCBA) process has multiple types of testing such as AOI, AOX, ICT, Smoke Testing, Black Box Testing, and Regression Testing. Functional Testing (FCT) powers the device and validates expected operations.


Introduction

The Printed Circuit Board Assembly (PCBA) process has multiple testing stages, each with its specific implementations and goals. Functional Testing (FCT) powers the device and validates expected operations.

PCBA Functional Testing series

In this part, we will write a Functional Test Specification for the TeachMePCB badge project. We will use a schematic to identify test cases, required nets, and instrumentation needed to implement functional tests in a turnkey test system. This is what FixturFab uses to design turnkey test systems.

TeachMePCB is a free online course that covers designing a custom PCB. If you are unsure of what to include in a PCBA Functional Test Plan, our Overview of PCBA Testing may help. Towards the end, we also cover selecting test instrumentation.

To follow along with this post, you will need:

Also helpful:

Schematic Review

The first step in creating a functional test specification is to go through every sheet in the schematic and identify the various systems that need to be validated on the PCB. The block diagram of the TeachMePCB Badge circuit is shown below.

schematic-hierarchical-block-diagram.png

This schematic consists of 8 separate blocks including an MCU sheet which contains the microcontroller that is used to control the system, sheets for various sensors and connectors, and then a sheet for Power which is not included within the hierarchy.

When analyzing a schematic and creating a functional test specification, we have found it best to use the following methodology:

  1. Test for Short Circuits
    1. Verify that short circuits are not present on any of the voltage rails
  2. Test all Voltage Rails
    1. Verify that all voltage rails generate the correct voltages
  3. Program MCU
    1. Program all microcontrollers
    2. This enables you to use a custom firmware image that can be used for validating the various IO on the fixture
  4. All other tests

With this methodology in mind, we will look through the schematic, skipping around to various sheets so that short circuits, voltage rails, and MCU’s are programmed first.

Power Schematic Sheet

The first sheet we will look at is the Power sheet. This will allow us to test for short circuits and verify the voltage regulators at the very beginning of the tests.

schematic-power-sheet.png

The PCB can be powered by a battery or USB. This enables the 5V0 net to be powered in the following ways:

  1. When only powered by the battery, Voltage Regulator U202 generates 5V
  2. When only powered by USB (or both a battery and USB), 5V is generated from VBUS

Voltage regulator U201 then generates 3V3 from the 5V0 net. Transistors Q201, Q202, Q203, and Q204 are used to switch 5V0 to VUSB when VUSB is available.

From analyzing this circuit we can identify the following tests:

  1. Verify that TP_Switch_Battery and TP_USB_VBUS are not shorted to ground
  2. Verify that TP5VRegOut is 5V when TP_Switch_Battery is powered
  3. Verify that TP_5V0 is 5V when TP_Switch_Battery is powered
  4. Verify that TP_5V0 is 5V when TP_USB_VBUS is powered
  5. Verify that TP_USB_ACTIVE is high when TP_USB_VBUS is powered
  6. Verify that TP_3V3 is 3.3V when TP_5V0 is powered

We typically separate the Short Circuit tests from the Voltage Rail tests. This allows for a very quick Short Circuit test to be performed at the beginning of the test.

In your Functional Test Specification sheet:

  • Add all of the test points that can be found on this schematic sheet to the Test Point Matrix sheet
  • Add all required Short Circuit test cases to the Test Cases sheet
  • Add all required Voltage Rail test cases to the Test Cases sheet
  • Add an X to all test cases that a test point is used in on the Test point Matrix sheet

MCU Schematic Sheet

This sheet contains the ATMega328P MCU, along with the crystal oscillator, debouncing capacitors, and a programming header.

schematic-mcu-sheet.png

This MCU controls all of the peripherals on the Badge PCB. To help with testing all of the hardware, a custom firmware image will be used to set various IO to validate different peripherals. Before we are able to perform any other tests on the PCBA, we need to program the ATMega328. To do this, a SAMD11 is used to bootload the MCU over USB. Skip to the SAMD11 USB Bootloader sheet next.

SAMD11 USB Bootloader Sheet

U501 is a SAMD11 32-Bit MCU, this MCU has a USB peripheral, which is used to bootload the ATMega328p (main MCU).

schematic-SAMD11-sheet.png

To program the PCBA, there will be 3 main steps:

  1. Program the SAMD11 Firmware
  2. Program the Arduino Serial Bootloader onto the ATMega328P
  3. Load test firmware onto the ATMega328P

To program the SAMD11 firmware, SWD will be used. This requires a programmer such as a J-Link or an Atmel ICE.

In your Functional Test Specification sheet:

  • Add all test points to the Test Point Matrix sheet
  • Add a test case for loading the SAMD11 Firmware onto U501

LCD Schematic Sheet

The ATMega328 is programmed using SPI, and since no test points were shown on the MCU sheet, we are now looking at the LCD sheet.

schematic-LCD-sheet.png

To program the ATMega328, the MOSI, MISO, CLK, and CS pins will be used, along with the MEGA_RST test point from the SAMD11 USB Bootloader sheet.

In your Functional Test Specification sheet:

  • Add all test points to the Test point Matrix sheet
  • Add a test case for programing the Arduino Bootloader to the ATmega328

LEDS Schematic Sheet

This sheet contains the level-shifting circuit that is required to communicate with the LEDs from the MCU.

schematic-LEDS-sheet.png

To verify that the level-shifting circuit functions correctly, we will implement a command on the MCU to set the level high and low, instrumentation can then be connected to the TP_ADDR_LED_HV test point to verify that this pin can be set high and low.

This sheet also includes an LED and a buzzer. These devices could be tested, however, we will skip testing them for now.

In your Functional Test Specification sheet:

  • Add all of the test points on this sheet to the Test point Matrix sheet
  • Add test cases for setting TP_ADDR_LED_HV high and low

Switches Schematic Sheet

This sheet contains the circuitry for each switch that is on the Badge.

schematic-switches-sheet.png

Each switch has a test point that can be used to validate that the MCU can read the switch state. These test points will be hooked up to instrumentation that will allow us to set the test point to either high or low, and then validate that the correct state can be read by the MCU.

In your Functional Test Specification sheet:

  • Add all test points to the Test point Matrix sheet
  • Add test cases for verifying that each switch can be set high and low

BME280 Schematic Sheet

The BME280 schematic sheet is shown below.

schematic-BME280-sheet.png

This sheet contains only the BME280 sensor and it’s decoupling capacitors. To test this sensor, a reading will be taken by the MCU.

In your Functional Test Specification sheet:

  • Add a test case for verifying that a reading can be taken from the BME280

BNO055_IMU Schematic Sheet

This sheet contains the BNO055 IMU and it’s support components.

schematic-BNO055_IMU-sheet.png

Test points are available on the I2C pins, as well as the reset and interrupt pins, however these test points are required for testing the device since we can use a command from the ATMega328.

In your Functional Test Specification sheet:

  • Add test points to the Test Point Matrix sheet
  • Add a test case for verifying communication with the IMU

RTC Schematic Sheet

The RTC sheet contains an MCP79400 and all of the components required for the RTC to operate correctly. To test this device, the ATMega328 will be used to communicate with it.

schematic-RTC-sheet.png

Test Instrumentation Selection

Now that we have reviewed the schematic and developed a list of the basic tests that will need to be performed, we can work on selecting the instrumentation for running the tests.

For the tests that are defined, we will need to use instrumentation that can do the following:

  • Check if Switch_Battery or USB_VBUS is shorted to ground
  • Measure 5V and 3.3V Voltages
  • Program a SAMD11 using SWD
  • Program an ATmega328 using SPI
  • Communicate with the ATmega328 using serial

Production-Ready Instrumentation

You need robust instrumentation for a test fixture that will be used to produce 100K+ units. For this style of fixture, we would probably use the following:

The Acroname MTM-USBStem is ruggedized and ready for use in an industrial environment. This will reduce the risk of an IO pin being blown out due to a bad device being tested.

Development Fixture Instrumentation

You can use more entry-level instrumentation for fixtures used during hardware development and small production run tests.

For the TeachMePCB Badge fixture, we’ll use the following:

Next

A well throughout test specification is incredibly helpful when planning to manufacture your circuit boards. Planning this while developing a new PCB will help improve the quality of your products and make manufacturing and test run smoother. With a schematic, you can identify the required tests, nets needed, and start thinking of what instrumentation you will need to implement your Functional Test Plan.