Sterling
DIIDevHeads IoT Integration Server
•Created by Sterling on 9/9/2024 in #middleware-and-os
Managing DMA Callback and FreeRTOS Tasks with Timing Constraints on STM32f4
My current project involves constantly receiving digital samples through DMA on an STM32f4 and performing DSP in the complete callback interrupt triggered after each sample. However, frequent callbacks are hindering freeRTOS from running other tasks while DMA waits for completion. My objective is to allow freeRTOS tasks to run every 6ms following a completed DMA callback.
Initially, I thought about disabling interrupts using
__disable_irq()
in the complete callback and re-enabling them with __enable_irq()
, but considering my high-priority button interrupt was still active—and not knowing whether this technique could guarantee exactly 6ms—I tried another approach of only deactivating the specific DMA interrupt by utilizing __set_BASEPRI(priority << (8 - __NVIC_PRIO_BITS))
.
I then started a timer that runs at intervals of 6ms before restoring normal function via calling back with_ _set_BASEPRI(0)
upon elapsed period time completing successfully executed timed actions—nonetheless,it did not work since it kept switching between both types of call-backs without allowing freertos tum to operate independently.
I would greatly appreciate any feedback or advice. Thanks 🙏🏽6 replies