I2C Slave sending wrong data on first write call

04 Feb 2019

Hello!

I'm working with an STM32L051 acting as a slave wich should read from a master and then reply to it. The read call works great, the slave receives the correct data, however when it replies the data sent is wrong for the first time after booting. If after this failed write call I try to make a new one, the data is succesfuly transmited from the slave to the master and from then all works great.

The slave is supposedly sending a char array with different values, but checking with a logic analizer and printing the received data in the master shows that all the entries of the sent array are set to 255. Repeating this again, displays the proper data. Taking this into account my best guess is that it is the slaves fault, but I don't know what can be causing this issue, any ideas or help are welcomed.

Cheers,

08 Feb 2019

Solved, I had the clock stretching mode enabled, so the CLK line was pulled Low in the slave. Deactivating it fixed the issue.