2008-04-11 05:23 AM
How to change Interrupt priority?
2011-05-17 03:29 AM
Hey guys
I would like to change the pirority of the interrupts, without using the ST firmware libraries. I have tryed to change the values in the NVIC_PRIOx registers, but without any luck. I have looked into the ST firmware libraries to get some ideas, specially the nvic.c but I finde it a little hard, to find out which things to setup before I am able to change the priority. If somebody could please tell me, which things to setup, except for the NVIC_PRIOx register where the actual priority is set. -Niels [ This message was edited by: nj_boelskov on 11-04-2008 09:28 ]2011-05-17 03:29 AM
I think that, I have solved the problem. I enabled the Interrupt before I changed the priority :( You cannot do that...
By doing like this: // Set ADC interrupt to priority LOW: NVIC_PRIO4 = ((NVIC_PRIO4 & 0xFF00FFFF) | 0x00C00000); // Set button interrupt to priority HIGH: NVIC_PRIO5 = ((NVIC_PRIO5 & 0x00FFFFFF) | 0x80000000); The user button interrupts the AD_IRQ. But still, if I only set the button interrupt priority to HIGH and don´t change the ADC interrupt priority, the button does not interrupt the ADC IRQ. I think that is strange when the ADC priority default is 18 and the button priority is set to 8(HIGH)??? Aparrently you have to set the interrupt prioritys if you want to be sure. [ This message was edited by: nj_boelskov on 11-04-2008 11:35 ] [ This message was edited by: nj_boelskov on 11-04-2008 11:52 ]2011-05-17 03:29 AM
And another thing. I think that there is an error in the technical reference Manual page 160. It claims that priority should be writen backwards, means with the MSB first, but from my point of view it does not look like that.
fx 0x80 (b1000) is a lower priority then 0x40 (b0100) and not the other way around. If the Manual should be right b1000 would be priority 1 and b0100 would be priority 2, but instead it looks like b1000 is priority 8 and b0100 is priority 4 -Niels [ This message was edited by: nj_boelskov on 11-04-2008 13:22 ] [ This message was edited by: nj_boelskov on 11-04-2008 13:22 ]2011-05-17 03:29 AM
Hi Niels,
I forwarded the Technical Reference Manual description issue to ARM documentation team. This should be improved in the next release. Thanks for pointing that out. Joseph