SPI bus sharing? #38
|
Hi, I've gotten into embedded micropython as a hobby, and am working with a XIAO ESP32-S3, st7789, and a micro sd card module. I was using the st7789_mpy driver and was able to easily switch between reading/writing the SD card to using/updating the display. However I learned about DMA and how it might make things faster for me. My project involves a lot of full-screen re-writes (like horizontally scrolling a background with sprites on top) I tried using the s3lcd driver, but it doesn't allow me to access the sd card after I've initialized the display. (SPI host is busy even if I've deinitialized the display). I can access the sd card first, load what I initially need, and then fully deinitialize it to free the spi for the display, but if I need to load more images later I have no rightful idea. Am I missing something here? I looked into the lvgl library but it's hard to wrap my head around and more complicated than I need. (I'm mostly just loading rbg565 files from the sd card like backgrounds and sprite sheets and blitting them to a buffer, which then gets pushed to the display) Let me know if you need more information from me, I'm still pretty new to this (I don't know languages other than Python/Micropython). Thank you for your help! |
Replies: 1 comment
|
I ended up copying the s3lcd repository and added a file to separate the spi bus creation from the esp_lcd creation. Then I created another file for sd cards to initiate them using the general spi_bus and wrap them to enable vfs functions. I'm very much a hobbyist, so it's likely not the prettiest code, but it's working for me so far. I used a lot of Claude.AI to get structure down and then heavily referenced the esp_idf to fix things. Here's the repository if you're curious: |
I ended up copying the s3lcd repository and added a file to separate the spi bus creation from the esp_lcd creation. Then I created another file for sd cards to initiate them using the general spi_bus and wrap them to enable vfs functions.
I'm very much a hobbyist, so it's likely not the prettiest code, but it's working for me so far. I used a lot of Claude.AI to get structure down and then heavily referenced the esp_idf to fix things.
Here's the repository if you're curious:
https://github.com/flamingfelines/DMA_LCD_SD