cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H753. Stranger things...

Pavel A.
Evangelist III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
berendi
Principal

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.

View solution in original post

2 REPLIES 2
berendi
Principal

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.
Evangelist III

Thank you Peter.