2024-10-02 06:18 PM - last edited on 2024-10-21 02:37 AM by Imen.D
Hi Sir,
2 pins are configured as I2C functionality and doesn't enable I2C interrupt. Openbootloader is referred to the example of STM32G474E-EVAL
I want to communicate with the Open Bootloader using the I2C interface, so from the host side, I executed i2cset -y 6 33 33 to the MCU, with the goal of making it jump to the application. After executing this, it initially gets stuck at OPENBL_I2C_Go in OPENBL_I2C_SendAcknowledgeByte. This happens because during OPENBL_I2C_GetCommandOpcode, the OPENBL_I2C_WaitAddress clears the ADDR (via LL_I2C_ClearFlag_ADDR). Then, after sending i2cset -y 6 33 80 00 00, it continues to OPENBL_I2C_SendByte to send OPENBL_I2C_SendAcknowledgeByte, but gets stuck at LL_I2C_IsActiveFlag_TXIS, as TXIS is never set. Therefore, the process cannot be completed. Do you have any suggestions?
2024-10-04 02:50 AM
Hello @james1105 ,
Check the STM32G4 reference manual as says:
The TXIS bit is not set when a NACK is received.
If a NACK is received: the TXIS flag is not set, and a STOP condition is automatically sent after the NACK reception. the NACKF flag is set in the I2C_ISR register, and an interrupt is generated if the NACKIE bit is set.
2024-10-06 07:54 PM - edited 2024-10-07 04:47 AM
thanks for your reply. Two more questions:
1. when we want to use openbootloader, do we need to enable i2c interrupt event?
2. When mcu receives "go" command, mcu will call OPENBL_I2C_SendAcknowledgeByte, at this moment, does master needs send command to mcu?if not, it seems mcu got stuck then timeout at OPENBL_I2C_WaitAddress because openbootloader will clear addr flag when receive opcode. if yes, what command should master send?
3. when it goes to sendbyte(OPENBL_I2C_SendByte) in SendAcknowledgeByte, i print NACK and TXIS value and both are 0, that causes the system reset. Anything I missed?
[OPENBL_I2C_SendByte]LL_I2C_IsActiveFlag_NACK:0
[OPENBL_I2C_SendByte]LL_I2C_IsActiveFlag_TXIS:0
2024-10-10 05:20 PM
Hi Sir,
2 pins are configured as I2C functionality and doesn't enable I2C interrupt. Openbootloader is referred to the example of STM32G474E-EVAL
I want to communicate with the Open Bootloader using the I2C interface, so from the host side, I executed i2cset -y 6 33 33 to the MCU, with the goal of making it jump to the application. After executing this, it initially gets stuck at OPENBL_I2C_Go in OPENBL_I2C_SendAcknowledgeByte. This happens because during OPENBL_I2C_GetCommandOpcode, the OPENBL_I2C_WaitAddress clears the ADDR (via LL_I2C_ClearFlag_ADDR). Then, after sending i2cset -y 6 33 80 00 00, it continues to OPENBL_I2C_SendByte to send OPENBL_I2C_SendAcknowledgeByte, but gets stuck at LL_I2C_IsActiveFlag_TXIS, as TXIS is never set. Therefore, the process cannot be completed. Do you have any suggestions?
1. when we want to use openbootloader, do we need to enable i2c interrupt event?
2. When mcu receives "go" command, mcu will call OPENBL_I2C_SendAcknowledgeByte, at this moment, does master needs send command to mcu?if not, it seems mcu got stuck then timeout at OPENBL_I2C_WaitAddress because openbootloader will clear addr flag when receive opcode. if yes, what command should master send?
3. when it goes to sendbyte(OPENBL_I2C_SendByte) in SendAcknowledgeByte, i print NACK and TXIS value and both are 0, that causes the system reset. Anything I missed?
[OPENBL_I2C_SendByte]LL_I2C_IsActiveFlag_NACK:0
[OPENBL_I2C_SendByte]LL_I2C_IsActiveFlag_TXIS:0
2024-10-20 10:32 PM
Hi Sir,
do you have any suggestion?