I am creating a RTOS kernel and need to use the PendSV handler for context switching. I trigger the PendSV handler by doing : 0xE000ED04 = (0x1 << 28);. This sets the PendSVset register to 1, so theoretically, the handler should trigger. I do disable interrupts before triggering and enable after triggering. After the enabling PendSV should trigger. The priority is the lowest 0xFF and the systick handler priority is 0x00. I am not sure what is going on and why the pendsv handler is not running. I am using an TI-MSP432 controller and I figure maybe its the way the controller is handling the interrupt?
It is set in vectpending, vectpending is 001110 which is 14 for pendsv.
If anybody can help, I'd greatly appreciate it.
I am assuming that you set
PENDSVSET
bit within Systick timer handler (from the information you gave in your comment). Since you set the PendSV priority lower than the priority of the Systick, so PendSV will pend until Systick interrupt returns. PendSV cannot interrupt Systick because it has lower priority. On returning from the Systick interrupt, PendSV will take hold through tail-chaining interrupt.So no, PendSV interrupt will not be immediately generated when you set
PENDSVSET
bit within Systick timer handler as what you've expected. It will only interrupt on returning from the Systick interrupt.