4.1 How to use RTC ram

tdc

New member
Greetings all,

Here https://www.pjrc.com/store/teensy41.html#tech it says that there are 16 bytes of RTC ram and "This memory is accessed as 32 bit registers LPGPR0-LPGPR3.". I coded the following to test this and get LPGPR[0-3] not defined errors. What magic incantation am I missing to make this work? Thank you in advance.

Code:
// Test sketch to access RTC registers

float w = 123.45;
float x = 789.101112;
int   y = 218;
unsigned long z = 123456;

void setup() {
  LPGPR0 = w;
  LPGPR1 = x;
  LPGPR2 = y;
  LPGPR3 = z;
}

void loop() {

}
 
Good link @shawn

As shown there the missing piece is this line. It wasn't easy to find, but it was found as noted in the SDK to enable and made the access work:

Code:
void setup() {
	[B]SNVS_LPCR |= (1 << 24); //Enable NVRAM - documented in SDK[/B]
...
 
Thanks much, that works. Follow up questions, what and where is this "SDK" (I've never heard of it), and how to access the RTC ram on the 3.6?
 
Thanks much, that works. Follow up questions, what and where is this "SDK" (I've never heard of it), and how to access the RTC ram on the 3.6?

Glad it works. No idea of the SDK - just a rumor in that comment from the person that saw it there - noted in posts - likely the SDK from NXP for the processor ...

There is a similar older post for RTC of the T_3.6. It has 8 DWords but one is used by PJRC to track the need to init the RTC startup with compile time.
 
Back
Top