K64FN1MDVLL12 function vPortEnterCritical Assert stuck


FreeRTOSConfig.h configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY Set 1

runningostrich_1-1631503668497.png

BASEPRI Register VALUE

this moment VECTACTIVE Register Value 3
callstack
image

Why?

freeRtos critical Function does not work

Tell me what should i do?

Are you calling a non-ISR FreeRTOS API (i.e. a FreeRTOS API not ending in “FromISR”) from an ISR? Also, please post the callstack too.

image
call stack

VECTACTIVE Register Value 3

You see the root cause problem is the HardFault. Doing logging or any other function in exception handlers like HardFault might work or not because the application is corrupted. However, you could use direct output to the serial interface as kind of last resort action with as less code as possible and without any mutex or something else high-level.
Question is what is causing the HardFault …

Are you calling your LOG_Printf from HardFault_Handler? If so, remove that. You still need to find out the cause of the HardFault. This page has some instructions about debugging hard fault: Debugging and diagnosing hard faults on ARM Cortex-M CPUs

Thank you very much. After debugging, it is found that there is indeed a HardFault_Handler