NS9215: Interaction between RTC and scratchpad


Has anyone got the onboard RTC and the scratchpad interface to the RTC battery backed RAM operating at the same time. I have been trying to do this without much success.

It appears that the RTC Module Control register controls putting the RTC module into standby mode so that it operates when the main power is not there and it is running on battery.

The NS9215 Hardware reference has the following note:
Note: This bit must be set to 0 when not accessing the RTC registers or battery back RAM. When early power loss interrupt is detected, set this bit to 0.

It would appear that the correct way to access both the RTC and the NVRAM is to set this bit to ‘1’, wait for the standby status bit to change to ‘1’. Then access the registers in the module, and finally to return this bit to zero, to ensure that the module is in standby if a power loss occurs.

The RTC code appears to simply set “Standby Mode” to ‘1’ when it call the RTC open function, and then leave it there.

The Scratchpad code however appears to set “Standby Mode” to 1, access the NVRAM, and then to return “Standby Mode” to 0.

It would appear that the result of this is that following an access to the NVRAM, the next access to read time from the RTC finds that it is in standby mode, and this appears to cause an exception.

At the moment I am still trying to validate that this is exactly what is happening, but any insight into this would be appreciated.

There also appears to be a secondary problem with the scratchpad interface to the NVRAM.

It would appear that the registers in the RTC module should be accessed as 32 bit words only. The scratchpad interface accesses the NVRAM as bytes which seems to cause incorrect data to be stored or returned

Hi rdeabill,

I’ve just started working with the scratchpad interface today, and so far, I can get the bus type and location, get the handle, and get the size. If I write data into the scratchpad memory, my application crashes a little while later.

I don’t know any more than that yet. Thanks for explaining what you’ve found.


This is about what I found.

If you are only using the scratchpad to get to the NVR in the RTC module, it is possible to simply read and write directly to the memory addresses. This seems to operate OK and still works if the RTC is running.

If you need help let me know and I will try to post some a code example

Hi rdeabill,

Thanks for the hint! Direct access seems to work. I am using four 32-bit words starting at address 0x900600C0. I do not examine or change “Standby Mode”.

I have written data there, rebooted several times, and retrieved the correct data. I have removed power from my test unit (only for about 20 seconds) and the data was still there.

So far so good. I intend to keep my eye on it until I gain confidence that it is really working.