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
Solution:Jump to 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
...
5 Replies
To efficiently transfer 433-byte audio data from an ISR to a task using queues on your STM32F401 with FreeRTOS:
Optimize ISR frequency
Increase queue size
Use a circular buffer
DMA transfer
Task prioritization
ISR-to-task notification
These are steps you can take
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
@Priyanka Singh I couldn't reduce the size of data , because I ready don't know compression techniques to use
so one can use pcma, pcmu or opus if there is no compression at all .. if you are already getting these streams .. then one can think to implement aac ...
Advanced Audio Coding? Yh I should use these , thanks