embeded/Cortex-M4 Ti2016. 11. 23. 17:08

원인 불명(?)으로

trim 값이 0x7FFF가 기본값인데

0x0114정도 들어있어서

어느 순간인가 갑자기 1초 더해지는게 아닌 2초가 더해지는 현상을 발견 -_-


결론은.. 이걸 어떻게 구워삶냐 인가..

일단 

  if(HibernateIsActive())

{

HibernateRTCTrimSet(0x7FFF);

}

식으로 되어 있어야 trim이 설정되는거 같은데 끄응... 머리 아프네

어떤 조건에서 설정이 되는지 알수가 없다보니..


+

일단은.. hibernate가 on 되어야 설정이 되는데

그렇다면.. 설정이 안된채로 넘어간적도 있다는 건가? 싶은데.. 머지?


데이터 시트 상으로는, 64초 마다 더하거나 뺸다고

그런 이유로 보고 있으면 갑자기 시간이 2초가 간다거나 하는 식으로 드러난다.

(물론 0x7FFF 보다 적을 경우는 빠르게 가고 0x7FFF < x < 0x10000 일 경우에는 느리게가는 듯?)


+

lm3s1607의 hibernate예제

클럭 초기화가 두번이네.. 일단은 이렇게 해주니 문제없이 rtc가 가동되는 듯..

     //

    // Enable the Hibernation module.

    //

    SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);


    //

    // Per an erratum, sometimes on wake the Hibernation module control

    // register will be cleared when it should not be.  As a workaround a

    // location in the non-volatile data area can be read instead.  This data

    // area is cleared to 0 on reset, so if the first location is non-zero then

    // the Hibernation module is in use.  In this case, re-enable the

    // Hibernation module which will ensure that the control register bits have

    // the proper value.

    //

    HibernateDataGet(&ulHibernateCount, 1);

    if(ulHibernateCount)

    {

        HibernateEnableExpClk(SysCtlClockGet());

        HibernateClockSelect(HIBERNATE_CLOCK_SEL_DIV128);

    }


    //

    // Check to see if Hibernation module is already active, which could mean

    // that the processor is waking from a hibernation.

    //

    if(HibernateIsActive())

    {

        //

        // Read the status bits to see what caused the wake.

        //

        ulStatus = HibernateIntStatus(0);

    }


    //

    // Enable the Hibernation module.  This should always be called, even if

    // the module was already enabled, because this function also initializes

    // some timing parameters.

    //

    HibernateEnableExpClk(SysCtlClockGet());


    //

    // If the wake was not due to button or RTC match, then it was a reset.

    //

    if(!(ulStatus & (HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_RTC_MATCH_0)))

    {

        //

        // Configure the module clock source.

        //

        HibernateClockSelect(HIBERNATE_CLOCK_SEL_DIV128);


        //

        // Finish the wake cause message.

        //

        RIT128x96x4StringDraw("RESET", COL(7), ROW(4), 15);


        //

        // Wait a couple of seconds in case we need to break in with the

        // debugger.

        //

        SysTickWait(3 * 100);


        //

        // Allow time for the crystal to power up.  This line is separated from

        // the above to make it clear this is still needed, even if the above

        // delay is removed.

        //

        SysTickWait(15);

    }


    //


Posted by 구차니