Testing

Windows USB Device Driver

If you want to send and receive vehicle data in Windows via USB, you must install the VI Windows Driver.

Python Library

The OpenXC Python library, in particular the openxc-dashboard tool, is useful for testing a VI. A quick “smoke test” using the Python tools is described in the Getting Started Guide for Python developers at the OpenXC website.

Keep in mind when bench testing that the VI will suspend if no CAN bus activity is detected. Compiled with DEFAULT_POWER_MANAGEMENT=ALWAYS_ON to stop this behavior, but don’t leave it plugged into your car with power management off.

Debugging

To view debugging information, first compile the firmware with the debugging flag:

$ make clean
$ DEBUG=1 make
$ make flash

When compiled with DEBUG=1, two things happen:

  • Debug symbols are available in the .elf file generated in the build directory.
  • Log messages will be output over a separate USB endpoint required) - see I/O, Data Format and Commands for details. You can optionally enable logging via UART with the UART_LOGGING flag, but there may be a performance hit - see the Makefile Options.

To view the logs via USB, you can use the --log-mode flag with the Python CLI tools. See the --help text for any of those tools for more information.

To view UART logs, you can use an FTDI cable and any of the many available serial terminal monitoring programs, e.g. screen, minicom, etc. The pins for this UART output are different for each board, so see the platform specific docs.

Test Suite

The non-embedded platform specific code in this repository includes a unit test suite. It’s a good idea to run the test suite before committing any changes to the git repository.

The test suite uses the check library. It should already be installed if you used bootstrap.sh to set up your development environment.

Running the Suite

vi-firmware/src $ make clean && make test