• AVR Freaks

Hot!PIC32MZ RTCC get random value on POR reset

Author
arpatel
Starting Member
  • Total Posts : 69
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
2020/06/29 18:27:35 (permalink)
0

PIC32MZ RTCC get random value on POR reset

On POR reset PIC32MZ2048EFM064 gets random  values. As per reference documents it should not be affected and starts from where it was stopped.
Does anybody has similar issue?
Is this new silicin erata or harmony bug?
I am using harmony 2.4 and MPlab x 5.10
I am using harmony RTCC service to start and set RTCC bits.
Please find attached my code for RTCC initialisation.
 
 
Thank you
 
 
 
SYS_MODULE_OBJ SYS_RTCC_Initialize ( void )
{
    PLIB_DEVCON_SystemUnlock(DEVCON_ID_0); /* Unlock System */

    /* Initialize RTCC */
    PLIB_RTCC_WriteEnable(RTCC_PLIB_ID); /* Enable writes to RTCC */
    PLIB_RTCC_Disable(RTCC_PLIB_ID); /* Disable clock to RTCC */

    /* wait for clock to stop. Block too long? */
    while (PLIB_RTCC_ClockRunningStatus(RTCC_PLIB_ID)); /* clock disabled? */
 


    PLIB_RTCC_AlarmDisable(RTCC_PLIB_ID); /* Disable alarm */
    while (PLIB_RTCC_AlarmSyncStatusGet(RTCC_PLIB_ID)) ; /* Wait for disable */
    PLIB_RTCC_AlarmTimeSet(RTCC_PLIB_ID, 0x00000500);
    PLIB_RTCC_AlarmDateSet(RTCC_PLIB_ID, 0x0001010);

    /* repeat forever or 0-255 times */
    PLIB_RTCC_AlarmChimeDisable(RTCC_PLIB_ID);
    PLIB_RTCC_AlarmRepeatCountSet(RTCC_PLIB_ID, 0);

    /* enum here to select the alarm mask */
    PLIB_RTCC_AlarmMaskModeSelect(RTCC_PLIB_ID, RTCC_ALARM_ONCE_A_YEAR);

    /* Initialize the output */
    PLIB_RTCC_ClockOutputDisable(RTCC_PLIB_ID); /* Disable RTCC output */

    /* Set RTCC clock source (LPRC/SOSC) */
    PLIB_RTCC_ClockSourceSelect(RTCC_PLIB_ID, RTCC_CLOCK_SOURCE_LPRC);

    /* Setup RTCC Interrupt */
    SysRtccObject.interruptSource = INT_SOURCE_RTCC;
    /* save for checking alarm state */

    SYS_RTCC_Start();

    return (SYS_MODULE_OBJ)&SysRtccObject;

#1
aschen0866
Super Member
  • Total Posts : 4587
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: PIC32MZ RTCC get random value on POR reset 2020/06/29 19:35:42 (permalink)
5 (1)
arpatel
On POR reset PIC32MZ2048EFM064 gets random  values. As per reference documents it should not be affected and starts from where it was stopped.

According to the datasheet, what you have observed is normal.

#2
arpatel
Starting Member
  • Total Posts : 69
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
Re: PIC32MZ RTCC get random value on POR reset 2020/06/29 19:57:11 (permalink)
0
Do you have any suggestions how can I preserve it?
 
I want to continue from where it was stopped before reset.
Reference manual says it should but datasheet says deifferent.
http://ww1.microchip.com/downloads/en/DeviceDoc/61125F.pdf
 
#3
crosland
Super Member
  • Total Posts : 2057
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Warks, UK
  • Status: offline
Re: PIC32MZ RTCC get random value on POR reset 2020/06/30 05:10:21 (permalink)
2 (1)
You are probably misunderstanding the docs.
 
Nothing can survive removal of power. If you don't want it to reset, don't remove the power.
#4
Jump to:
© 2020 APG vNext Commercial Version 4.5