I transplant FreeRTOS to the HT32 that a chip like STM32. I want use UART interrupt to receive some data, but when the routine run to the UART interrupt routine it can not jump out the interrupt routine ,it just run the interrupt routine over and over. What's the problem?
That a part of my config in FreeRTOS.h:
define configKERNELINTERRUPTPRIORITY 255
define configMAXSYSCALLINTERRUPT_PRIORITY 191
define configUSE_MUTEXES 1
define configUSECOUNTINGSEMAPHORES 1
And a part of my code:
NVICSetPriorityGrouping(NVICPRIORITYGROUP3);// Preemption: 4 bits / Subpriority: 0 bits
NVICSetPriority(USART1IRQn, NVICEncodePriority(NVICPRIORITYGROUP3, 12, 0));
void vultrasonicTask(void *pvParameters)
xhighSemaphore = xSemaphoreCreateCounting( 10, 0 );
xSemaphoreTake( xhighSemaphore, 500 / portTICKRATEMS );
vTaskDelay( 1000 / portTICKRATEMS );
static portBASETYPE xHigherPriorityTaskWoken;
xHigherPriorityTaskWoken = pdFALSE;
xSemaphoreGiveFromISR( xhighSemaphore, &xHigherPriorityTaskWoken );
Presumably that is because you are not clearing the interrupt so it is immediately retaken as soon as you exit the handler. What makes you think the problem is related to FreeRTOS?
Generally the ISR needs to do the immediate actions that trigger the interrupt. That generally includes for a serial port getting the character and putting it some where. (This doesn't apply for using DMA, but then when you use DMA, you don't get character ready interrupts, you get DMA complete interrupts).
The ISR could put the character in a queue if the data rate is somewhat slow. For faster channels it should build up a "message" and on receipt of a complete message signal a task to process it.
If I did not use the FreeRTOS API in the interrupt routine, it display normal. But when I use the FreeRTOS API in the interrupt routine the problem came. So I think it may related to FreeRTOS.
Thank you very much! I solved the problem in your reminder!
I had solved the problem. Proof by facts, the problem is not related to FreeRTOS. It is because i didn't get the character and put it some where. Thank you for you answer.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.