Skip to main content
Associate
Jan 9, 2025 5:12 PM UTC
Solved

STM32WB55 : how to know if EXTI comes from SWI ?

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.

This topic has been closed for replies.
Pavel A.
Pavel A.Best answer
Jan 9, 2025 11:29 PM UTC

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

 

3 replies

Pavel A.
Pavel A.Best answer
Jan 9, 2025 11:29 PM UTC

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

 

Associate
Jan 10, 2025 6:58 AM UTC

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.
Jan 11, 2025 12:55 AM UTC

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