how can I transfer audio data from ISR to a task using queues on my STM32F401 with FreeRTOS?

So guys please how can I efficiently transfer 433-byte audio data from an ISR to a task using queues on my STM32F401 with FreeRTOS? Because the ISR frequency is causing data loss, resulting in noisy audio recordings. Any alternatives to ensure a smooth data transfer?
@Middleware & OS @MCU, MPU & Firmware
file0.jpg
Solution
Do you have compression techniques in place to try to reduce the size of data to be transferred? Also Check Queue Fullness Before ISR Data Transfer. That's within your ISR, before adding data to the queue, check for available space using xQueueCanSendFromISR(yourQueueHandle). If the queue is full, handle overflow:

Drop Data (least desirable): Discard the current data packet (not ideal for audio quality).
Signal Task: Set a flag or send a notification to the task indicating dropped data so it can potentially handle the issue

You can also use xQueueSendFromISR Safely: Employ xQueueSendFromISR within the ISR to enqueue data. This function disables interrupts temporarily for safe queue access.

Hope this helps. Please share more details about your existing implementation in case you need more help
Was this page helpful?