This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • Resolved

LM3S1968 problem with HibernateRTCSet()

Prodigy 190 points

Replies: 6

Views: 1541

Hi,

I have problems with HibernateRTCSet() function. See code: 

void Init_SetRTC(unsigned int nTime)
{
    unsigned int temp; 

    SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
    HibernateEnableExpClk(SysCtlClockGet());
    HibernateClockSelect(HIBERNATE_CLOCK_SEL_DIV128); 
    Delay_us(20000);      // 20ms
    HibernateRTCEnable();

   do
   {
       HibernateRTCSet(nTime);
       temp = HibernateRTCGet();
    } while (temp!=nTime);

    HibernateWakeSet(0);

All functions are from library and according to the Datasheet, including delays after writing to HIB_RTCLD.

The problem is that RTC will be set to the value only from hard reset. But any re-entry to this function will not set the RTC. The  HIB_RTCC does not change with new value written to HIB_RTCLD. This happens across several devices, so it seems not be a obvious hardware fault.

Tried to disable/re-enable the RTC, same for the Hibernation peripheral, but no success.

Thanks in advance,

Bata 

 

  • I took the hello app for the 1968 board, pasted in your function, and then called it twice with two different value, with a delay between each.  I was able to set the RTC to two different values.  I attach the modified hello example.

    hello.c
  • In reply to Stellaris Joe:

    Hi Joe,

    Thanks for helping out.

    After more debugging, I may have more accurate description of the problem.

    It is somewhat hardware related. Our device can wake up from hibernation in two ways: via a button, which is connected to WAKE input of the hibernation module and via USB. If USB is plugged in, we apply power to the microcontroller.

    I noticed following:

    1. When device is woken up from hibernation via WAKE, and running in high power, HibernateRTCSet() works without problems.

    2. When device is woken up from hibernation bypassing WAKE and running in high power,   HibernateRTCSet() does not work.

    I assume that hibernate module still thinks it is in Hibernate mode in (2) and HIBRTCLD is never copied to HIBRTCC.

    Does this make sense? If so, is there a procedure how to reset the hibernation module?

    Thanks,

    Bata 

  • In reply to Bratislav Veljkovic:

    The hibernate module has some issues.  If you want to use hibernate with this part, for production you should be using LM3S1969 instead of 1968.  The '1968 has an erratum that essentially says to not use hibernate on this part.  The '1969 is a replacement if you want to use hibernate.  It also has a list of errata for hibernate module and you should review those before you go any further with your design.

    I am not clear on how you are waking the part in the USB situation.  If you use the hibernate module to cut power to the part, then you need to use the hibernate module to wake it up.  You can't just apply power independently through another power source.  The hibernate module will be confused then because it has not gone through its wakeup cycle.  You will need to find a way to wake the part by asserting the wake pin when USB power appears, and then let the hibernate module re-apply power to the device.

  • In reply to Stellaris Joe:

    Thanks Joe.

    We gave up on the RTC in hibernation module in favor of an external RTC chip, LM3S1969 was not a good replacement. But, still many devices around to maintain...

    Ok, the core problem is that the hibernate module is confused because it did not complete its wakeup cycle. The final question (and thanks many time for your help) is can I do anything about that? Reset the module? Tried some combinations without success.

    Bata

     

  • In reply to Bratislav Veljkovic:

    I believe that a hardware reset will reset the hibernate module as well.

    The hibernate module in the LM4F parts works quite well.  If you are able you should consider an LM4F device for your application.

  • In reply to Stellaris Joe:

    Hi Joe,

    Just to conclude the topic.

    I was able to get around the problem by lowering the Wake line of the hibernation module for 0.1ms. Luckily our design allowed this. Hibernation module allowed afterwards to write to the HIB_RTCLD register and RTC was updated. Even better, this did not result in POR (hardware reset).

    Thanks for your help. 

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.