这是sample code里面的主要程序,这个写进去的值,掉电还有吗?
for(i = 0; i < 20; i++)
{
printf("Write Spare register-%02d to 0x%08X ... ", i, (0x5A5A0000 + i));
RTC_WaitAccessEnable();
RTC_WRITE_SPARE_REGISTER(i, 0x5A5A0000 + i);
while(!(RTC->SPRCTL & RTC_SPRCTL_SPRRWRDY_Msk));
printf("DONE\n");
}
printf("\n");
for(i = 0; i < 20; i++)
{
printf("Read Spare register-%02d value is ", i);
RTC_WaitAccessEnable();
u32ReadData = RTC_READ_SPARE_REGISTER(i);
if(u32ReadData == (0x5A5A0000 + i))
{
printf("0x%08X ... PASS.\n", u32ReadData);
}
else
{
printf("0x%08X ... FAIL.\n", u32ReadData);
while(1);
}
while(!(RTC->SPRCTL & RTC_SPRCTL_SPRRWRDY_Msk));
}
|