PlatformIO Community

SAMD21 Unit Testing - wrong serial object chosen for testing in output_export.cpp

Hi,

I tried to run PIO Unit Testing with SparkFun SAMD21 Mini/Dev and process is hanging in:

Testing…
If you don’t see any output for the first 10 secs, please reset board (press reset button)

On SAMD21 Mini/Dev the object which handles the USB connection is SerialUSB (Native USB): https://learn.sparkfun.com/tutorials/samd21-minidev-breakout-hookup-guide/example-serial-ports, so naturally we will use this port for flashing and monitoring, however in output_export.cpp PlatformIO is using the Serial (UART0) so the output from testing engine will never be send to host PC.

Is there any option to instruct PlatformIO to use SerialUSB object instead of Serial in the generated output_export.cpp file?

This is documented behavior per https://docs.platformio.org/en/latest/plus/unit-testing.html#test-transport, to change it, add test_transport = custom in th platformio.ini and provide implementations for the transport functions as shown in the docs.

1 Like