Electronics > Projects, Designs, and Technical Stuff
i2c debug
Wawavoun:
Hello All,
I try to talk i2c to a DS3231 module and first I try to read the temperature. I do that with a 6809 proc via a 6522 B port bit 0 and 1.
The DS3231 reply with a great constancy $FF for temperature MSB and LSB.
The recording of the i2c session is here.
The point looking strange is that the DS3231 reply NACK to device selection, to data write instruction and to address to read... Reading the datasheet this should be a ACK.
Can somebody point to me what is wrong in the transmission ???
Thanks and regards.
Philippe
Edit 1 : I should mention that I have no battery into the module during the test.
moffy:
Not sure that the 6522 is level compatible with I2C, which typically has pull up resistors of around 1.5k. Maybe you would be better off inserting a TTL to I2C buffer between the 6522 and the I2C?
SiliconWizard:
The line just seems stuck to 1 when the slave should reply, which is what you should have concluded here IMO and which makes sense as I don't think a 6522 can be configured with open drain outputs. (Or if it can let me know.)
So let us know a bit more about how that's configured. How do you use the 6522 to emulate I2C?
Wawavoun:
I use the 6522 as follow.
For writing (master --> slave) :
First I set the output register definitively to $00.
Then I use only the data direction register.
To get logic high I configure the line as an input so, thanks to the pull up resistors (4.7 k), the line go to logic high.
To get a logic low I set the pin as an output and, thanks to output register set to 0, the line go to logic low.
For reading (slave --> master) :
The 6522 pin is set as input and the ds3231 module (open drain outputs) do the job.
For information SCL frequency during data transmission is around 38 KHz.
At least the logic analyzer see zero and one. But to get the real voltage level I have to check with a scope.
Thanks for the help.
Regards.
Philippe
SiliconWizard:
Ok then, your method looks correct. Should work. The slave address you use looks also correct. So, I don't know. 3 things to check: 1/ to make sure the direction of the SDA line is effectively set to input on the 6522 when reading the ACK bits and for the read bytes, 2/ to indeed look at SDA with a scope, to see if the signal drops when it should be read as 0, but not enough to pass the low threshold. That may be the case here. Finally, 3/ make sure the DS3231 you use is actually working - do you have any MCU dev board or a I2C-USB bridge you could test it with?
Navigation
[0] Message Index
[#] Next page
Go to full version