Uploaded February 2026 | Updated November 2026, 12 hours ago
In this episode of “Intro to Embedded Rust,” we learn how to add USB serial communication to our projects (specifically for the Raspberry Pi Pico 2). We'll build on the blinking LED project from the previous episode to create a USB CDC (Communications Device Class) serial port, enabling you to send debug messages from your microcontroller to your computer. Print debugging is an essential skill for embedded development, and this tutorial shows you how to implement it in Rust using the usb-device and usbd-serial crates.
The written guide for this episode can be found here: digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-3-usb-serial-logging-and-debugging
The GitHub repository containing the Docker image and example code for this series can be found here: github.com/ShawnHymel/introduction-to-embedded-rust. Note that you can find my solution to the “read and convert to uppercase” challenge in workspace/apps/usb-serial/src/main.rs.
This tutorial walks you through setting up USB communication on the RP2350 chip, covering how to configure the USB peripheral, create a USB device with proper VID/PID identifiers, and implement the CDC serial protocol for serial communication. You'll learn about the UsbBusAllocator for managing USB endpoints and buffers, the SerialPort abstraction for reading and writing serial data, and the UsbDeviceBuilder for device enumeration. We explore important embedded concepts like USB device descriptors, the Communications Device Class standard, and how your Pico 2 appears as a virtual serial port to your operating system.
We also demonstrate non-blocking superloop architecture. You'll see how to structure a program that handles multiple tasks concurrently: polling the USB device for incoming data, processing received bytes, and sending timed messages every second. We explain Rust's Result type and match statement for explicit error handling, showing how pattern matching forces you to handle both success and error cases without relying on exceptions. The code also introduces time-based non-blocking operations using the Timer peripheral, demonstrating how to perform periodic tasks without blocking USB communication or other operations in your main loop.
This USB serial debugging tutorial provides a practical template for embedded Rust development on the Raspberry Pi Pico 2, suitable for developers transitioning from Arduino, MicroPython, or C/C++ embedded programming. You'll understand how Rust's ownership system and type safety apply to hardware abstraction layers (HAL), how the rp235x-hal crate provides safe interfaces to RP2350 peripherals, and why explicit error handling matters in embedded systems.
Related Link:
digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-3-usb-serial-logging-and-debugging
Links:
Getting Started with STM32 and Nucleo: youtube.com/watch?v=hyZS2p1tW-g&list=PLEBQazB0HUyRYuzfi4clXsKUSgorErmBv
Introduction to Real-Time Operating Systems (RTOS): youtube.com/watch?v=F321087yYy4&list=PLEBQazB0HUyQ4hAPU1cJED6t3DU0h34bz
Raspberry Pi Pico 2: digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
Learn more:
Maker.io - digikey.com/en/maker
DigiKey’s Blog – TheCircuit digikey.com/en/blog
Connect with DigiKey on Facebook facebook.com/digikey.electronics
And follow us on X: https://x.com/digikey
Product:
digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
digikey.com/en/products/detail/raspberry-pi/SC1632/26241102
digikey.com/en/products/detail/raspberry-pi/SC1633/25862735
digikey.com/en/products/detail/raspberry-pi/SC1634/26241087
digikey.com/en/products/detail/sparkfun-electronics/13314/6797646
digikey.com/en/products/detail/lite-on-inc/LTL-4224/217584
digikey.com/en/products/detail/stackpole-electronics-inc/CF14JT220R/1830334
digikey.com/en/products/detail/te-connectivity-alcoswitch-switches/1825910-6/1632536
digikey.com/en/products/detail/dfrobot/FIT0096/7597069
digikey.com/en/products/detail/adafruit-industries-llc/1957/6827090
digikey.com/en/products/detail/cvilux-usa/DH-20M50055/13175849
Chapters:
0:00 Intro
0:45 Define Dependencies
3:14 Set Up USB Serial
11:39 Print String Over USB Serial
18:08 Build and Flash
25:24 Challenge and Reading Assignment
26:13 Conclusion
In this episode of “Intro to Embedded Rust,” we learn how to add USB serial communication to our projects (specifically for the Raspberry Pi Pico 2). We'll build on the blinking LED project from the previous episode to create a USB CDC (Communications Device Class) serial port, enabling you to send debug messages from your microcontroller to your computer. Print debugging is an essential skill for embedded development, and this tutorial shows you how to implement it in Rust using the usb-device and usbd-serial crates.
The written guide for this episode can be found here: digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-3-usb-serial-logging-and-debugging
The GitHub repository containing the Docker image and example code for this series can be found here: github.com/ShawnHymel/introduction-to-embedded-rust. Note that you can find my solution to the “read and convert to uppercase” challenge in workspace/apps/usb-serial/src/main.rs.
This tutorial walks you through setting up USB communication on the RP2350 chip, covering how to configure the USB peripheral, create a USB device with proper VID/PID identifiers, and implement the CDC serial protocol for serial communication. You'll learn about the UsbBusAllocator for managing USB endpoints and buffers, the SerialPort abstraction for reading and writing serial data, and the UsbDeviceBuilder for device enumeration. We explore important embedded concepts like USB device descriptors, the Communications Device Class standard, and how your Pico 2 appears as a virtual serial port to your operating system.
We also demonstrate non-blocking superloop architecture. You'll see how to structure a program that handles multiple tasks concurrently: polling the USB device for incoming data, processing received bytes, and sending timed messages every second. We explain Rust's Result type and match statement for explicit error handling, showing how pattern matching forces you to handle both success and error cases without relying on exceptions. The code also introduces time-based non-blocking operations using the Timer peripheral, demonstrating how to perform periodic tasks without blocking USB communication or other operations in your main loop.
This USB serial debugging tutorial provides a practical template for embedded Rust development on the Raspberry Pi Pico 2, suitable for developers transitioning from Arduino, MicroPython, or C/C++ embedded programming. You'll understand how Rust's ownership system and type safety apply to hardware abstraction layers (HAL), how the rp235x-hal crate provides safe interfaces to RP2350 peripherals, and why explicit error handling matters in embedded systems.
Related Link:
digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-3-usb-serial-logging-and-debugging
Links:
Getting Started with STM32 and Nucleo: youtube.com/watch?v=hyZS2p1tW-g&list=PLEBQazB0HUyRYuzfi4clXsKUSgorErmBv
Introduction to Real-Time Operating Systems (RTOS): youtube.com/watch?v=F321087yYy4&list=PLEBQazB0HUyQ4hAPU1cJED6t3DU0h34bz
Raspberry Pi Pico 2: digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
Learn more:
Maker.io - digikey.com/en/maker
DigiKey’s Blog – TheCircuit digikey.com/en/blog
Connect with DigiKey on Facebook facebook.com/digikey.electronics
And follow us on X: https://x.com/digikey
Product:
digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
digikey.com/en/products/detail/raspberry-pi/SC1632/26241102
digikey.com/en/products/detail/raspberry-pi/SC1633/25862735
digikey.com/en/products/detail/raspberry-pi/SC1634/26241087
digikey.com/en/products/detail/sparkfun-electronics/13314/6797646
digikey.com/en/products/detail/lite-on-inc/LTL-4224/217584
digikey.com/en/products/detail/stackpole-electronics-inc/CF14JT220R/1830334
digikey.com/en/products/detail/te-connectivity-alcoswitch-switches/1825910-6/1632536
digikey.com/en/products/detail/dfrobot/FIT0096/7597069
digikey.com/en/products/detail/adafruit-industries-llc/1957/6827090
digikey.com/en/products/detail/cvilux-usa/DH-20M50055/13175849
Chapters:
0:00 Intro
0:45 Define Dependencies
3:14 Set Up USB Serial
11:39 Print String Over USB Serial
18:08 Build and Flash
25:24 Challenge and Reading Assignment
26:13 Conclusion
![Intro to Embedded Rust Part 12: Async Programming with Embassy | DigiKey
In this tutorial, we cover async/await programming for embedded systems with Embassy, a modern Rust framework that enables concurrent multitasking on microcontrollers without a traditional RTOS.
The written guide for this episode can be found here: https://www.digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-12-asynchronous-programming-with-embassy
The GitHub repository containing the Docker image and example code for this series can be found here: https://github.com/ShawnHymel/introduction-to-embedded-rust
Embassy provides cooperative task scheduling using Rusts native async/await syntax, allowing you to write code that handles multiple operations simultaneously, like monitoring buttons, blinking LEDs, and managing USB. We demonstrate how to replace bare-metal peripheral access with Embassys higher-level abstractions, creating a button-controlled LED blinker with USB logging that showcases async GPIO, timers, task spawning, and inter-task communication.
Embassy is a collection of modular crates including platform-specific HALs (embassy-rp for Raspberry Pi, embassy-stm32, embassy-nrf), the executor for running async tasks, timer abstractions, synchronization primitives, and protocol stacks for USB and networking. We demonstrate configuring Embassy dependencies in Cargo.toml, using the bind_interrupts! macro to connect hardware interrupts to handlers automatically, and marking functions with #[embassy_executor::task] to transform them into spawnable concurrent tasks.
We also dive into futures (objects representing asynchronous operations that may not have completed yet) and look at how the executor manages them, pausing and resuming tasks as needed while automatically putting the processor to sleep when all tasks are waiting, providing efficient power management without manual wfi() calls.
The tutorial showcases Embassys async-first API design with real hardware interaction. Youll see how to use async GPIO methods like pin.wait_for_low().await that yield execution until events occur, eliminating manual interrupt service routines and polling loops. We demonstrate Timer::after_millis().await for non-blocking delays, Signal for inter-task communication (replacing the Mutex‹RefCell‹Option‹T››› pattern from bare-metal interrupt handling), and embassy_usb_logger for USB serial debugging output.
We also show how to initialize the runtime and use a Spawner for launching tasks, using join_array to run multiple async operations concurrently, and structuring programs with both spawned tasks (independent lifecycle) and async functions within the main task. Youll see how Embassy abstracts interrupt handling, peripheral configuration, and resource sharing, making complex embedded applications more maintainable while preserving Rusts zero-cost abstractions and memory safety.
Related Link:
https://www.digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-12-asynchronous-programming-with-embassy
Links:
Getting Started with STM32 and Nucleo: https://www.youtube.com/watch?v=hyZS2p1tW-g&list=PLEBQazB0HUyRYuzfi4clXsKUSgorErmBv
Introduction to Real-Time Operating Systems (RTOS): https://www.youtube.com/watch?v=F321087yYy4&list=PLEBQazB0HUyQ4hAPU1cJED6t3DU0h34bz
Raspberry Pi Pico 2: https://www.digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
Learn more:
Maker.io - https://www.digikey.com/en/maker
DigiKey’s Blog – TheCircuit https://www.digikey.com/en/blog
Connect with DigiKey on Facebook https://www.facebook.com/digikey.electronics/
And follow us on X: https://x.com/digikey
Product:
https://www.digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
https://www.digikey.com/en/products/detail/raspberry-pi/SC1632/26241102
https://www.digikey.com/en/products/detail/raspberry-pi/SC1633/25862735
https://www.digikey.com/en/products/detail/raspberry-pi/SC1634/26241087
https://www.digikey.com/en/products/detail/sparkfun-electronics/13314/6797646
https://www.digikey.com/en/products/detail/lite-on-inc/LTL-4224/217584
https://www.digikey.com/en/products/detail/stackpole-electronics-inc/CF14JT220R/1830334
https://www.digikey.com/en/products/detail/te-connectivity-alcoswitch-switches/1825910-6/1632536
https://www.digikey.com/en/products/detail/dfrobot/FIT0096/7597069
https://www.digikey.com/en/products/detail/adafruit-industries-llc/1957/6827090
https://www.digikey.com/en/products/detail/cvilux-usa/DH-20M50055/13175849
Chapters:
0:00 Intro
1:05 Overview of Embassy
2:22 Configuring Project and Setting Dependencies
8:16 Create Button Demo
22:56 Build and Flash Button Demo
26:49 Add Blinking LED Task
36:20 Flash and Build Button and LED Demo
37:21 Going Further with Rust
38:13 Conclusion Intro to Embedded Rust Part 12: Async Programming with Embassy | DigiKey](https://i.ytimg.com/vi/m9FT1qSm-KM/mqdefault.jpg)



![Visor Visions [Maker Update] | Maker.io
This week on Maker Update: a Cyberpunk servo mask, retro computing for prizes, designing dragons, and Formula 1 on a dress.
+Show Notes [Maker Update Ep.498]+
=Project of the Week=
I 3D Printed Cyberpunk NUSA Helmet (Cyberpunk 2077) by Zibartas 0:28
https://www.youtube.com/watch?v=AWW5yYr4WJ4
=News=
Hackaday Retrocomputing Contest Powered by DigiKey 1:52
https://hackaday.io/contest/206399-retrocomputing-contest
=More Projects=
Adam Savage Stunned by the Mechanics of these Bird Puppets! by Laura Mathews and Tested 2:42
https://www.youtube.com/watch?v=Rzp9LEks0mY
F1 Circuit Dress by Anouk Wipprecht 3:41
https://makezine.com/article/maker-news/anouk-wipprecht-brings-delft-blue-to-life-and-light-for-the-final-dutch-grand-prix/
OpenF1
https://openf1.org/
=Tips & Tools=
These 3D filaments SHOULD NOT EXIST! Every 3D Filament Part 7 by Zack Freedman 4:25
https://www.youtube.com/watch?v=vBdqbnfvj_A
From a Cheap Thermometer to High-End Furniture by Make Something 5:00
https://www.youtube.com/watch?v=wrykHp7tOUs
Make Your Cardboard Behave by Itoshige Studio 5:44
https://www.youtube.com/watch?v=jGyEDr00l-4
=DigiKey Spotlight=
Arduino UNO Q Bridge Tracker – Potentially Genius® 6:17
https://www.youtube.com/watch?v=FkIvHqe8-A4
Shop Arduino Q on DigiKey
https://www.digikey.com/en/products/detail/arduino/ABX00173/27526618
#makerupdate
Maker Update is a weekly video series covering news, projects, tips, and events that interest the maker and DIY community.
Find more online:
Blog: http://makerprojectlab.com
Instagram: https://www.instagram.com/makerprojectlab/ Visor Visions [Maker Update] | Maker.io](https://i.ytimg.com/vi/mwA6wQARSGE/mqdefault.jpg)
![Be More [Maker Update] | Maker.io
This week on Maker Update: a BMO that really can be more, memory pricing hits Raspberry Pi, a DIY filament maker, an LED necklace, and throwback walkie-talkies.
+Show Notes [Maker Update Ep.470]+
=Project of the Week=
I Made a Real BMO Local AI Agent with a Raspberry Pi and Ollama by brenpoly 0:28
https://www.printables.com/model/1582055-bmo-from-adventure-time-local-ai-agent-project
=News=
Raspberry Pi Announces Up-to-$60 Price Hikes Across Its Most Popular SBCs 3:24
https://www.raspberrypi.com/news/more-memory-driven-price-rises/
Shop for Raspberry Pi 5 on DigiKey:
https://www.digikey.com/en/product-highlight/r/raspberry-pi/raspberry-pi-5
Creality Shredder R1 and Filament Maker M1 3:47
https://crowdfunding.creality.com/
=More Projects=
LED Matrix Necklace Pendant by Erin St Blaine 4:27
https://learn.adafruit.com/led-matrix-necklace-pendant?embeds=allow
Build Working Stranger Things Walkie-Talkies by DIY Machines 4:57
https://www.instructables.com/Build-Working-Stranger-Things-Walkie-Talkies/
=Tips & Tools=
Printing The Ultimate Scanning Solution by Chris Borge 5:44
https://www.youtube.com/watch?v=GbyohbWr60A
Instructables Sensors Contest 6:13
https://www.instructables.com/contest/sensors26/
=DigiKey Spotlight=
Face Expression Recognition Robot with Arduino UNO Q 6:53
https://www.youtube.com/watch?v=7TtNFe5kk4g
#makerupdate
Maker Update is a weekly video series covering news, projects, tips, and events that interest the maker and DIY community.
Find more online:
Blog: http://makerprojectlab.com
Instagram: https://www.instagram.com/makerprojectlab/ Be More [Maker Update] | Maker.io](https://i.ytimg.com/vi/mwJKMwVieqs/mqdefault.jpg)

![Intro to Embedded Rust Part 9: Test-Driven Development | DigiKey
In this video, we cover test-driven development (TDD) for embedded Rust by demonstrating writing a unit test for our previous TMP102 temperature sensor driver library (crate) and a simulated I2C bus known as a “stub.”
The written guide for this episode can be found here: https://www.digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-9-test-driven-development
The GitHub repository containing the Docker image and example code for this series can be found here: https://github.com/ShawnHymel/introduction-to-embedded-rust
Test-driven development is a professional software methodology where you write tests before implementing functionality, helping catch bugs early and ensuring code meets requirements. While TDD is common in application development, it presents unique challenges in embedded systems where code runs on hardware and interacts with peripherals like I2C, SPI, and GPIO.
See here to learn more about Continuous Integration/Continuous Delivery (CI/CD): https://www.youtube.com/watch?v=1nxGcfIm-TU&list=PLEBQazB0HUyR00bgoctk-5uZoOrbmPASC
This tutorial demonstrates how to write unit tests for our TMP102 temperature sensor driver that run entirely on your development computer without requiring a Raspberry Pi Pico 2, sensor hardware, or any embedded target. Youll learn how to create stub implementations of embedded-hal traits, use Rusts testing framework with cargo test, and apply TDD principles to embedded driver development for reliable, maintainable code.
This hands-on embedded testing tutorial covers the complete TDD workflow and testing concepts essential for professional development. We explain the red-green-blue cycle: writing failing tests first (red phase), implementing code to make tests pass (green phase), and refactoring for quality (blue phase). We cover the three levels of testing: unit tests for individual functions, integration tests for component interaction, and system/end-to-end tests for complete applications. We also define common test substitution terminology including dummies (placeholders), fakes (working but simplified implementations), stubs (predetermined responses), spies (recording call information), and mocks (verifying correct usage). We focus on using stubs and dummies to simulate I2C communication without real hardware, enabling fast, automated testing during development.
We put these concepts into practice with a demonstration: creating a test infrastructure for the TMP102 driver library along with two unit tests. We cover how to use the #[cfg(test)] attribute to include test-only code that doesnt compile into production builds, and how to access the standard library for testing while keeping your library no_std for embedded targets.
We build an I2cStub struct that implements the embedded_hal::i2c::I2c trait with configurable responses, allowing you to set predetermined temperature values and verify driver behavior. Youll see how to write test functions with #[test] attributes, use assertions like assert_eq! to verify behavior, and run tests with cargo test command.
Related Link:
https://www.digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-9-test-driven-development
Links:
Getting Started with STM32 and Nucleo: https://www.youtube.com/watch?v=hyZS2p1tW-g&list=PLEBQazB0HUyRYuzfi4clXsKUSgorErmBv
Introduction to Real-Time Operating Systems (RTOS): https://www.youtube.com/watch?v=F321087yYy4&list=PLEBQazB0HUyQ4hAPU1cJED6t3DU0h34bz
Raspberry Pi Pico 2: https://www.digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
Intro to CI/CD: https://www.youtube.com/watch?v=1nxGcfIm-TU&list=PLEBQazB0HUyR00bgoctk-5uZoOrbmPASC
Learn more:
Maker.io - https://www.digikey.com/en/maker
DigiKey’s Blog – TheCircuit https://www.digikey.com/en/blog
Connect with DigiKey on Facebook https://www.facebook.com/digikey.electronics/
And follow us on X: https://x.com/digikey
Product:
https://www.digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
https://www.digikey.com/en/products/detail/raspberry-pi/SC1632/26241102
https://www.digikey.com/en/products/detail/raspberry-pi/SC1633/25862735
https://www.digikey.com/en/products/detail/raspberry-pi/SC1634/26241087
https://www.digikey.com/en/products/detail/sparkfun-electronics/13314/6797646
https://www.digikey.com/en/products/detail/lite-on-inc/LTL-4224/217584
https://www.digikey.com/en/products/detail/stackpole-electronics-inc/CF14JT220R/1830334
https://www.digikey.com/en/products/detail/te-connectivity-alcoswitch-switches/1825910-6/1632536
https://www.digikey.com/en/products/detail/dfrobot/FIT0096/7597069
https://www.digikey.com/en/products/detail/adafruit-industries-llc/1957/6827090
https://www.digikey.com/en/products/detail/cvilux-usa/DH-20M50055/13175849
Chapters:
0:00 Intro
0:51 Overview of Test-Driven Development (TDD)
4:55 Implement I2C Stub
19:25 Write Unit Tests
23:33 Run Unit Tests
26:14 Conclusion Intro to Embedded Rust Part 9: Test-Driven Development | DigiKey](https://i.ytimg.com/vi/n7q4WYA9qVY/mqdefault.jpg)


