thexeno / DS1307-Emulator-Arduino-Library

The emulator of the world famous chip.
9 stars 1 forks source link

Register addresses incorrect/shifted by one? (i.e. Minutes is 0x02 instead of 0x01)??? #3

Open JOULTICOA opened 1 year ago

JOULTICOA commented 1 year ago

Hello,

I am trying to query an Arduino Pro Mini running the emulator (example "rtc_register_set_serial_print.ino") with another Arduino Pro Mini with a basic print configuration using RTClib (INO attached).

The "Reader" Arduino using RTClib and the attached INO seems to be able to query real physical OEM DS1307 just fine, including RAM contents

However, when I try to query the emulator, everything is shifted by 1. Minutes is seconds, Hours is Minutes, and so on

For example. you have to increment Hours on the example INO emulator Arduino, for the change to be reflected as Minutes on the "reader" Arduino (attached INO)

Am I missing something maybe? ds1307 Reader.zip

thexeno commented 1 year ago

Hello,

Thanks for testing. The addressing seems correct. The shift by one are you sure is not due to mismatch in SDA/SCL signals? Can you reproduce on a different setup and show the waveforms?

JOULTICOA commented 1 year ago

Thanks for the response

I posted some captures here: https://forum.arduino.cc/t/help-analyzing-i2c-logic-captures-pro-mini/1067438/9

I have SDA wired to SDA and SCL wire to SCL, not sure if thats right

When I modified the emulator library to shift everything by one, the "stock / vanilla" RTClib "Reader" Arduino is able to successfully read both an original / legit DS1307 and the emulator just fine.

However the scoreboard is not

So I've been treating the RTClib "reader" Arduino as the "known good" control, since it is able to read the original DS1307 fine, but perhaps that isn't a safe assumption

I was starting to run out of ideas and blaming my problem on the Master not supporting stretching and the Pro Mini being too slow, so my next step was going to be trying with a Teensy 4.0.

But perhaps I have another issue if I'm seemingly needing to shift your library by 1