cancel
Showing results for 
Search instead for 
Did you mean: 

I2C slave transmit IT first byte FF

edgar3
Associate

Hi all,

I am using a Nucleo  F334R8 STM32Cube FW_F3  V1.11.4

I am trying to configure it as a slave device using interrupts , I am using HAL_I2C_AddrCallback()then it checks if dirrection == I2C_DIRECTION_TRANSMIT and HAL_I2C_Slave_Seq_Receive_IT() works fine.
Problem comes when other direction is triggered , for some reason the first byte when using HAL_I2C_Slave_Seq_Transmit_IT() is always 0xFF ,which does not happen when using the drivers in polling mode. I tried passing different values to XferOptions parameter with same result. thanks in advance for your help.

 

I am attaching code and  logic analyzer captures.

1 ACCEPTED SOLUTION

Accepted Solutions
Foued_KH
ST Employee

Hello @edgar3 , 

You have enabled "No Clock Stretch" mode, you can't expect the thing to react to it's address and send the first byte correctly, because it does not stretch the clock to make the master wait until the slave code has loaded the first byte into its I2C engine.

If you want to do it without clock stretching, write your own I2C routines.

Foued



To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
Foued_KH
ST Employee

Hello @edgar3 , 

You have enabled "No Clock Stretch" mode, you can't expect the thing to react to it's address and send the first byte correctly, because it does not stretch the clock to make the master wait until the slave code has loaded the first byte into its I2C engine.

If you want to do it without clock stretching, write your own I2C routines.

Foued



To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.