Well, the DS1302 now seems to be working off my 5V supply–dropped down to < 4V.
Earlier I had realized that I didn’t know whether the read failures were associated with having a 5V supply or having supply from VCC2 (primary). Tonight I swapped the power supply connections, so the lithium cell was connected to VCC2 (primary) and the bench supply was connected to VCC1 (backup). The read failures still occurred when the chip was running off of 5V; so the problem had to be associated with voltage, not supply pin.
The datasheet has this to say about the supply voltage:
|Supply Voltage VCC1, VCC2||2.0||3.3||5.5||V|
5V is within the recommended operating conditions–but 3.3V is preferred. So I added small-signal diodes between the 5V supply and VCC2 until I got down to 3.4V, at which point everything worked.
Curiously, it took four diodes to drop 1.6V, or about .4V each–not the .7V that I’d expect from silicon diodes. Granted, I can’t find a datasheet on them (1N9148); but I really doubt they’re some new exotic that I just happen to have lying around in my parts bin.
My best guess is that the 1302′s operating current is so low (in the .5 – 1mA range) that the diodes are operating below the knee. (To paraphrase Captain Barbosa, we like to think of .7V as more of a guideline.) The knee of the curve is the point at which slight increases in voltage across the diode result in rapidly increasing current. Conversely, if the diode current is externally limited below the level of the knee, the voltage drop across it can be less than .7V. I seem to recall doing a lab on this at PSU.
I’m disinclined to acquiesce to putting four small-signal diodes on the power supply of my timekeeping chip, so I guess I’ll look for a Zener in the 3.5V range. It needs to be more than 3.2V (the lithium cell’s 3.0V plus a .2V margin) to keep the chip from switching to secondary power; and it needs to be less than 4V (but I don’t know how much less), because that’s the last reading I took while it was still malfunctioning before adding two more diodes and dropping VCC2 down to 3.4V.
Best of All,
The burst write now works, so I can set the date and time with a single function call. I can only speculate that whatever was screwing up the reads was also screwing up burst writes.
That is, everything now works on the DS1302. I think I’m supposed to be elated at this point, but I’m strangely not. Maybe I’m waiting for it to fail again. Because at this point, given that it doesn’t work even when I’m operating it within specifications, I can’t figure out what changed between when it did work and when it started not working; or alternately, I can’t figure out why it ever worked.