Replies: 1 comment
-
Don't be sorry! We all start somewhere. I think it just so happens you're running into some embedded nuance here, which is not obvious at all. To understand the problem, first we can look at how async SPI is implemented. It uses something called a DMA engine, to copy bytes from memory to the SPI peripheral so the CPU can do other things. One limitation of the DMA engine on the ESP32's is that it can't access from FLASH memory (your stored program), only RAM address spaces. What I think is happening here is that rustc is promoting Ideally, there should be an error... but I guess that might be a bug :D; to work around this issue you can wrap your SpiDma instance in a FlashSafeDma struct, which will handle this issue. Could you try that out and see if it works after? |
Beta Was this translation helpful? Give feedback.
-
I'm working on a Watchy firmware. The device is using an ESP32-PICO-D4 and it communicates with the e-paper display using SPI. I want to make it fully async to take advantage of embassy and so on, but I'm running into a problem with async SPI.
The same code seems to work with
embedded_hal::spi::SpiDevice
, but not withembedded_hal_async::spi::SpiDevice
. I made a minimal example, this is theembedded_hal
version:https://github.com/steinuil/watchy-rs/blob/5ce4a0e41430e809bedd4b59ad7f78014d681c53/src/main.rs
...and these are the changes I made in the
embedded_hal_async
version:steinuil/watchy-rs@f568c9b
Using
embedded_hal_async
, it hangs on thespi.write()
call, while withembedded_hal
it works correctly.Is there something I'm missing? Please forgive me if it's something obvious, I'm a software person and this is my first embedded project :)
Beta Was this translation helpful? Give feedback.
All reactions