cancel
Showing results for 
Search instead for 
Did you mean: 

Low Power Mode problem

marcl
Associate II
Posted on November 10, 2008 at 05:59

Low Power Mode problem

4 REPLIES 4
marcl
Associate II
Posted on May 17, 2011 at 12:50

Hallo everybody,

First of all, my configuration :D

Ride7 version 7.14.0001 with RKit-ARM 1.13.0810 and STM32F103RBT6 daughterboard.

Then, the problem 😉

I tried to use low power modes but I have some problems with this. When I use in my code any __WFI or __WFE istruction, after debugging and running the RUN led of RLink turns on but nothing happens - even if in the code I turn on some LEDs before using the __WFI istructions they are not turned on.

In the new IDE version I am using, a message appears:''Lost communication with target.Terminating debug session''.

I used also the PWR examples in STM FWLib, and others from STM website, but they all give me this problem.

What could it be?

Greeting.

marcl
Associate II
Posted on May 17, 2011 at 12:50

Nobody can help me?

andreas2
Associate II
Posted on May 17, 2011 at 12:50

You need to set a flag in the debug configuration registers to prevent the low power modes from shutting down the clock and/or power to the debug unit. I don't remember the name of the register, but it's in the debug section of the ref manual.

marcl
Associate II
Posted on May 17, 2011 at 12:50

Thanks for the answer, your idea seems to me the right one but...I just tried the DBGMCU_Config function but I have the same problem. Here's the code:

int main(void)

{

RCC_Configuration();

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);

RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP | RCC_APB1Periph_PWR,ENABLE);

NVIC_Configuration();

GPIO_Configuration();

/*This should keep debugger connection during Sleep mode*/

DBGMCU_Config(DBGMCU_SLEEP, ENABLE);

/* Config the EXTI to wake up from SLEEP Mode */

EXTI_Configuration();

/* Mode: SLEEP + Entry with WFI*/

__WFI();

while (1){}

}

void GPIO_Configuration(void)

{

GPIO_InitTypeDef GPIO_InitStructure;

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;

GPIO_Init(GPIOC, &GPIO_InitStructure);

/* Configure PA.0 as input floating (EXTI Line0) */

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

GPIO_Init(GPIOA, &GPIO_InitStructure);

}

void EXTI_Configuration(void)

{

EXTI_InitTypeDef EXTI_InitStructure;

GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0);

EXTI_ClearITPendingBit(EXTI_Line0);

EXTI_InitStructure.EXTI_Line = EXTI_Line0;

EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;

EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;

EXTI_InitStructure.EXTI_LineCmd = ENABLE;

EXTI_Init(&EXTI_InitStructure);

}

void NVIC_Configuration(void)

{

NVIC_InitTypeDef NVIC_InitStructure;

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);

NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQChannel;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);

}

Really can't get why it doesn't work!

[ This message was edited by: marcl on 10-11-2008 10:33 ]