I'm using this library with a DS1307 module. It works fine.
As I checked the DS1307.cpp file, I found setCalibration and getCalibration functions.
If I get it right, setCalibration writes 0x07 address of the chip.
void DS1307RTC::setCalibration(char calValue)
{
unsigned char calReg = abs(calValue) & 0x1f;
if (calValue >= 0) calReg |= 0x20; // S bit is positive to speed up the clock
Wire.beginTransmission(DS1307_CTRL_ID);
#if ARDUINO >= 100
Wire.write((uint8_t)0x07); // Point to calibration register
Wire.write(calReg);
#else
Wire.send(0x07); // Point to calibration register
Wire.send(calReg);
#endif
Wire.endTransmission();
}
DS1307 Datasheet marks 0x07 as the Control Register, the whole document doesn't mention Calibration Register at all.
probably poor historical choice in the function name. May be (far fetched?) it's meant to say that the SQW output could be used to assess the drift and calibrate/compensate later on in software...
just don't use that method and the compiler will get rid of it
An interesting speculation, but using the SQW output to assess the drift assumes that you have a source of accurate data to compare it with. If so, then why not use that for timing instead or use it to set the RTC time at regular intervals
Personally I suspect that the library is based on one for a different RTC and is simply left over from there
UKHeliBob:
Personally I suspect that the library is based on one for a different RTC and is simply left over from there
that's probably more likely
there are calibration techniques involving the measure the accuracy of the crystal oscillator (here for STM32F101xx and STM32F103xx RTC) which then requires storing a calibration information in a register. May be that's the origin indeed