RP USB Serial Console
RP 系列 USB CDC 串口控制台
A lightweight no_std USB CDC serial console for RP2040 and RP2350.
一个轻量级的 no_std USB CDC 虚拟串口控制台模块,支持 RP2040 和 RP2350。
It provides a simple global USB serial interface for logging, formatted printing, and host-device communication.
它提供了一个简单的全局 USB 串口接口,可用于日志输出、格式化打印以及主机与设备之间的数据通信。
Table of Contents
目录
- Features / 功能特性
- Supported Platforms / 支持平台
- Installation / 安装方式
- Cargo Features / Cargo 特性
- Quick Start / 快速开始
- Examples / 示例
- API Overview / API 概览
- How It Works / 工作原理
- USB Descriptor / USB 设备描述信息
- Notes / 注意事项
- Roadmap / 路线图
- License / 许可证
Features
功能特性
-
USB CDC ACM virtual serial port
USB CDC ACM 虚拟串口 -
Supports both RP2040 and RP2350 via Cargo features
通过 Cargo feature 同时支持 RP2040 和 RP2350 -
no_stdcompatible
兼容no_std -
Global singleton-style USB console
全局单例式 USB 控制台 -
Buffered TX queue for outgoing data
内置发送缓冲队列 -
Automatic USB polling and TX flushing
自动轮询 USB 协议并自动刷新发送缓冲 -
Formatted output support
支持格式化输出 -
Easy-to-use APIs:
init()write()read()print()println()
-
Convenience macros:
usb_print!usb_println!
Supported Platforms
支持平台
RP2040
- HAL:
rp2040-hal - USB registers:
pac::USBCTRL_REGSpac::USBCTRL_DPRAM
RP2350
- HAL:
rp235x-hal - USB registers:
pac::USBpac::USB_DPRAM
This implementation is intended for the ARM-based embedded Rust workflow.
此实现面向 ARM 风格的嵌入式 Rust 工作流。
How to use it
如何使用
Example for rp2040 arm
RP2040平台使用例子
#cargo.toml
#default features is rp2040
= "0.3.0"
Example for rp2350 arm
RP2350平台使用例子
#cargo.toml
= { = "0.3.0", = false, = [ "rp2350"]}
Example for rp2350 riscv32
RP2350平台使用例子
#cargo.toml
= { = "0.3.0", = false, = [ "rp2350"]}