cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 HAL Slave RX behavior is strange.

Takemasa
Associate III

I found very strange behavior of the STM32F7 HAL I2C. Please see the description below.

I have also attached problem demonstration program and screenshot.

Regards,

Seiichi

CubeMX version 5.0.0 for Linux

SW4STM32 version 1.15.0.201708311556 for Linux 64bit

STM32CubeFW_ F7_1.4.0

Platform : Nucleo F722

========== Problem ===========

In the I2C Slave RX operation with interrupt API ( HAL_I2C_Slave_Receive_IT() ),

the HAL doesn't generate NACK while the given receive buffer is full. 

Also, HAL triggers error callback with AF status, when transmitter stops before the 

given receive buffer is full. In this case, the received byte count is unable to calc.  

========== How demo program works ===========

In the main routine, The HAL_I2C_Slave_Receive_IT() and the HAL_I2C_Master_Transmit_IT()

is called to transfer RX_SIZE and TX_SIZE bytes. These macros are defined at line 61. 

The master and slave are I2C1 and I2C2, respectively.Both port is configured by the CodeMX.

The HAL_I2C_MasterTxCpltCallback(), HAL_I2C_SlaveRxCpltCallback(), HAL_I2C_ErrorCallback()

are defined to catch the call backs from HAL. In these call back, the status are printed 

to the UART3 ( USB Serial of the STLINK ) by 115200 baud. 

========== Result ===========

TX_SIZE, RX_SIZE,, Transfered[Bytes] , ACK/NAK, XferCount, call back, Comment

2 3 2 ACK 0 error(AF)

2 2 2 ACK 0 cplt

3 2 2 ACK 0 cplt (*1)

4 2 2 Clock Strech (*2)

(*1) See MasterTx_3B_SlaveRx_2B.PNG. Slave send ACK, while it shold send NACK.

(*2) See MasterTx_4B_SlaveRx_2B.PNG, Slave send ACk, while it should send NACK.Clock stretch occurs.  

========== How to reporoduce ===========

This program runs on the Nucleo F722 board. The I2C1 and I2C2 have to be connected by 

wire. See the Pin configuration below, and as detail of connection.  

========== Pin configuration ===========

PB8: I2C1 SCL : Need to pull up externally ( CN7 Pin 2 ) 

PB9: I2C1 SDA : Need to pull up externally ( CN7 Pin 4 )

PF1: I2C2 SCL ( CN9 pin 19 )

PF0: I2C2 SDA ( CN9 pin 21 )

1 REPLY 1
Takemasa
Associate III

Any update?