-
Notifications
You must be signed in to change notification settings - Fork 117
Description
I think we have an initialisation error in the current code for the SD3031 RTC in SD3031.cpp on the SKR Pro board. These two lines in the git code forces my SD3031 to always return WRN: tls.init(), SD3031 (I2C 0x32) not found when you turn on verbose debugging,
bool error = !rtcSD3031.begin();
if (!error) {
I think the first line should be bool error = rtcSD3031.begin(); and this matches the code in the latest stable release that I was using on my E4 previously. This change works on the SKR Pro board when I amend the git version.
I noticed we have also lost the code for the PPS enable on the INT pin that’s in the current stable code release,
void TlsSd3031::ppsEnable() {
// frequency 0 (1Hz) on the SQW pin
rtcSD3031.enableFrequency(rtcSD3031.eHz_1Second);
}
I’m just heading to their github to flag the enableFrequency code doesn’t work for me unless I change the reg2 to write 0xEF rather than reg 2 | 0x21. The amended code looks like this,
void DFRobot_SD3031::enableFrequency(eFrequency_t fr)
{
uint8_t reg2,reg3;
readReg(SD3031_REG_CTR2, ®2, 1);
readReg(SD3031_REG_CTR3, ®3, 1);
reg2 = 0xEF;
//reg2 = reg2 | 0x21;
reg3 = reg3 | fr;
writeReg(SD3031_REG_CTR2, ®2, 1);
writeReg(SD3031_REG_CTR3, ®3, 1);
}
Not sure why it works but I seem to have the 1Hz output on the pin now and the SWS is showing the tilde.
Thanks.