cancel
Showing results for 
Search instead for 
Did you mean: 

Adc dma complete callback to resume a task in freertos

yang hong
Associate II

Hello,

I am trying to use Adc dma complete callback to resume a suspended task to do some calculation. My DMA interrupt number is 0, and my freertos v2 configuration is followed:

#define USE_FreeRTOS_HEAP_4

/* Cortex-M specific definitions. */

#ifdef __NVIC_PRIO_BITS

 /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */

 #define configPRIO_BITS     __NVIC_PRIO_BITS

#else

 #define configPRIO_BITS     4

#endif

/* The lowest interrupt priority that can be used in a call to a "set priority"

function. */

#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY  0xf

/* The highest interrupt priority that can be used by any interrupt service

routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL

INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER

PRIORITY THAN THIS! (higher priorities are lower numeric values. */

#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5

when I try to resume task from dma conversion complete call back function, my function stacked on

 checkIfYieldRequired=xTaskResumeFromISR(AvgTaskHandle);

I checked the inner code, it looks code stopped at portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); ->configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );

and I found detail description above :

/* RTOS ports that support interrupt nesting have the concept of a

maximum system call (or maximum API call) interrupt priority.

Interrupts that are above the maximum system call priority are keep

permanently enabled, even when the RTOS kernel is in a critical section,

but cannot make any calls to FreeRTOS API functions. If configASSERT()

is defined in FreeRTOSConfig.h then

portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion

failure if a FreeRTOS API function is called from an interrupt that has

been assigned a priority above the configured maximum system call

priority. Only FreeRTOS functions that end in FromISR can be called

from interrupts that have been assigned a priority at or (logically)

below the maximum system call interrupt priority. FreeRTOS maintains a

separate interrupt safe API to ensure interrupt entry is as fast and as

simple as possible. More information (albeit Cortex-M specific) is

provided on the following link:

https://www.freertos.org/RTOS-Cortex-M3-M4.html */

so I notice there is issue on interrupt priority. anybody knows what is the problem?

1 REPLY 1

Hello @yang hong​ ,

Could you please share your project for further check ?

Thanks in advance.

BeST Regards,

Walid