Closed JurajKavka closed 4 years ago
BBSWQ bit allows us to generate alarms and alarm interruptions, while device runs on battery.
Incorrect. When BBSQW=1, the INT/SQW pin will output a square wave while the device is running on the backup battery. With INTCN=1 and BBSQW=0, the INT/SQW pin will be asserted when an alarm match occurs, assuming an alarm is enabled via A1IE=1 or A2IE=1. The alarm will be asserted whether the device is running on Vcc or on the backup battery.
That's true, thank You! Are you interested in this PR, when I rewrite commit message or not really?
I'm curious, do you have an application that requires a square wave when the RTC is operating on battery backup? I don't think I've come across anyone with that requirement yet.
All the confuction about BBSQW went from this article - chapter "Addendum: 2014-10-28". I'm designing my meteo sensor with pro-mini to run on batteries, so before every deep sleep of cpu I'm switching off the Vcc of sensors and DS3231 module too (with transistor as a switch). But everything works without touching the BBSQW bit, so now, I'm setting it to zero, just to be sure that no signal comes out during battery backup. But maybe it is not needed at all. :D
Function
bbsqw()
implements setting of the BBSQW bit, with help of definitionsBBSQW_ON
andBBSQW_OFF
as arguments.BBSWQ bit allows us to generate alarms and alarm interruptions, while device runs on battery.
From the data sheet: Bit 6: Battery-Backed Square-Wave Enable (BBSQW). When set to logic 1 with INTCN = 0 and V CC < V PF , this bit enables the square wave. When BBSQW is logic 0, the INT/SQW pin goes high impedance when V CC < V PF . This bit is disabled (logic 0) when power is first applied.