cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F302: I2C slave transmitter nacking when no data is to be sent

prsteve521
Associate

Hello,

I'd like to have this feature implemented: if no data is to be sent, the I2C peripheral (in the slave mode) should not perform an ACK in case of an address match.

Of course, this wouldn't have to be an issue, if, for example, no data is ready, the interrupt routine would respond with a "no data" answer, for example sending 0xFF. However, I'm working with a codebase, where this behavior is not desired.

I was thinking about configuring the I2C peripheral in this way:
setting the SBC bit to 1 - if NBYTES=0 and the slave is addressed to send data to the master, what happens in this case?

Thank you in advance.

2 REPLIES 2
Pavel A.
Evangelist III

Maybe, disable the I2C while no data is ready? This is behavior of some I2C devices that do not stretch the clock: while busy they do not respond to addressing thus "replying NACK".

Unfortunately, this is not a solution. I need to be able to receive data too. My initial idea was that the peripheral would not respond if requested to send data while SBC=1 and NBYTES=0. If requested to receive data while SBC=1, the NBYTES could be reloaded to 0x01 (as 28.4.8 Slave byte control mode, RM0365 suggests).