Hello everyone,
I have just published Chapter 8 – Serial Communication for the Pi Ada Tutorial.
In this chapter I explore all three practical ways to do serial output and input on the Pico:
- SWD + Semihosting (the method used by
Ada.Text_IO) - Classic UART with level shifting
- USB CDC-ACM
I also provide two complete example programs (Sketch_08_1_Serial_Print and Sketch_08_2_Serial_Read_and_Write) that demonstrate all three methods working together, plus my supporting packages Pico.UART_IO, Pico.USB_IO and Pico.Debug_IO.
This chapter turned out to be a lot more work than I initially expected. I wanted to give readers real choices, so I implemented and tested all three options in depth. The USB CDC-ACM part in particular became quite involved once I started transferring more than 64 bytes at a time — proper buffer handling and retry logic were necessary to get reliable performance.
You can find the full chapter here:
The corresponding Alire crate will soon be available as well:
pico_ada_c08_serial_communication
As always, feedback and suggestions are very welcome!
Best regards,
Martin Krischik