How to set Interrupt priorities in CortexM0 plus (KEA-128)?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to set Interrupt priorities in CortexM0 plus (KEA-128)?

2,766件の閲覧回数
vigneshbalaji
Senior Contributor I

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???

ラベル(2)
タグ(1)
0 件の賞賛
返信
2 返答(返信)

2,238件の閲覧回数
BlackNight
NXP Employee
NXP Employee

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

0 件の賞賛
返信

2,238件の閲覧回数
egoodii
Senior Contributor III

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)));

0 件の賞賛
返信