THe RTC module in the NS9215 supports 64 bytes of NVRAM that is supported by the backup battery according to the datasheet.
Has anyone managed to get this working?
I have tried accessing it directly, and it seems that I can read and write to it, I can then read back the updated value, but when I hit the reset button it appears that the contents get set back to zero.
Any assistance would be very helpfull
Yes i did…
and it is working fine…
this piece of code is enough :
rtc_time.date = 26;
rtc_time.dayOfWeek = NA_RTC_THURSDAY;
rtc_time.hours = 11;
rtc_time.hundredths_second = 0;
rtc_time.minutes = 58;
rtc_time.month = NA_RTC_AUGUST;
rtc_time.seconds = 0;
rtc_time.year = 2010;
if( naRtcSetTime(device_id,&rtc_time) != NASTATUS_SUCCESS)
perror("RTC Set Time Failed
Thanks for the response. I also have the RTC itself working and it keeps time OK onthe backup battery.
It appears that there is also some uncommitted NVRAM within the same module, and that is what I am trying to use.
According to the NS9215 data sheet P272 it is
RTC register address map
0x9006_0000 – 0x9006_00BF RTC CSR Space
0x9006_0000 – 0x9006_00FC 64-byte Battery Backed RAM
Having written this I think I can see the mistake. The datasheet is has both the CSR space and the RAM overlapping. I will give it another try at 0x9006_00C0 and see if that works better.
Register address map || Register Address Description
9006 0000 RTC General Control register
9006 0004 12/24 Hour register
9006 0008 Time register
90060 000C Calendar register
9006 0010 Time Alarm register
9006 0014 Calendar Alarm register
9006 0018 Alarm Enable register
9006 001C Event Flags register
9006 0020 Interrupt Enable register
9006 0024 Interrupt Disable register
9006 0028 Interrupt Status register
9006 002C General Status register
These are the CSRs…
I think you can use the rest of the space
what do you use as device_id?
Its the identifier of RTC.
Take a look at
Digi ESP for NET+OS User Guide > Reference > NET+OS 7.5 API Reference > Hardware/Board Support > Device Drivers > Real Time Clock Driver (RTC)