Hi,
I want to Change the Interrupt priority of KEA-128? Can you tell me How to do it ???
I got to know from datasheet that I have to write a value to NVIC_IPR2 register but how and what value to be written is not clearly given ???
Can you Explain this with an uart interrupt as an example and say how to write and which registers to write for it???
Hi Vignesh,
I suggest that you are using the CMSIS API to set the interrupt priorities, the API is
void
NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority);
If you are not familiar with the ARM NVIC and interrupt system and API, I recommend you have a look e.g. at https://mcuoneclipse.com/2016/08/14/arm-cortex-m-interrupts-and-freertos-part-1/
I hope this helps,
Erich
One thing to note about the CMSIS API is that it doesn't make it 'obvious' what the 'range' of priority values needs to be. You will find that for these M0-core devices you have 0,1,2 and 3 to work with -- lower numbers, higher priority. That is, the API 'shifts' the supplied priority into the available 'upper bits' of the NVIC architecture:
SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));