#I2C on a STM32L011D4P7 using Embassy

3 messages · Page 1 of 1 (latest)

stoic tendon
#

I'd like to use I2C on a STM32L011D4P7 using Embassy. It needs to be a shared bus, too, as I have two I2C devices.

https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/shared_bus.rs is presented as an example (based on the RP2040), but

  1. StaticCell uses atomics that I don't have; the crate docs mention this and say that you need to import something that provides critical-section, but I don't actually know how to do that. I already import critical-section; how do I link them up?
This crate uses portable-atomic, so on targets without native atomics you must import a crate that provides a critical-section implementation. See the critical-section README for details.
  1. I'm not even halfway to implementing it, and running into the fact that i2c::Async is private on the STM32 implementation

Am I missing some docs somewhere? Is there an example of the stm32 with shared-bus i2c's anywhere (or just i2c in general)? I feel like I'm missing something with how discordant these docs seem to be. Is there a better way to use the stm32 with Rust? The last library I tried (https://github.com/stm32-rs/stm32l0xx-hal) had examples where even the blink function had a dozen issues.

I'm fairly new to embedded dev in Rust, and the last project I did was with a relatively well-supported Arduino.

GitHub

Modern embedded framework, using Rust and async. Contribute to embassy-rs/embassy development by creating an account on GitHub.

GitHub

A hardware abstraction layer (HAL) for the STM32L0 series microcontrollers written in Rust - stm32-rs/stm32l0xx-hal

#

I'm just thinking about it some more, and it doesn't necessarily need to be a shared bus, if that's easier

#

I can just architect my program a bit differently, with a manual mini-event-loop timer