System Register File on MK02

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

System Register File on MK02

Jump to solution
2,415 Views
arnoldbischof
Contributor III

The MK10 devices have a built in 32Byte System Register File unit which can be used as temporary memory which will not be erased during soft reset and following RAM test during startup of the system.

In our new Project we use the MK02. Unfortunately the MK02 do not have a System Register File unit. Is there an alternative available on the MK02 for temporary storage as described above?  

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
1,900 Views
mjbcswitzerland
Specialist V

Arnold

If you enable clocks to the PIT module before you start the RAM test, you can make a backup of the 32 bit work in a PIt load value register (PIT_LDVALn).

After the RAM test has finised write it back in RAM from there.

PIT_LDVALn is one example of various registers that can temporarily act as storage space due to the fact that it is a 32 bit R/W register that will not be used as long as the PIT is not actually programmed to do counting operation.

Regards

Mark

Kinetis: µTasker Kinetis support

K20: µTasker Kinetis TWR-K20D72M support / µTasker Kinetis FRDM-K20D50M support / µTasker Kinetis TWR-K20D50M support / µTasker Teensy3.1 support

For the complete "out-of-the-box" Kinetis experience and faster time to market


View solution in original post

0 Kudos
Reply
7 Replies
1,900 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Amold,

As Mark has mentioned, you can use Flash to store some data when SRAM lost power or reset.

Below is some info about SRAM retention in low power modes:

The SRAM is retained down to LLS3 and VLLS3 mode.

In LLS2 and VLLS2 the entire region of SRAM_U from 0x2000_0000 is powered.

In VLLS1 and VLLS0 no SRAM is retained.

Wish it helps.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
1,900 Views
arnoldbischof
Contributor III

Thanks Mark and Hui_Ma,

I can not use RAM in my case because there is a RAM test feature implemented in our application.

Explanation for our special need:

- Application receives a command to perform some tests (Hardware test, RAM Test, Watchdog Test, ...) during next startup.

- The Application saves the requested tests as bits in a bitset 'TestCommands' and initiates the watchdog test which restarts the application.

- All requested tests should be performed during this startup sequence. For that reason 'TestCommands' must retain its value after the watchdog reset.   

- The RAM test, if requested, is the first test made prior the start of the C runtime (RAM test destroys the content of the RAM).

- 'TestCommands' must retain its value after the the RAM test because the starting application must now what test should be performed next.

We used the System Register File of the MK10 to store 'TestCommands'. This solution works fine. 'TestCommands' stored in System Register File survives a reset and a RAM test.

The MK02 does not have a System Register File to store such commands. So we are searching for a solution on the MK02 for the described functionality.

Thanks for any helpful hint

Arnold

0 Kudos
Reply
1,900 Views
mjbcswitzerland
Specialist V

Arnold

If your RAM test tests everything other than the agreed location in RAM you have no problem.

Or if the RAM test backs up that same location before testing it and puts it back afterwards you also have no problem.

Generally, RAM tests don't need to be 'destructive': In some applications there is a requirement to run continuous RAM tests during normal operation to continuously monitor the correct operation of the HW and these backup a block of RAM, test the block and restores the original content so that there is no actual loss of original data content. Adapting the RAM test to work like this would also automatically preserve RAM content.

Regards

Mark

Kinetis: µTasker Kinetis support

K20: µTasker Kinetis TWR-K20D72M support / µTasker Kinetis FRDM-K20D50M support / µTasker Kinetis TWR-K20D50M support / µTasker Teensy3.1 support

For the complete "out-of-the-box" Kinetis experience and faster time to market


1,900 Views
arnoldbischof
Contributor III

Hi Mark

Thank you for your response.

The RAM test tests everything (TestDataBus, TestAddressBus and TestCells) and is definitely 'destructive'.

Thus your first proposed solution is not possible.

The second solution you proposed is that, what I did with the System Register File on the MK10. 

How can I back up one 32-bit word without System Register File on MK02 and not using RAM?

Regards

Arnold

0 Kudos
Reply
1,901 Views
mjbcswitzerland
Specialist V

Arnold

If you enable clocks to the PIT module before you start the RAM test, you can make a backup of the 32 bit work in a PIt load value register (PIT_LDVALn).

After the RAM test has finised write it back in RAM from there.

PIT_LDVALn is one example of various registers that can temporarily act as storage space due to the fact that it is a 32 bit R/W register that will not be used as long as the PIT is not actually programmed to do counting operation.

Regards

Mark

Kinetis: µTasker Kinetis support

K20: µTasker Kinetis TWR-K20D72M support / µTasker Kinetis FRDM-K20D50M support / µTasker Kinetis TWR-K20D50M support / µTasker Teensy3.1 support

For the complete "out-of-the-box" Kinetis experience and faster time to market


0 Kudos
Reply
1,900 Views
arnoldbischof
Contributor III

Hi Mark

Thanks again for your response.

I have solved the Problem in the meantime using the CRC_GPOLY register as temporary storage during RAM test.

Regards

Arnold

0 Kudos
Reply
1,900 Views
mjbcswitzerland
Specialist V

Arnold

RAM content is only lost during a software reset when the initialisation code overwrites it.

If you have an area of RAM that it doesn't write to you can use that.

Compare: Since the K02 doesn't have a RTC I use the final few bytes of internal Flash (also with KL02 - see "But my KL02 doesn't have a RTC..." at µTasker KL RTC Support ) as RTC variable loations that are incremented during normal operation and maintained across system resets.

The simplest method is to set the initial SP not to the very top of RAM, as is often done, but a few bytes below. Then there will be nothing in the system using these bytes and they can be used for the operation that you rquire.

Regards

Mark

Kinetis: µTasker Kinetis support

K20: µTasker Kinetis TWR-K20D72M support / µTasker Kinetis FRDM-K20D50M support / µTasker Kinetis TWR-K20D50M support / µTasker Teensy3.1 support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
Reply