cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Feature Request: Please don't hardcode OwnAddress.

DOsbo
Senior

Hi All,

In a hardware architecture where there are multiple I2C slaves running the same code base, each slave must determine their own address. The code generated by Stm32Cube hard codes the OwnAddress so it is impossible to insert a unique address in its place. There are two undesirable workarounds the programmer can use:

  1. Replace the Stm32Cube initialisation MX_I2C1_Init() function with their own (risks missing out of future changes to MX_I2C1_Init()
  2. HAL De-Init I2C, insert the new unique address into structure and re-initialise using HAL Init that has the updated address. (can still use cube but Nasty).

I propose there is a new HAL function to set OwnAddress that can be called sometime after the MX_I2C1_Init(). The programmer can then set their unique address at run-time.

What do you think?

Cheers

David

0 REPLIES 0