Close

PT7C4311WEX accuracy redux

A project log for J1772 Hydra

Charge two electric vehicles at once

nick-sayerNick Sayer 02/21/2016 at 06:480 Comments

I finally had a chance to perform the calibration testing for the clock.

Stumbling block number one... the FT/OUT pin of the chip is an open drain, meaning you have to pull it up to actually get to see the square wave. Grumble. I was able to hack this up, but it was painful, so the next version of the board will actually add the pull-up resistor and have a calibration test pin for convenience.

Stumbling block number two... The default value for the calibration register, it turns out, is +31, which ostensibly makes the thing run 124 ppm fast. So no wonder the Hydra clock has been all over the place before now.

The good news is that the crystal I'm using, with the 8 pF loading caps, results in two board sets so far that have been inside of 10 ppm. Both are slightly slow - one 5 ppm, the other 1 ppm.

I've had to customize the DS1307 RTC library that plugs into the Time library for Arduino. I haven't done it yet, but I'm going to need to fork the library for the Hydra so that others can build the same firmware. I've also made a bug fix for the time-setting code. The original code attempts to or the seconds with 0x80, but then the write() method converts the value to BCD, which means 0x80 isn't going to stay 0x80. The new method simply writes 0x80 into the seconds register in the first pass, then writes the seconds by themselves in a second pass.

Anyway, if you've got a EVSE variant Hydra, your real-time clock is probably whacky. You probably want to update your firmware.

UPDATE: My pull request to the DS1307RTC library was accepted, so you don't have to take my private fork any more! Yay!

Discussions