2023-02-02 03:12 AM
I'm trying to change the I2C address by using HAL_Deinit & HAL_Init, but it doesn't seem to work. The function below is what I wrote myself to change the address:
If I try to change the address,the register shows that the I2C address has been changed,but when I use another stm32 to send IIC address to it, it doesn't ACK anyway. Even though I have called the HAL_I2C_EnableListen_IT ()
if Clock Stretch been enabled, The SCL will stays low after I called the slave STM32, I don't konw what the Slave STM32 is waiting for.
I tried setting breakpoints to track the progress of the program, it seemd that the slave STM32 can't call HAL_I2C_AddrCallback() anymore after I changed it's I2C address.
I wonder how can I change the I2C address in my program and use it normally afterwards.