r/stm32 • u/Beneficial_Item3725 • 17h ago
Where to find an STM32 slave I2C address in generated code?
Hello - I set the STM32 I2C slave address in CubeMX to 0x8. But I could not find it set to 0x8 in the code. I was told by some of my friends that it is, in fact, there (not entirely sure if they understood my question, though). What I did find was:
hi2c1.Instance = I2C1;
hi2c1.Init.Timing = 0x00000E14;
hi2c1.Init.OwnAddress1 = 16;
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
hi2c1.Init.OwnAddress2 = 0;
hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;I was wondering where I could find the address being set to 0x8 (if possible)? Specifically which file and what lines to be looking for? I did search in a lot of the files "addr" and "address" and "0x8" but unfortunately had no luck. I was also wondering how I could have used official STM resources to figure this out?
Any insights would be greatly appreciated - thanks!