mirror of
https://github.com/apache/nuttx.git
synced 2026-10-13 09:10:17 +00:00
stm32_i2c_init() and stm32_i2c_deinit() hardcoded APB1LENR/APB1LRSTR while taking the enable and reset bits from the per-instance config. That is correct for I2C1-3, but I2C4 is on APB4: its clk_bit and reset_bit are RCC_APB4ENR_I2C4EN and RCC_APB4RSTR_I2C4RST, both bit 7, and bit 7 of APB1LENR/APB1LRSTR is TIM13. So for I2C4 the driver enabled and pulsed the reset of TIM13 instead, and never reset the I2C4 peripheral at all. I2C4 still works because rcc_enableapb4() enables I2C4EN at boot, but the peripheral reset that stm32_i2c_reset() (CONFIG_I2C_RESET) relies on to clear a wedged I2C state machine never happens, and deinit gates TIM13 while leaving the I2C4 clock running. Store the clock enable and reset register addresses in struct stm32_i2c_config_s next to the bits, and use them in stm32_i2c_init() and stm32_i2c_deinit(). Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com> |
||
|---|---|---|
| .. | ||
| include | ||
| src | ||
| CMakeLists.txt | ||
| Kconfig | ||