RTC and I2C errors

sandy d

New member
As in previous posts I am slowly finishing Azuritber with a PCB 1.3, ESP32 and good connection to the ardumower on PFOD bluuetooth.

The only problem has been the RTC. I have tried several modules DS1307 and DS3231, and checked they can write and read clock and EPEROM to the DUE with the usual RTC sketches at the correct I2C address.
In the normal PCB 1.3 board sockets for the RTC module the I2C scanner does not connect either type of RTC module.
I cannot see a soldering problem so I have tried connecting the RTC module to the bus - I have used I2C JST socket I2C6 on the PCB1.3 with the jumper set to 3.3volts.

Then the I2C scanner recognises the DS1307 normally;
22:25:48.582 -> I2C device found at address 0x1E Compass
22:25:48.582 -> I2C device found at address 0x50 EEPROM
22:25:48.582 -> I2C device found at address 0x68 RTC
22:25:48.582 -> I2C device found at address 0x69s IMU

Interestingly with the DS3231 the scanner recognises an unkown error at the RTC address (0x68) but recognises the EPROM address normally!

So I continued with the DS1307:
On PFOD I get the EEPROM data error only ONCE on setup and then RTC data error counts up as expected
No RTC comm errors (and I promise the RTC battery is good).

Here is the console print on start:
12:36:09.927 -> SETUP
12:36:09.927 -> ++++++++++++++* Start Robot Setup at 2502 ++++++++++++
12:36:09.973 -> Load ErrorData Address Start= 500.00 Stop= 522.00
12:36:10.320 -> UserSettings OK from Address : 2000.00 To 2502.00
12:36:10.320 -> Load Robot Stats
12:36:10.320 -> Robot Stats address Start = 800.00
12:36:10.320 -> Robot Stats address Stop = 826.00
12:36:10.320 -> RFID LIST USERDATA: NO EEPROM RFID LIST DATA
12:36:10.320 -> PLEASE SAVE YOUR RFID LIST ONCE
12:36:10.365 -> Save Robot Stats
12:36:10.867 -> Robot Stats address Start = 800.00
12:36:10.867 -> Robot Stats address Stop = 826.00
12:36:10.867 -> ERROR / ERR
12:36:10.867 -> ------------------------------- GPS Initialisation --------------------------------------------
12:36:10.867 -> Send config sentence
12:36:11.760 -> End of Gps Config
12:36:11.760 -> START
12:36:11.760 -> Ardumower 1.85-Azuritber GY-521
12:36:11.760 -> Config: Ardumower
12:36:11.760 -> press...
12:36:11.760 -> d for menu
12:36:11.760 -> v to change console output (sensor counters, values, perimeter etc.)
12:36:11.760 -> off
12:36:11.760 ->
12:36:11.760 -> Watchdog is disable
12:36:11.760 -> BT in used : Use Arduremote over Bluetooth
12:36:11.760 -> DS1307 date time return buffer error
12:36:11.760 -> RTC data error!

Here is the code which triggers the "DS1307 date time return buffer error" ( and I presume that the "RTC data error" is a downstream consequence of the buffer error):
I checked the DS1307_Address variable is set correctly for the clock.

byte buf[8];
if (I2CreadFrom(DS1307_ADDRESS, 0x00, 8, buf, 3) != 8) {
Console.println("DS1307 I2C read error");
//addErrorCounter(ERR_RTC_COMM);
return false;
}
if ( ((buf[0] >> 7) != 0) || ((buf[1] >> 7) != 0) || ((buf[2] >> 7) != 0) || ((buf[3] >> 3) != 0)
|| ((buf[4] >> 6) != 0) || ((buf[5] >> 5) != 0) || ((buf[7] & B01101100) != 0) ) {
Console.println("DS1307 date time return buffer error");
//addErrorCounter(ERR_RTC_DATA);
return false;
}

I don't understand why the buffer is in error. Any ideas for further debugging - or for fixing the error!

Thanks in advance,
 
Maybe try that
On first start you need to set date time correctly to initialise RTC using arduremote and leave power on pcb for 1hour.

For de 3231 you need to adjust I2C adress in the code ,and it’s OK.
 
Oben