nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
RAM Retention Example

Modules

 main.c
 RAM Retention Example Application main file.
 

Detailed Description

The RAM Retention Example shows RAM retention mode usage and verification. It configures the system for RAM retention and then triggers System OFF. GPIO pin 7 (active low) wakes up the system. It then checks if the RAM state is conserved by verifying that the value written before going to System OFF is the same.

Note
This example runs in a loop MAX_TEST_ITERATIONS number of times. The loop is generated by system a reset which is generated after wakeup from System OFF mode. This does not work in the evaluation mode of Keil MDK, because scatter files only work in the fully licensed version. Scatter files are needed for telling the ARM linker whether or not to initialize RAM at System RESET. This example is specifically designed to run without linker scripts. The RAM_MEMORY_TEST_ADDRESS is not used by any variable and therefore no linker will try to initialize it at start-up.
                             --------------
                            |    RESET     |
                             --------------
                                   |
                             ---------------
                            |   Configure   |
                            |     GPIO      |
                             ---------------
                                   |
                         READ GPREGRET Register
                                   |
                         ---------------------
                 NO  <--|  SYSTEM_OFF_RESET?  |--> YES
                 |       ---------------------      |
                 |                                  |
       -------------------------           ---------------------
      |   Write to GPREGRET     |         |   Read Loop count/  |
      | test word +  loop_count |<-    ---|   MAX reached?      |--->NO
       -------------------------   |   |   ---------------------     |
                 |                 |   |                 ------------------------               ----------------
       ------------------------    |  YES               |  Verify RAM retention? |-->FAILURE-->|  Loop forever  |
      |  Enable RAM RETENTION  |   |   |                 ------------------------               ----------------
       ------------------------    | STOP                           |                                   ^
                 |                 |                             SUCCESS                                |
       ------------------------    |          -------------         |                                   |
      | WRITE_TEST_BYTE_TO_RAM |    --True---| ++Loop < 6? |<--------                                   |
       ------------------------               -------------                                             |
                 |                                 |                                                    |
        --------------------                     False                                                  |
       | Trigger System OFF |                      |                                                    |
        --------------------                        ----------------------------------------------------

Setup

Instructions on how to set up the nRFgo Motherboard: nRFgo Motherboard Setup (nRF6310).

LED assignments:

Button assignments:

Testing

The RAM Retention Example Application can be tested as follows:

  1. Compile and program the application.
  2. As the nRF6310 board is turned on or reset, the LEDs are blinked in order from LED 0 to LED 7.
  3. By pressing Button 7, the system wakes up.
  4. The test will run the number of times defined by MAX_TEST_ITERATIONS. If more than one test is run, the RAM retention is verified by the LEDs blinking in order from LED 7 to LED 0.
  5. If all tests are successful the LEDs will show the number 0xAB (0b10101011) . If the test fails, the LEDs will show the number 0xFF (0b11111111).