You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Yes, I'm afraid this is just an issue with the Pico's internal RC oscillator (although if you've updated your firmware I think it's better than the original firmware that shipped on the early ones).

    You can add a crystal to the Pico, but it has to be a very specific one (Abracon ABS06-107) - and it's pretty small so is a pain to solder. Probably the easiest way around it is to add an external RTC like http://www.espruino.com/DS3231

    Are you making your clock mains-powered? If so then you could try this code:

    var now = new Date(getTime()*1000);
    var lastSysTick = peek32(0xE000E018);
    setInterval(function() {
      var st = peek32(0xE000E018);
      if (st>lastSysTick) now.ms += 0x1000000 / 80000;
      lastSysTick = st;
    }, 1);
    

    It stores the current time in a variable called now - which is calculated from the 'SysTick' timer which runs off the high speed oscillator (which should be more accurate).

    Unfortunately to do that your device can't use setDeepSleep so it'll end up drawing more power.

    I know this isn't much help, but this is actually only an issue on the Pico. The original and WiFi boards have a crystal for a low speed oscillator, and the Bluetooth LE boards are pretty good at self-calibrating. It's just unfortunate that the chip used for the Pico had an issue where you had to use a very specific oscillator type, and I wasn't able to get them fast enough in the quantity needed for production.

About

Avatar for Gordon @Gordon started