Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Intro to Embedded Rust Part 3 - USB Serial Logging and Debugging

Digi-Key via YouTube

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Learn how to implement USB serial communication for debugging in embedded Rust projects using the Raspberry Pi Pico 2 in this 27-minute tutorial. Build upon previous blinking LED projects to create a USB CDC (Communications Device Class) serial port that enables sending debug messages from your microcontroller to your computer. Master essential print debugging skills for embedded development using Rust's usb-device and usbd-serial crates. Explore USB communication setup on the RP2350 chip, including configuring the USB peripheral, creating USB devices with proper VID/PID identifiers, and implementing the CDC serial protocol. Understand the UsbBusAllocator for managing USB endpoints and buffers, the SerialPort abstraction for serial data operations, and the UsbDeviceBuilder for device enumeration. Discover 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. Practice non-blocking superloop architecture by structuring programs that handle multiple concurrent tasks: polling USB devices for incoming data, processing received bytes, and sending timed messages. Learn Rust's Result type and match statement for explicit error handling, understanding how pattern matching forces proper handling of both success and error cases without exceptions. Implement time-based non-blocking operations using the Timer peripheral for periodic tasks without blocking USB communication or other main loop operations. Gain practical experience with embedded Rust development suitable for developers transitioning from Arduino, MicroPython, or C/C++ embedded programming, while understanding how Rust's ownership system and type safety apply to hardware abstraction layers and why explicit error handling matters in embedded systems.

Syllabus

Intro
Define Dependencies
Set Up USB Serial
Print String Over USB Serial
Build and Flash
Challenge and Reading Assignment
Conclusion

Taught by

Digi-Key

Reviews

Start your review of Intro to Embedded Rust Part 3 - USB Serial Logging and Debugging

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.