Printf over USB on RP2040

I am just getting started porting a program from the Arduino/AtMega328 environment to FreeRTOS, using an RP2040 (CORTEX M0) processor. I begin with the simple main_blinky demo program, which works. Now I want to add a printf statement, my primary means of debugging. I know tinyusb is being included during the build. But after the program loads and the USB blinks, no /dev/ttyACM0 device is created on my host Linux system so there is nothing for minicom to connect to. Am I missing an initialization step?

I do not think you can use the programming port on an Arduino as a UART. That is why I had to get a Due for my project which has two USB ports (one of which can be addressed by the target). But I may be off, it has been a while since I did something with Arduinos.

I am actually doing this with an Adafruit Feather RP2040 (same as a Raspberry Pi Pico), not the Arduino Atmega328 of the original project. On the 328 I had no problem doing everything through the single USB.

I put in a call to tusb_init() but that is unresolved. I know that all of the tinyusb subproject is included in the pico-sdk, but I am not clear on how to force all that to actually get linked in.

The fix seems to be adding pico_enable_stdio_usb for the final module to the CMake txt file. This also appears to double the size of the resulting executable!

1 Like

Thank you for sharing your solution!