2020-03-23 02:56 AM
For a hour I'm breaking my head. How it this possible? What's going here?
unsigned max_prio = 5;
__set_BASEPRI(max_prio);
__DSB(); __ISB();
uint32_t basep = __get_BASEPRI();
printf("basepri=%u\n", basep); //>>>>>>>>>>>> it prints 0 !
Using the Atollic IDE, if this matters.
Solved! Go to Solution.
2020-03-23 03:07 AM
Only 4 bits of interrupt priorities are implemented, it means that only bits 7...4 are effective, bits 3...0 are always set to 0. Try it with 16, 32, etc.
Functions like NVIC_SetPriority take this into account, and shift the operand left with (8U - __NVIC_PRIO_BITS), but __set_BASEPRI doesn't.
2020-03-23 03:07 AM
Only 4 bits of interrupt priorities are implemented, it means that only bits 7...4 are effective, bits 3...0 are always set to 0. Try it with 16, 32, etc.
Functions like NVIC_SetPriority take this into account, and shift the operand left with (8U - __NVIC_PRIO_BITS), but __set_BASEPRI doesn't.
2020-03-23 06:02 AM
Thank you Peter.