Simultaneous write to SD and send to UART

Hello,

I have a project which needs to take pictures and send them over UART, I have a restricted
throughput of 115200 bauds and I have limited time to send them so I’d like to use all the time available.

I was wondering if it was possible to save pictures to the SD card while sending them to the serial port ?

My idea is to take a picture every 500ms and send them as fast as i can.
I have tried the asyncio library and using one function to take pictures and the other to send but the uart.write function seems to stop the process.

I have the OpenMV Cam H7 Plus.

Thanks
Sylvain

SD card writes and uart writes are both blocking operations.

The sensor driver itself can implement an elastic fifo for you if you set the number of frame buffers to 4 and above. This allows you to write to an SD card without dropping frames when the SD card blocks for erasing.

The UART, though, would cause issues. The system has to block on sending that data. The only way to make this work would be to implement a secondary queue of images and have them sent via a DMA-enabled UART driver. That said, MicroPython does not have a DMA enabled UART driver for the STM32 and we do not recommend creating a queue of images in RAM.

115200 is honestly kinda not suitable for sending images. How large are these pictures? 115200 is 11.25KB/s. For comparison, the SD card is 12.5MB/s. You’re talking seconds per image of generally any resolution.