Skip to main content
Associate
January 9, 2025
Solved

STM32WB55 : how to know if EXTI comes from SWI ?

  • January 9, 2025
  • 1 reply
  • 652 views

Hello,

I have used to read EXTI.SWIER1 to know if interrupt comes from SWI or external. But it seems that WB55 doesn't allow to read anymore the SWIER1 register. The RM notices that reading SWIER1 returns always '0'.

So my question is : How to know the source of the interrupt ?

EXTI.PR1 indicates an interrupt is pending but it is not very discriminant.

Best answer by Pavel A.

Just set a flag before raising the SWI in software, then check & clear it in the handler ?

 

1 reply

Pavel A.
Pavel A.Best answer
Super User
January 9, 2025

Just set a flag before raising the SWI in software, then check & clear it in the handler ?

 

Associate
January 10, 2025

Hi Pavel

Thank you for your reply. Indeed, this is an applicative solution. But the underneath question was why the behaviour of some registers changes between MCU (for general purpose functions) ?

Moreover, the SWIERx register is stamped as RW... but read returns always '0'... ahah.

I was quite reticent to use global variable and a builtin solution would be more acceptable. Anyway, it seems that there's no other way.

 

Pavel A.
Super User
January 11, 2025

why the behaviour of some registers changes between MCU 

Because these MCUs are not created equal. If some aspect of a chip is not a design goal, it is not validated and is Undefined Behavior.