Log defmt messages over the serial port.

Overview

Crates.io Documentation

defmt-serial

A defmt target for logging over a serial port. Messages can e.g. be read using socat and passed through defmt-print, see example-artemis for how to do that. You can also try it out in a hosted environment: example-std.

#[entry]
fn main() -> ! {
    let mut dp = hal::pac::Peripherals::take().unwrap();
    let pins = hal::gpio::Pins::new(dp.GPIO);

    // set up serial
    let mut serial = hal::uart::Uart0::new(dp.UART0, pins.tx0, pins.rx0);
    defmt_serial::defmt_serial(serial);

    defmt::info!("Hello from defmt!");

    loop {
        asm::wfi();
    }
}

Remember to set the DEFMT_LOG variable when testing, e.g.:

$ cd example-std/
$ DEFMT_LOG=debug cargo run

You might also like...
A git prepare-commit-msg hook for authoring commit messages with GPT-3.

gptcommit A git prepare-commit-msg hook for authoring commit messages with GPT-3. With this tool, you can easily generate clear, comprehensive and des

Easily add emojis to your git commit messages 😎
Easily add emojis to your git commit messages 😎

gimoji A CLI tool that makes it easy to add emojis to your git commit messages. It's very similar to (and is based on) gitmoji-cli but written in Rust

A framework for iterating over collections of types implementing a trait without virtual dispatch
A framework for iterating over collections of types implementing a trait without virtual dispatch

zero_v Zero_V is an experiment in defining behavior over collections of objects implementing some trait without dynamic polymorphism.

Membrane is an opinionated crate that generates a Dart package from a Rust library. Extremely fast performance with strict typing and zero copy returns over the FFI boundary via bincode.

Membrane is an opinionated crate that generates a Dart package from a Rust library. Extremely fast performance with strict typing and zero copy returns over the FFI boundary via bincode.

A port of OxidGB to the Raspberry Pi Pico

OxidGB Pico Port This is a simple, display-only (for now) port of OxidGB to the Raspberry Pi Pico. Note that this by default overclocks your device -

Repo for Monaco, a DCA engine for Solana. Built on Solend and lending protocols (Jet, Solend, Port, etc...)
Repo for Monaco, a DCA engine for Solana. Built on Solend and lending protocols (Jet, Solend, Port, etc...)

Monaco Monaco is a DCA protocol for solana built on top of Serum and compatible with any program that implements or extends the instruction interface

A Rust port of parinfer.

parinfer-rust Infer parentheses for Clojure, Lisp and Scheme. https://github.com/eraserhd/parinfer-rust A full-featured, super fast implementation of

⚡️ Fast MagicString port driven by Rust and N-API

magic-string-rs 100% API compatible (port) MagicString by Rich-Harris implementation for Node and modern browsers, also, for rust, of course. Installa

Quickly mint NFT(able)s port forwards remotely

Easy expose A really simple way to expose some service behind a NAT, similar to rathole and frp. WARNING: This does not secure the channel, or even do

Comments
  • Nothing sent out from defmt

    Nothing sent out from defmt

    Hi @gauteh

    Firstly, thanks for your great work!

    I've had a try with it on one of my STM32WLxx PoC projects. However, it seems like nothing has been committed to UART. Here are my attempts:

    • I've tried doing something like embedded_hal_serial_Write::write(&mut uart, 0x55) and I can see the 0x55 printed as ASCII character U in the serial monitor. Therefore I guess the peripheral setup and hardware wiring should be correct.
    • I've also tried defmt-rtt before and it works fine as well.
    • I've also tried using cortex-m-rt only instead of using RTIC. But that didn't work as well.

    Here's my repo: https://github.com/huming2207/lowu/tree/25c9075b1393456c0785ac18f295e49cd54ab79a

    Maybe I forgot to add in some initialization stuff?

    Regards, Jackson

    opened by huming2207 10
Owner
Gaute Hope
Gaute Hope
Create virtual serial ports, connect them to physical serial ports, and create routes between them all.

Virtual Serial Port Router (vsp-router) Create virtual serial ports, connect them to physical serial ports, and create routes between them all. vsp-ro

Rob Donnelly 3 Nov 24, 2022
A cross-platform serial port library in Rust. Provides a blocking I/O interface and port enumeration including USB device information.

Note: This is a fork of the original serialport-rs project on GitLab. Please note there have been some changes to both the supported targets and which

Serialport 128 Jan 4, 2023
A cross-platform serial port library in Rust.

Introduction serialport-rs is a general-purpose cross-platform serial port library for Rust. It provides a blocking I/O interface and port enumeration

Bryant Mairs 143 Nov 5, 2021
Code for connecting an RP2040 to a Bosch BNO055 IMU and having the realtime orientation data be sent to the host machine via serial USB

Code for connecting an RP2040 (via Raspberry Pi Pico) to a Bosch BNO055 IMU (via an Adafruit breakout board) and having the realtime orientation data be sent to the host machine via serial USB.

Gerald Nash 3 Nov 4, 2022
🖥 Simple Arduino Serial Monitor

Born out of the desire to connect to an Arduino without having to run the whole Arduino suite.

Robin Schroer 2 Mar 19, 2022
Rust wrapping serial communication with ōRouter

orouter-serial (ōRouter serial protocol) This crate provides typed messages used for serial communication between host and oRouter. It also contains c

Overline Network 5 Dec 20, 2023
Better error messages for axum framework.

axum-debug This is a debugging crate that provides better error messages for axum framework. axum is a great framework for developing web applications

Eray Karatay 3 Feb 3, 2022
A gitmoji interactive client for using gitmojis on commit messages.

gitmoji in Rust This is just an opinionated version of gitmoji-cli written in Rust . A gitmoji interactive client for using gitmojis on commit message

igor 2 Aug 16, 2022
A CLI tool that automatically writes commit messages for you.

Automagically-generated commit messages A CLI tool that generates commit messages from your staged changes, built in Rust and using OpenAI's Codex. In

Miguel Piedrafita 839 Jan 6, 2023
Generate commit messages using GPT3 based on your changes and commit history.

Commit Generate commit messages using GPT-3 based on your changes and commit history. Install You need Rust and Cargo installed on your machine. See t

Brian Le 40 Jan 3, 2023