Teensy 4.1 RTC?

Status
Not open for further replies.
I don't see a reference to a Real Time Clock on the Teensy 4.1's pinout sheet. Does it have an RTC? If not, then it will not be suitable for any of the projects I thought of using the T4.1 in.

Jim Sheldon
 
Last edited:
Most probably VBat is one of the "orthogonal" 5 pins just beside the microSD slot.

The pinout sheet for the bottom side is not published yet; it's where the 5 pins are usually documented.
 
The row of 5 pins while SHIFTED from the T_4.0 position - are in the same order with the same Function on the T_4.1.

TEENSY 4.0 CARD for ref:
teensy40_pinout1.png
 
defragster, that did not answer my question. Does the T4.1 have an RTC or does it not? That's all I'm asking, not where the pins are or are not. I know about the T4.0 as I've used a number of them, I need to know about the 4.1 so I can make a decision whether or not to order one or more.

Jim
 
Thought "same order with the same Function on the T_4.1." answered that ...

The same 1062 MCU is in use ( different package size ) - so all T_4.0 features and functions including RTC are present on the T_4.1

Code:
[URL="https://www.pjrc.com/store/teensy41.html"]Technical Specifications Compared to Teensy 4.0[/URL]
Teensy 4.1 & 4.0 use the same IMXRT1062, so most technical specifications are the same.
 
I added the clarification to assure that @XFer's interposing post didn't create questions on pin order for other readers with the back of the card info missing and not seeing silkscreen.

Just trying to be clear in the follow up … threads don't typically close and other readers will possibly have the same question and it seemed prior response wasn't clear enough so added more detail.
 
not having much luck getting the RTC to function on T4.1 with the included timeRTC examples.
all give the same type of error, reporting an RTC is not found, this is the same of all 3 boards I have.
 
Maybe you're using the wrong library? Could you be more specific about what example you're running? The Arduino ecosystem is filled with lots of libraries for specific hardware which do not work when run on other hardware. My guess is you're running some library that is designed for specific RTC hardware.

Or in Arduino, click File > Examples > Time > TimeTeensy3 for an example which is known to work with Teensy 4.1.
 
okay timeTeensy3 does work, i presumed that the teensyTime3 example was named with 3 to make it clear it was not for the T4.
Thanks.
 
okay timeTeensy3 does work, i presumed that the teensyTime3 example was named with 3 to make it clear it was not for the T4.
Thanks.

The library was created for the original Teensy 3.0. The Teensy 3.0 was originally released in October 2012. So yes, with the introduction of the Teensy 4, things have gotten messy. Some of the t3 libraries (like the RTC) also work on the t4's, some do not (like t3_i2c), and some are works in progress and/or have significant differences under the hood (i.e. many of the display libraries due to the DMA differences).
 
I have been facing a similar problem. And have still not had luck despite trying the Teensy3 version of the code. I am able to get the Teensy 4.1 clock to sync with the laptop. But it is not persistent across a new program load (let alone power reset!).
I am just trying a manual time/date setting for now since the problem I'm having is with saving the RTC in Teensy and not syncing with an external source like an NTP or laptop.
I run the attached code and I get the expected output of default values. I then uncomment the 3 lines in setup(). This causes a time to be set and saved. The displayClock routine then prints out the manually set time correctly. I then comment the same 3 lines again and reprogram the Teensy expecting the time settings to be permanent - No such luck. Note that I have a pencil battery connected on VBAT. But that is moot since I never power off the Teensy. Just reprogram the new code. Is there a problem with Teensy4.1 retaining time information?


Code:
#include <TimeLib.h>


#define TIME_HEADER  "T"   // Header tag for serial time sync message
#define TIME_REQUEST  7    // ASCII bell character requests a time sync message 

void setup()  {
  Serial.begin(115200);
  //setTime(22,7,15,23,6,2021);
   //Teensy3Clock.set(now());
 //setTime(now());
  
}

void loop(){    
 
   Serial.println(now());
   delay(1000);

  Serial.print(hour(now()));
  printDigits(minute(now()));
  printDigits(second(now()));
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year()); 
  Serial.println(); 
}

void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year()); 
  Serial.println(); 
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}
 
Never mind:). I solved my problem. Had to add setSyncProvider(getTeensy3Time);

Girija - Can you elaborate, and show the code? I have the same problem, The T4.1 RTC can be set, I have VBAT hooked up, but it does not keep the time when powered off, it resets to 1970.
 
Girija - Can you elaborate, and show the code? I have the same problem, The T4.1 RTC can be set, I have VBAT hooked up, but it does not keep the time when powered off, it resets to 1970.

Apologies. I have been spending inordinate amounts of time in the field. I will have to get to my bench and set things up to confirm exactly how I did it. And the earliest I can do that is Oct 20th.
Just based on memory, the 'SyncArduinoClock' from 'Processing' that you use to setup time should be a Teensy version. I believe I first used the version for Arduino.
After that try the following code to retrieve and print time. If this doesn't work, please don't waste time on this code - I cannot vouch for this until I go back and do a bench verification.
Code:
#include <TimeLib.h>


#define TIME_HEADER  "T"   // Header tag for serial time sync message
#define TIME_REQUEST  7    // ASCII bell character requests a time sync message 

void setup()  {
  setSyncProvider(getTeensy3Time);
  Serial.begin(115200);
  setTime(22,7,15,23,6,2021);
  //Teensy3Clock.set(now());
 //setTime(now());
  
}

void loop(){    
 
   Serial.println(now());
   delay(1000);

  Serial.print(hour(now()));
  printDigits(minute(now()));
  printDigits(second(now()));
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year()); 
  Serial.println(); 
}

void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year()); 
  Serial.println(); 
}

time_t getTeensy3Time()
{
  return Teensy3Clock.get();
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}
 
Status
Not open for further replies.
Back
Top