Hello all,
I have an issue when I read the date-time on PCA8565. If the seconds are from 0 to 0x10 when I are reading, the date and time is correct, but if the seconds are more than 0x10, some register of the data-time readins are wrong.
I am done some tests and for example (I have wrote the wrong registers):
- seconds = 0x12 --> week day = 0x11
- seconds = 0x16 --> week day = 0x11
- seconds = 0x19 --> week day = 0x19
- seconds = 0x24 --> week day = 0x21, month = 0x21
- seconds = 0x34 --> week day = 0x31, month = 0x21
- seconds = 0x37 --> week day = 0x31, month = 0x21
- seconds = 0x45 --> hour = 0x40, day = 0x41, week day = 0x41, month = 0x41
- seconds = 0x47 --> hour = 0x40, day = 0x41, week day = 0x41, month = 0x41
- seconds = 0x49 --> hour = 0x40, day = 0x41, week day = 0x49, month = 0x41
- seconds = 0x59 --> hour = 0x40, day = 0x41, week day = 0x59, month = 0x41
Why are that happening? Why the register are ok when the seconds are 00 to 0x10?
Thanks,
Regards.
Ruben
Hi Darío,
Yes, I still have this issue. I have check some old devices and they also have the same misbehavior.
This is the schematic:
The code:
void Leer_Fecha(uint8* buffer)
{
uint8 x=0;
smbStart();
smbSendByte(SLAVEW);
smbSendByte(SECONDS);
//smbStop();
DATA_HIGH();
halMcuWaitMs(1);
CLOCK_HIGH();
halMcuWaitMs(1);
smbStart();
smbSendByte(SLAVER);
for(x=0;x<6;x++)
buffer[x] = smbRecivByte();
buffer[6] = RecivByteFinal();
smbStop();
}
The microprocessor does not have I2C port, so, I had to implement it.
Regards,
Rubén
Hello Ruben,
I hope all is great with you.
When power is applied to the device it will take some time for the oscillator to start.
After power-up, do you wait for the oscillator to lock before you interface to the PCA8565 device? Note that it can take up to 2s for the oscillator to lock. Therefore, after power up, you need to wait a minimum of 2 second.
So, I recommend waiting 2s before start using the device.
What is the crystal used in your application?
Also, check whether the I2C bus transfer is performed at highest possible (400kHz) speed. Using highest transfer speed is preferred to avoid non-monolitic counter increment.
Please let me know if you have any further question.
Regards,
David
Hello David,
The device waits more than 2 seconds (while it is initianlizing others peripherals).
The crystal used is AB26T-32.768KHZ.
I do not think that the issue is the i2c comunication, because the registers change always in the same seconds: 8,10,18,20,28,30,38,40,48,50,48. For example, is the date-time is configured as 0x00,0x00,0x00,0x01,0x00,0x01,0x17 (seconds, minutes, hour, day, weekday, month,year):
TIME SLAMP REGISTERS
form 0 to 7 seconds sec,0x00,0x00,0x01,0x00,0x01,0x17
form 8 to 9 seconds sec,0x00,0x00,0x01,0x08,0x01,0x17
form 10 to 17 seconds sec,0x00,0x00,0x01,0x10,0x01,0x17
form 18 to 19 seconds sec,0x00,0x00,0x01,0x18,0x01,0x17
form 20 to 27 seconds sec,0x00,0x00,0x01,0x20,0x21,0x17
form 28 to 29 seconds sec,0x00,0x00,0x01,0x28,0x21,0x17
form 30 to 37 seconds sec,0x00,0x00,0x01,0x30,0x21,0x17
form 38 to 39 seconds sec,0x00,0x00,0x01,0x38,0x21,0x17
form 40 to 47 seconds sec,0x00,0x40,0x41,0x40,0x41,0x17
form 48 to 49 seconds sec,0x00,0x40,0x41,0x48,0x41,0x17
form 50 to 57 seconds sec,0x00,0x40,0x41,0x50,0x41,0x17
form 58 to 59 seconds sec,0x00,0x40,0x41,0x58,0x41,0x17
Regards,
Ruben
Hi Rubén
Do you still have this issue? If so, do you think you can share your schematic and/or code to try to find what is causing the part misbehavior or if you are no longer have the problem, could you tell use how you solve it?
Best regards,
Darío
Hi all,
I have been studying the date-time each second, and the PCA8565 add the seconds value to some registers in different times:
- second 8: add 8 to week day register
- second 10: add 10 to week day register
- second 18: add 18 to week day register
- second 20: add 20 to week day register and month
- second 28: add 28 to week day register
- second 30: add 30 to week day register
- second 38: add 38 to week day register
- second 40: add 40 to week day register, day, hour and month
- second 48: add 48 to week day register
- second 50: add 50 to week day register
- second 58: add 58 to week day register
when I read the date-time from 0 to 7 seconds, all register are correct.