[FreeRTOS learning - some details and stepping records]

Follow the learning records of Wei Dongshan's FreeRTOS teaching materials

FreeRTOS all project code links (updating)

https://gitee.com/chenshao777/free-rtos_-study


Some details and common skills 1. When the serial port receives a large amount of data, after receiving a frame of data, it can give a binary semaphore, wake up the task waiting to obtain the semaphore, and then perform data processing in the task;

2. When the serial port receives a large amount of data, you can also use the message queue.
The data frame judgment and processing are carried out in the task. The message queue should be set larger to prevent data loss due to being full;

3. When using the FreeRTOS function in the interrupt function,
set the preemption priority of the NVIC to >=configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY. This value is generally 5,
and the subpriority is set to 0.
Initialize NVIC in the main function: NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

Avoid pits! 1. Do not add printf to the serial port interrupt! Otherwise, a large amount of data will not be received, because printf will take up more resources; and calling printf in the interrupt function is equivalent to interrupt nested interrupts , which may cause the program to freeze. The specific reasons will be learned later and come back to update! ! !


2. When using the counting semaphore,
set the configUSE_COUNTING_SEMAPHORES macro to 1

3. To be continued!

Guess you like

Origin blog.csdn.net/HuangChen666/article/details/129986402