Peabody 15 Posted February 26, 2017 Share Posted February 26, 2017 I'm new here, and haven't been able to go through all of this thread, but just wanted to report that it's possible to generate the 8 MHz settings for a G2231 without installing a crystal. Steve Gibson did this for a project a while back, and he incorporates the calibration code into the firmware. On powerup he checks to see if the 8 MHz values are there, and if not he does the calibration and writes the result to INFO memory. It takes about 20 seconds to do this, but only on the first powerup. It's basically the same as using a crystal, but instead he uses the low-frequency oscillator in the chip. Of course it's not accurate like a crystal would be, but apparently is very stable. So basically, you set the clock to the calibrated 1 MHz, and using TimerA you count count up for a few low-frequency cycles, then set the clock to trial 8 MHz settings, set the TimerA divisor to 8, and see if you get the same result as before. If not, you adjust the trial settings until you get "very close". This produces an 8 Mhz clock that's as accurate as the 1 MHz calibration is - no better, no worse - which is normally good enough. And I was encouraged to find that if you run this code multiple times on the same chip, you get the same answer each time. I haven't tried it, but I assume with a little tweaking it would be possible to do 12 MHz and 16 MHz as well. I apologize if this has been covered before. I just didn't see anything that didn't require a crystal. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.