karsten_klein wrote on Friday, April 09, 2010:
I tried the following for each task.
Afterwards the exception error DID NOT occur, but the program runs not very well, respectively it runs very slow.
-Task 1 normally works every 10ms | usStackDepth = 4000 (16kB) | lower priority
-Task 2 normally works every 1ms | usStackDepth = 256 (1kB) | higher priority
I measured the time for the uxTaskGetStackHighWaterMark(NULL) call:
Inside Task1: about 10ms !!
Inside Task2: about 0,6ms
- During the runtime of uxTaskGetStackHighWaterMark(NULL) in Task1, Task2 is blocked.
- The active-time of Task1 is as double as normal.
==> This result in the loss of speed, which I can observe.
So, without portENTER_CRITICAL()/EXIT the Task1 will be suspended by Task2, definitely during the execution of uxTaskGetStackHighWaterMark(NULL). Task1 then starts uxTaskGetStackHighWaterMark(NULL) again.
But why is this a problem which results in an exception?
Each call of uxTaskGetStackHighWaterMark(NULL) should do its job by itself, without affecting the other running uxTaskGetStackHighWaterMark(NULL) , isnt it ?
It is something like reentrancy ?
I know now that I cant solve the stackchecking in this way, but I want to understand the reason for the exception.