@tracecom
Your post #5 was key for me -to finally- understand how to address the registers past just the time settings.
Also the answer to your problem of no square wave output is below (so I believe).
My DS3231 is mounted on a custom SMT to TTH board called a “ChronoDot” from MaceTech. I used your code with some modifications and can consistently control the advanced registers and output.
You didn't mention (did you?) that you have 10K pullUP resistors on both DS3231 pins one and three.
I too am a novice, so being clear is best. Place a 10K resistor between pin one and 5V, and a 10K resistor between pin three and 5V.
This assuming assuming that you have two 4.7K pullUPs between the SDL to 5V and SCL to 5V.
The Maxim spec sheet talks about the 10Ks and how pins one and three are "open-drain" on page nine.
http://www.maxim-ic.com/datasheet/index.mvp/id/4627
MaceTech talks about it here
http://docs.macetech.com/doku.php/chronodot_v2.0
Maxim also states that all N/C pins (5-12) "Must be connected to ground".
Here is what I ended up with:
Code:
i2cslave %11010000, i2cslow, i2cbyte
' secs min hrs dow date mon yr A1sec A1min A1hou A1day A2min A2hou A2daydat ctrl ctrlstat aging,TempMSB,TempLSB)
writei2c 0, ($00, $55, $12, $07, $18, $06, $11, $00, $00, $00, $00, $00, $00, $00, 208)
Note the control entry “208”
It could have been entered "$D0" instead.
Both convert to 11010000.
The Control Register settings to enable a square wave at 4.096kHz are:
(apologies for alignment)
Code:
' 11010000 Ctrl Reg :: Enable Osc / SQW Enable / No Coversion / Set BitRate 1 /SetBitRate2 / Int Enable / Alm1 / Alm2
' 1 1 0 1 0 0 0 0
' 11010000 binary converts to 208 decimal
Using a logic analyzer (LA), I can see the square wave and SWQ outputs.
Indeed, I spent close to an hour with the LA.
Using your code that "marks" confirms to be valid, I could not figure out why there was no output for either the square wave or the SQW. Worse yet, pulses would sometimes show up, then fail.
Then I re-read the MaceTech notes about the 10K pullups.
Instant success. Please see attached for views showing the 32kHz and the 4.096 readings.
For digital troubleshooting, a logic analyzer has been well worth the money to me. No way would I have solved this issue without one.
They can be found for as little as $50.
Good luck,
Terry