Hi,
I am using I2C on STM32F0, but the question is not platform specific.
I am looking for a way to send write command followed by immediate read command, but without STOP in between.
This is needed for the slave chip I am using - ADV7180. At page 78 of the datasheet is shown the READ sequence. It needs first writing to the slave with one byte the gives the register address, then read from the slave (sending the slave address again). Just to note that the WRITE sequence is easily achievable with single call to i2cMasterTransmitTimeout() and it works fine.
My initial idea (for the READ register) was to perform first i2cMasterTransmitTimeout() and then to make i2cMasterReceiveTimeout(). But the chip refuses the second read with NAK. Comparing my logic analyzer trace with those diagrams at page 78 I saw that I have one STOP condition at the end of the i2cMasterTransmitTimeout(). So I think that this is the reason for getting NAK-ed.
Is there a way to do this with the current I2C API?
I2C: i2cMasterTransmitTimeout() without STOP at the end?
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: I2C: i2cMasterTransmitTimeout() without STOP at the end?
The function you mentioned allows for a read phase after transmit without a stop, there is no need for a second call to receive().
Giovanni
Giovanni
Re: I2C: i2cMasterTransmitTimeout() without STOP at the end?
I think you can do the whole thing with a single call to i2cMasterTransmitTimeout() - set up the call to transmit one byte and receive n bytes.
Re: I2C: i2cMasterTransmitTimeout() without STOP at the end?
Thank you, I will give it a try. This was my initial implementation but it didn't work. I suspect that I had other problems at the same time (power mode control of the slave chip) so I have to re-test.
Will report back the results.
Will report back the results.
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: I2C: i2cMasterTransmitTimeout() without STOP at the end?
In case of problems please read this too: http://www.chibios.org/dokuwiki/doku.ph ... e_shooting
Giovanni
Giovanni
Re: I2C: i2cMasterTransmitTimeout() without STOP at the end?
Sure it worked fine, there was addressing problem in the beginning and it tricked me to believe that default sequence is not suitable for this chip.
Thank you again for being so helpful (on time)!
Thank you again for being so helpful (on time)!