The internal clock of my Teensy 3.6 is running too fast (84 seconds per hour) when setting the CPU speed to 2 Mhz, that's a lot. Is that so? I provide a simple test sketch for reproduction. As Serial USB output is not possible at 2 Mhz I print the time on a SSD1306 Oled display. Same behaviour on 2 Teensy 3.6. On a 3.2@2Mhz the time is fast by ~12 seconds per hour. Teensys purchased at antratek.de. I'm on Arduino 1.8.5 and Teensuduino 1.40.
Here is the scetch with no Oled output, you can see the blinking LED (every second) runs out of sync within seconds by comparing the second tick to a real clock.
Code:
#include <DS1307RTC.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(4);
int old_second = -1;
void setup()
{
setTime(Teensy3Clock.get());
pinMode(13, OUTPUT);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3c);
}
void loop()
{
if (second() != old_second)
{
old_second = second();
digitalWrite(13, HIGH);
delay(30);
digitalWrite(13, LOW);
displayClock();
}
}
void displayClock(void)
{
oled.clearDisplay();
oled.setTextColor(WHITE);
oled.setTextSize(1);
oled.setCursor(0, 14);
oled.print(second());
oled.display();
}
time_t getTeensy3Time(void)
{
return Teensy3Clock.get();
}
Here is the scetch with no Oled output, you can see the blinking LED (every second) runs out of sync within seconds by comparing the second tick to a real clock.
Code:
#include <DS1307RTC.h>
int old_second = -1;
void setup()
{
setTime(Teensy3Clock.get());
pinMode(13, OUTPUT);
}
void loop()
{
if (second() != old_second)
{
old_second = second();
digitalWrite(13, HIGH);
delay(30);
digitalWrite(13, LOW);
}
}
time_t getTeensy3Time(void)
{
return Teensy3Clock.get();
}