cancel
Showing results for 
Search instead for 
Did you mean: 

[OpenBootloader] Fail to get TXIS with I2C protocol

james1105
Associate II

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?

 

4 REPLIES 4
Imen.D
ST Employee

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.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

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

 

 

   

 

 

james1105
Associate II

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

james1105
Associate II

Hi Sir,

do you have any suggestion?