Teensy 4.0 CAN bring-up using Rust

OIEIEIO

Member
I wanted to share a small Teensy 4.0 test rig I’ve been working on using Rust instead of the usual Arduino / Teensyduino environment.

The setup is a Teensy 4.0 running Rust firmware, with CAN1 transmitting through one external CAN transceiver, across a short CANH/CANL twisted pair, into a second transceiver, and back into CAN2 receive. The firmware is currently sending a 64-frame drone-style CAN catalog once per cycle, and the host-side Rust dashboard is parsing the live serial/log stream.

I know most Teensy work here is naturally centered around Arduino and Teensyduino, but Rust on Teensy 4.x may be useful for people who want a more bare-metal/register-level workflow while still keeping a clean modern build system.

The dashboard shows:

CAN1 TX -> external transceiver -> CAN bus -> external transceiver -> CAN2 RX
64 frames per cycle
500 kbit/s
100% pass rateTX/RX frame matchinglive decoded frame grid
CAN error/status counters


Attached are screenshots of the physical test rig and the live dashboard.
PXL_20260612_152626103.jpg
Screenshot from 2026-06-12 11-22-38.png

At the moment I’ve tested the rig at 500 kbit/s, which is half of the SN65HVD230’s rated 1 Mbit/s CAN data rate.

This has been a useful bring-up test for learning the Teensy 4.x CAN hardware from Rust. The workflow has been fluid: normal Rust project structure, cargo build, cargo run, flashing through the Teensy runner, and a separate Rust terminal dashboard for monitoring.

I’ve also done a Teensy 4.1 SD card bring-up directly on bare metal Rust, so this is becoming a useful environment for experimenting with Teensy hardware outside the usual Teensyduino path.

Thanks to Paul and the PJRC crew. The Teensy 4.x boards have been solid, approachable hardware to work with, and they’ve been fun to explore from Rust.

Screenshot from 2026-06-12 12-00-36.png
 
Very interesting - I like to test it out but I only have the Teensy 4.1 - will that work?
I have not tested that firmware on a Teensy 4.1 yet - my 4.1 runs different firmware because it brings up the SD card and other stuff.
But the FlexCAN engine between them is the same - so 40 to 41 CANbus works perfect - testing it now.
1781537535202.png
 

Attachments

  • Screenshot from 2026-06-15 11-33-00.png
    Screenshot from 2026-06-15 11-33-00.png
    142.1 KB · Views: 22
Cool! I've wanted to try using Rust with a Teensy Micromod but right now the CAN drivers don't actually support the third CAN bus nor will they do CAN-FD like the third bus can do. I was going to try to help with that but I never got enough time. It's kind of involved as the changes go all the way down the levels of abstraction in order to support the third bus and also let it enter FD. But, it'd sure be cool if it could support that.
 
Cool! I've wanted to try using Rust with a Teensy Micromod but right now the CAN drivers don't actually support the third CAN bus nor will they do CAN-FD like the third bus can do. I was going to try to help with that but I never got enough time. It's kind of involved as the changes go all the way down the levels of abstraction in order to support the third bus and also let it enter FD. But, it'd sure be cool if it could support that.
Thanks Collin, that lines up with what I’m seeing too. I’ve been doing some Teensy 4.x Rust bring-up work around FlexCAN, mostly at the register level rather than through a full driver abstraction.

I haven’t enabled or claimed CAN FD yet because I don’t currently have FD-capable transceiver hardware on the bench to validate it properly.

But I do think the work is in the same direction. Since the bring-up is touching the FlexCAN registers directly, it should provide a useful foundation for eventually looking at the third CAN bus and CAN FD support. The FD side would still need the proper register setup, larger payload handling, timing/data-phase work, and real hardware validation.

So for now I’d call it: Classical CAN proven on CAN1/CAN2, with a possible low-level path toward CAN3/CAN FD later.

If someone has a spare Teensy MicroMod and CAN FD transceiver setup they’d be willing to put on the bench or send my way, I’d be interested in taking a crack at it.
 
Back
Top