Not applicable
Jun 20, 2015
10:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 20, 2015
10:20 AM
Hi,
What is wrong with this code?
When I debug it in DAVE4 with XMC1100 Boot Kit the SHPR2 register not changing in the debugger.
The code is based on EasyMain (LED blinking is working for example with a modified main)
What is wrong with this code?
When I debug it in DAVE4 with XMC1100 Boot Kit the SHPR2 register not changing in the debugger.
The code is based on EasyMain (LED blinking is working for example with a modified main)
#include "XMC1100.h"
int main(void)
{
unsigned int a;
a = 0x0B << PPB_SHPR2_PRI_11_Pos;
PPB->SHPR2 |= a;
while(1);
}
1 Reply
Jul 02, 2015
08:45 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 02, 2015
08:45 PM
Hello,
The XMC1100 is based on Cortex-M0, which supports 4 priority levels. Therefore effectively only the MSB 2 bits of the priority bit fields are used.
From your code, you are effectively writing 0 to SHPR2. You should write:
- 0x0 for priority 0
- 0x40 for priority 1
- 0x80 for priority 2
- 0xC0 for priority 3
But easiest is to use the CMSIS function, for example to select priority 3:
NVIC_SetPriority(SVCall_IRQn, 3);
Regards,
Min Wei
The XMC1100 is based on Cortex-M0, which supports 4 priority levels. Therefore effectively only the MSB 2 bits of the priority bit fields are used.
From your code, you are effectively writing 0 to SHPR2. You should write:
- 0x0 for priority 0
- 0x40 for priority 1
- 0x80 for priority 2
- 0xC0 for priority 3
But easiest is to use the CMSIS function, for example to select priority 3:
NVIC_SetPriority(SVCall_IRQn, 3);
Regards,
Min Wei