Skip to main content
Pavel A.
Mar 23, 2020 9:56 AM UTC
Solved

STM32H753. Stranger things...

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.

This topic has been closed for replies.
berendi
berendiBest answer
Principal
Mar 23, 2020 10:07 AM UTC

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.

2 replies

berendi
berendiBest answer
Principal
Mar 23, 2020 10:07 AM UTC

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.

Pavel A.
Pavel A.Author
Mar 23, 2020 1:02 PM UTC

Thank you Peter.