Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: 4.1 How to use RTC ram

  1. #1
    Junior Member
    Join Date
    Nov 2020
    Location
    near Lansing, Michigan, USA
    Posts
    3

    4.1 How to use RTC ram

    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() {
    
    }

  2. #2
    Senior Member
    Join Date
    Mar 2017
    Location
    Oakland, CA, USA
    Posts
    701
    Hi! Welcome to the forum!

    This thread may help:
    https://forum.pjrc.com/threads/66076...AM-on-RTC-unit

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    17,136
    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() {
    	SNVS_LPCR |= (1 << 24); //Enable NVRAM - documented in SDK
    ...

  4. #4
    Junior Member
    Join Date
    Nov 2020
    Location
    near Lansing, Michigan, USA
    Posts
    3
    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?

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    17,136
    Quote Originally Posted by tdc View Post
    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.

  6. #6
    Junior Member
    Join Date
    Nov 2020
    Location
    near Lansing, Michigan, USA
    Posts
    3
    I took a lot of digging but I found the answer (in case someone else comes looking) at https://forum.pjrc.com/threads/67449...l=1#post315138. The subject says Teensy 4 but it contains 3.5 code which also works on the 3.6.

    Still don't know what the "SDK" referred to above is but hopefully I won't need to going forward.

    Thank you for the assist.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •