I would like to record all CAN bus data to a SD card. I will be using an ESP32 with a 40Mhz SPI SD card module. Using a 2KB buffer I can write to the SPI SD card at just over 1 MB/s, so the SD write is not a bottle neck.
The CAN bus speed is 500 Kbs and the overall data rate about 20-30 Kb/sec.
From a RTOS perspective what is the best way to do this?
• Task 1: CAN bus data > RTOS Queue
• Task 2: Get data from RTOS Queue and write to SD card
• Task 1: CAN bus data > Large (1KB) RTOS Ring buffer
• Task 2: When ring buffer is almost full, write to SD card.
Some other way?
Any guidance is appreciated!
Thanks in advance.