Monday, May 10, 2021

Scriptable UART/I2C Terminal

The need for this tool did come from the test requirement for the CR00040 I2C module, there are four I2C devices onboard and all of them should be checked during factory testing.

A simple test terminal application was used as a starting point, the edit box for the transmit string was changed to a memo to enter "test script". All lines from the memo are sent to the serial port, one line at a time. Two special cases added, when the first char on line is "=" then UART is read and compared to a string with display output on mismatch. On mismatch global RESULT variable is set to false. First char "!" is interpreted as a request for a timed delay in milliseconds.

Adding and testing those new features did take about half a day. While most of the time was spent troubleshooting a really silly bug (wrong string length on transmit).

This is an example output of the scripting terminal. All four I2C devices on CR00040 are tested. The CO2 sensor factory test is initiated, and the result is read back after 10 seconds delay needed by the sensor.

After starting the test a result will be displayed depending on the results of the read string comparisons, if all matched, then OKAY is displayed (or FAILED if at least one comparison failed).

Please note that while this tool was developed for I2C testing using the UHSA USB-I2C adapter, the tool could be used for more generic UART testing. It basically sends and receives UART strings having zero knowledge about I2C coded in.









No comments:

Post a Comment