- MCU : Raspbery pi pico
- Debug probe (another Pico)
- LEDSTRIP: Adafruit neopixel ledstrip (144 LEDs)
- LLV: logic level converter 3.3 <-> 5V (no name)
- 100 ùF capacitor
- Basic electronic stuff (breadboard, cable, connectors ...)
┌──RP2040───┐
┌────┤VSYS │
│ │ │
│ ┌─┤GND IO8 │
│ │ └─────────┬─┘
┌─────┐ ┌────┐ │ │ ┌─────────┴─┐ ┌──────┐
│ +5V├─>─┤ C1 ├──┬─┴──┼─┤ ├─┤+3.3V │
──► │ │100 │ │ │ │ TTL LLV │ │ ◄──
│ GND├─>─┤ùF ├──┼───┬┴─┤ 3.3 -> 5V ├─┤GND │
└─────┘ └────┘ │ │ └─────────┬─┘ └──────┘
│ │ ┌────────┘
┌─┴─┬─┴─┬─┴─┐
│+5V│GND│Din│
┌─┬───────┼───┼───┼───┼───────┐
│ │┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤▼│
│▼├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼│ │
│ │┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤▼│
│▼├┼┼┼┼┼┼┼───┼─────┼┼┼┼┼┼┼┼┼│ │
│ │┼┼┼┼┼┼│LED│STRIP│┼┼┼┼┼┼┼┼┤▼│
│▼├┼┼┼┼┼┼┼───┼─────┼┼┼┼┼┼┼┼┼│ │
│ │┼┼┼┼┼┼┼┼────┼┼┼┼┼┼┼┼┼┼┼┼┼┤▼│
│▼├┼┼┼┼┼┼┼│8*18│┼┼┼┼┼┼┼┼┼┼┼┼│ │
│ │┼┼┼┼┼┼┼┼────┼┼┼┼┼┼┼┼┼┼┼┼┼│ │
└─┴─────────────────────────┴─┘
source : rp-rs github project requirements
- The standard Rust tooling (cargo, rustup) : eg.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Toolchain support for the cortex-m0+ processors in the rp2040 (thumbv6m-none-eabi) : eg.
rustup target add thumbv6m-none-eabi
- flip-link - this allows you to detect stack-overflows on the first core, which is the only supported target for now. : eg.
cargo install flip-link
- probe-run. Upstream support for RP2040 was added with version 0.3.1. eg.
cargo install probe-run
- A CMSIS-DAP probe. (J-Link and other probes will not work with probe-run)
- I use a second Pico as a CMSIS-DAP debug probe.
To develop with async (embedded) Rust 🦀 with embassy framwework
graph TD
loop{{for each cell}}--> living_or_not{{is cell alive ?}}
living_or_not-->|yes|should_survive{{if N < 2 or N >3}}
should_survive--> |yes|cell_die[cell die <br/><i>loneliness or overpopulation]
should_survive--> |no|cell_live[cell stay alive]
living_or_not-->|no|should_born{{if N == 3}}
should_born-->|yes|born[living cell born]
should_born-->|no|dead[cell still dead]
-
The boilerplate to develop on RP2040 is here : https://github.com/SupImDos/embassy-rp-skeleton
-
Section about how to use a second Pico as probe : https://github.com/SupImDos/embassy-rp-skeleton#hardware-setup
-
Write tests. See below discussion about how to ...
-
Use nightly :
rustup override set nightly
-
Me
...would you tell me how do you implement test (mainly unit testing, but why not integ too) in your embassy based projects?
-
dirbaio
if it's hardware-independent logic, so you can run the tests in the host, it's easiest to separate that code into its own crate, and use regular Rust tests if it's hardware-dependent then there's defmt-test. defmt-test has some limitations though (can't have tests in multiple modules, can't reinitialize hardware between tests) so for some I've ended up doing one binary for each test, and scripting something to flash+run them in succession