sasikalaswathi wrote on Friday, September 20, 2019:
I have nucleo-h743zi board.I wanted to understand context switch and measure the time for it. I created 10 task each of priority 1 and set 10 GPIO pins as outputs. Inside each task I make a GPIO pin high then set the same tasks priority as 1 and then next tasks priority as 2. In the next task I disable that pin (set high in the previous task) and high another pin follwed by set that tasks priority as 1 and set the next task priority as 2. I’ve done the same for each of the ten tasks. Then I used oscilloscope to see the falling and the rising edges for the two pins in their two respective tasks.
I am now able to understand the context switch time but when I place breakpoints in my code, after setting the same task priority as 1 it goes to the next statement where I set the next task priority as 2 and then it AGAIN goes to the previous statement where I set the same task priority as 1 and then It goes the next task (who’s priority is now 2).
I expected it to directly go the next task once its priority was set as 2 but it goes to the prevous statement and then to the next task.
Not able to understand this behaviour.
Note: I’ve enabled all correct free rtos settings in the .h file(enable preemption etc). My time slice is 5Hz, I dont think that would be issue.