This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Question about application of PendSV

Reading jyiu book on Cortex-M4 and general information about usage of PendSV exception type.

One application highlighted is of context switching in the RTOS wherein on a Systick timer interrupt, instead of context switching, it will set the PendSV bit. This will then execute the context switching at the lowest priority after all other interrupts have been handled. Again this is because the priority of PendSV will be kept the lowest.

However, is the same not possible if we just lower down the priority of Systick timer exception? In that case, if any interrupt is active, the systick timer exception handler will get executed after all other interrupts are done with.

If that is possible, then what is the major benefit in using PendSV?

Am I missing something?

Parents
  • Thank you yasuhikokoumoto

    Yes that is correct that it is kind of asynchronous trap/exception. But I wonder the same purpose may be achieved using low priority Systick. Or there may be some more uses of the pendsv which I have not understood.

    There is another example for non-OS based systems like you can split a long running ISR in two parts. First you execute the high priority work in the main ISR and then rest of the low priority work can be postponed to PendSV handler. This makes sense.

Reply
  • Thank you yasuhikokoumoto

    Yes that is correct that it is kind of asynchronous trap/exception. But I wonder the same purpose may be achieved using low priority Systick. Or there may be some more uses of the pendsv which I have not understood.

    There is another example for non-OS based systems like you can split a long running ISR in two parts. First you execute the high priority work in the main ISR and then rest of the low priority work can be postponed to PendSV handler. This makes sense.

Children