cancel
Showing results for 
Search instead for 
Did you mean: 

STR910FA hangs after SLEEP and never wakes up!!!

software2
Associate II
Posted on October 15, 2009 at 10:55

STR910FA hangs after SLEEP and never wakes up!!!

6 REPLIES 6
software2
Associate II
Posted on May 17, 2011 at 09:58

this is the code to put our micro to sleep:

.....

VIC_ITCmd(WIU_ITLine, DISABLE); // not interested in interrupt

WIU_Cmd(ENABLE); // enable wake-up functionality

SCU_MCLKSourceConfig(SCU_MCLK_RTC); // from ST ''errata''

disable(); // this disables interrupts globally

WIU->PR = 0xFFFFFFFF; // Clear pending WIU interrupts

SCU_EnterSleepMode(); // bid good night and sweet dreams to CPU...

WIU->PR = 0xFFFFFFFF; // Clear pending WIU interrupts (again, to be safe)

asm(''nop''); asm(''nop''); asm(''nop''); asm(''nop''); asm(''nop''); asm(''nop'');

// tried putting many more NOPs, but to no avail...

SCU_MCLKSourceConfig(SCU_MCLK_PLL); // restore clock, if it woke up...

.....

this code hangs on SOME machines (NOT all of them). To my current knowledge it hangs on some CPU rev. G, but NOT rev. H, although I can't be positive on this, as yet.

I have browsed the forum for such a problem and found similar complaints, but couldn't find a solution.

Please, dear guys at ST, HELP!!! I'm bewildered :o !

software2
Associate II
Posted on May 17, 2011 at 09:58

Hi, thanks for your reply...

I'm not sure what you mean with the ''tsleep entry time'', but I've tried putting many NOPS (by many I mean even hundreds!) after the ''SCU_EnterSleepMode()'' call, just to be sure the CPU has time to ''fall asleep''. If there is something else I'm supposed to do, please let me know...

Yes, the wake-up event is from external lines, connected to a keyboard, whose signals are perfectly clean. Besides, remember, when I replace my ''Rev. G CPU'' card with a ''Rev. H CPU'' card - keeping the SAME firwmare and keyboard - everything works fine: it always wakes up from sleep, always!

What's wrong with all this? :(

Regards.

armmcu
Associate II
Posted on May 17, 2011 at 09:58

Hi,

Unfortunately me too I was complaining with a similar issue!!!

But to be an efficient helper let me know these inputs:

- Are you respecting the “tsleep� entry time already mentioned in

the manufacturer datasheet

- What kind of wake up event you are using?

- If the wake up event is through external interrupts , are you sure that your awaking signal is pure (no noise)?

Regards.

armmcu
Associate II
Posted on May 17, 2011 at 09:58

Hi,

As I can see throough the ST Erratasheet (document listing all the silicon limitations)

There is no difference between RevH, and RevG devices except the current consumption on VDDQ source.

So far ago I remember that I had a discussion with ST guys and they stated: the STR9 I/Os are sensitive to noise and the simple glitch on the awaking signal can be seen by the core as a wake up event .For sure when occurring in the prohibited period(prior to enter to sleep) this may let the CPU hang.

So it seems the card populated with RevG device in your case is more sensitive to noise than the card populated with RevH device.

To be sure that all your problems are coming from external noise I can suggest to you two tests:

-Use the RTC alarm event as awaking event ( free of any kind of noise)

-Or keep your external interrupt as awaking event and use serially a Schmitt trigger on the signal acting as noise filter.

Let me know of your results.

Regards,

Arm.

software2
Associate II
Posted on May 17, 2011 at 09:58

Your idea is good.

I've enabled waking-up from the RTC alarm, while disabling the external interrupts. Guess what? The ''RevH card'' keeps working fine and wakes up at alarm time, whereas the ''RevG card'' keeps NOT working! :-[

Now, it would seem there is definitely something wrong with that particular card, but the problem is it is not the only one to show the problem (although I don't have any other specimen at the moment...)

Thanks anyway.

Regards

ly_liuyang_ly
Associate
Posted on May 17, 2011 at 09:58

I face the same problem

in Rev H.

code like this: (used in uCOS2)

RTC_SetAlarm(alarm); /*set alarm*/

RTC_AlarmCmd(ENABLE); /* enable alarm */

/*The system clock source switched to the RTC clock */

OS_ENTER_CRITICAL(); // this disables interrupts globally before enter sleep mode

RTC_ITConfig(RTC_IT_Per | RTC_IT_Tamper, DISABLE);

RTC_ClearFlag(RTC_FLAG_Alarm | RTC_FLAG_Per | RTC_FLAG_Tamper); /* clear RTC flag*/

RTC_ITConfig(RTC_IT_Alarm, ENABLE); /*Enable RTC alarm interrupt*/

VIC_ITCmd(WIU_ITLine, DISABLE);

y = SCU_GetMCLKFreqValue() / 1000;

SCU_MCLKSourceConfig(SCU_MCLK_RTC);

SetLED(1); // show the system status, just GPIO operations

WIU->PR = 0xFFFFFFFF; // Clear pending WIU interrupts

/*Enter Sleep mode*/

SCU_EnterSleepMode();

WIU->PR = 0xFFFFFFFF;

/* Dummy instructions

Execution of N=12 dummy instructions. This number depends on

the ratio between CPU clock frequency and the oscillator input

frequency(Please refer to the STR91xFA reference manual).

For fcpuclk = 32.768Khz, N=3 */

__nop(); __nop(); __nop();

/*Switch to oscillator as clock source after wake up*/

if (y > 25)

{ // MCLK by PLL

while(!(SCU->SYSSTATUS&SCU_FLAG_LOCK)); /*Wait PLL to lock*/

SCU_MCLKSourceConfig(SCU_MCLK_PLL); // restore clock, if it woke up...

} else SCU_MCLKSourceConfig(SCU_MCLK_OSC);

SetLED(0);

// clear RTC alarm and enable WIU interrupt

RTC_ITConfig(RTC_IT_Alarm, DISABLE);

RTC_AlarmCmd(DISABLE);

RTC_ITConfig(RTC_IT_Per, ENABLE);

VIC_ITCmd(WIU_ITLine, ENABLE);

OS_EXIT_CRITICAL(); // enabled interrupts globally

XXX codes: following some codes here will sometimes not run?

the problem is: CPU cannot wakup up or after OS_EXIT_CRITICAL, the system hang.

PS:OS_EXIT_CRITICAL set CPSRE reg to enable int.:

OS_CPU_SR_Save

MRS R0, CPSR

ORR R1, R0, #OS_CPU_ARM_CONTROL_INT_DIS ; Set IRQ and FIQ bits in CPSR to disable all interrupts.

MSR CPSR_c, R1

BX LR ; Disabled, return the original CPSR contents in R0.

OS_CPU_SR_Restore

MSR CPSR_c, R0

BX LR

any suggest? or what code can be used as common purpose? :-[