From b863302e955f7a2c7d6d3aefb49cc6d072d6383b Mon Sep 17 00:00:00 2001 From: Paciente8159 Date: Thu, 29 Feb 2024 20:03:57 +0000 Subject: [PATCH] fixed STM32 I2C stop bit condition - fixed STM32 I2C stop bit condition --- uCNC/src/hal/mcus/stm32f1x/mcu_stm32f1x.c | 2 ++ uCNC/src/hal/mcus/stm32f4x/mcu_stm32f4x.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/uCNC/src/hal/mcus/stm32f1x/mcu_stm32f1x.c b/uCNC/src/hal/mcus/stm32f1x/mcu_stm32f1x.c index 952bde66..8afe6bdc 100644 --- a/uCNC/src/hal/mcus/stm32f1x/mcu_stm32f1x.c +++ b/uCNC/src/hal/mcus/stm32f1x/mcu_stm32f1x.c @@ -1127,6 +1127,8 @@ static uint8_t mcu_i2c_read(uint8_t *data, bool with_ack, bool send_stop, uint32 if (!with_ack) { I2C_REG->CR1 &= ~I2C_CR1_ACK; + stop = false; + mcu_i2c_write_stop(&send_stop); } else { diff --git a/uCNC/src/hal/mcus/stm32f4x/mcu_stm32f4x.c b/uCNC/src/hal/mcus/stm32f4x/mcu_stm32f4x.c index 200acfcc..eb0a1cf9 100644 --- a/uCNC/src/hal/mcus/stm32f4x/mcu_stm32f4x.c +++ b/uCNC/src/hal/mcus/stm32f4x/mcu_stm32f4x.c @@ -1149,6 +1149,8 @@ static uint8_t mcu_i2c_read(uint8_t *data, bool with_ack, bool send_stop, uint32 if (!with_ack) { I2C_REG->CR1 &= ~I2C_CR1_ACK; + stop = false; + mcu_i2c_write_stop(&send_stop); } else {