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): SAMD21 Mini/Dev Breakout Hookup Guide - SparkFun Learn, 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 Redirecting..., 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