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.