cancel
Showing results for 
Search instead for 
Did you mean: 

I2C slave address masks interferes with slave addresses 0-7

j.f303k8
Associate II

Unfortunately, I cannot post any code for this question but I believe it relates more to the HAL library and the i2c address matching hardware of the STM32 microcontrollers.

I am working on emulating multiple I2C slaves in the address range of 1-24 on a Nucleo32 STM32F303K8 microcontroller with the HAL library. I am using the interrupt mode for the HAL I2C functions so the ADDR match interrupt and flag is crucial to recognize and react to incoming master requests..

Normally, the F303K8 can only react to 2 slave addresses but using masks, specifically MASK07 to mask all 7 bits of address 2, I have been able to get a response for slave addresses in the range of 8-60 at once. (I have not tested any higher as I don't need it for my application.) Looking at the I2C specs, we can see that slave addresses 0-7 are reserved which would explain my inability to get a response from my slave device at these addresses.

What I find weird, however, is that when slave address 1 or slave address 2 with no mask is set to a value between 1-7, the F303K8 will respond to the address.

Does anyone know why enabling a mask has this effect on the first 8 bits and if there is a work around? Thanks

1 REPLY 1
j.f303k8
Associate II

Just in-case someone else encounters this later, most of the information I was looking for can be found in Section 28.7 of this reference document: STM32F303xB/C/D/E, STM32F303x6/8, STM32F328x8, STM32F358xC, STM32F398xE advanced ARM®-based MCUs.

Still can't figure out a genuine solution to this and my assumption is that it is hardware locked. You can, however, dynamically adjust OAR1 to whatever address you need during runtime.