Smoke Tests

Firmware for Hardware Validation

Writing firmware may be hard, but building hardware to run that firmware is often harder. A common problem is being unsure if an external IC is connected properly, since functionality is hard to test with just electrical bench tools. This can be helped from the firmware side with ‘smoke tests’: projects that engage an IC with as little user input as possible. These would differ from the actual board firmware project in that they don’t implement any logic, they just do a bunch of stuff.

Not that for these to be useful, instructions should be included for the hardware team members using the project, including an overview of the expected behaviour as well as what each parameter does. If writing the instructions as comments proves unwieldy, add a confluence page under this one with instructions and a comment in the code to see confluence for instructions.

Some examples of what a smoke test might do are as follows:

  • For most ICs, periodically read a manufacturer-set status register and compare the read value to the expected value, logging the results

  • For an ADC (e.g. ADS1015), periodically take readings and log output

  • For a serial to CAN converter (e.g. MCP2515), periodically send CAN messages and log whatever is received

  • For a multiplexer (e.g. ADG731), periodically cycle through all possible outputs, flipping pins

  • For a demultiplexer (e.g. ADG731), periodically cycle through all possible inputs, perhaps taking readings with the STM’s onboard ADC

  • For a switch (e.g. BTS7040), periodically toggle on and off

Combining these, it would also be useful to have a smoke test for an entire board. For example, a smoke test for the pedal board might periodically read from each ADC channel. A smoke test for the center console might log all GPIO button presses to ensure all of them are wired correctly.

IC list to write smoke tests for

BMS Carrier

  • ADT7470 via I2C

BMS AFEs

  • LTC6811 via SPI

  • ADG731 via LTC6811 via SPI

BMS Current sense

  • ADS1259 via SPI

MCI

  • MCP2515 via SPI

Solar Sense

  • SPV1020 via SPI and MC74LVX138 demuxer

  • MCP3427 via I2C

Pedal Board

  • ADS1015 via I2C

Power Distribution

  • PCA9539r via I2C

  • MCP23008 via I2C

  • BTS7200

  • BTS7040 / BTS7080