2014-06-16 01:01 AM
Hi, I work with STM32L1 and use the USB in VCP.
The firmware workperfectly
. I use the library ''STM32_USB-FS-Device_Lib_V4.0.0'' and I use the example firmware ''VirtualComport_Loopback'' The usb work!. but I needcompletely disable
the USB
and go to
''STOP mode''.The problem is that
once activated
USB
, I can not
turn it off
completely
and when go in ''STOP mode'' the STM32consumes power
(~600uA) but if not inizialize USB the STM32consumes power
(~3uA)! I inizialize USB: Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); and when de-inizialize USB : EXTI_ClearITPendingBit(EXTI_Line18); EXTI_InitStructure.EXTI_Line = EXTI_Line18; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; EXTI_InitStructure.EXTI_LineCmd = DISABLE; EXTI_Init(&EXTI_InitStructure); RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, DISABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, DISABLE); NVIC_InitTypeDef NVIC_InitStructure; /* 2 bit for pre-emption priority, 2 bits for subpriority */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); /* Enable the USB interrupt */ NVIC_InitStructure.NVIC_IRQChannel = USB_LP_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = DISABLE; NVIC_Init(&NVIC_InitStructure); /* Enable the USB Wake-up interrupt */ NVIC_InitStructure.NVIC_IRQChannel = USB_FS_WKUP_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; NVIC_InitStructure.NVIC_IRQChannelCmd = DISABLE; NVIC_Init(&NVIC_InitStructure); PowerOff(); But the USB is NOT deinizialize completely!, How I do deinizialize?2014-06-16 01:59 AM
Before stopping the USB clock you need to power down the peripheral.
E.g. like this:
_SetCNTR(CNTR_PDWN | CNTR_FRES);2014-06-16 07:28 AM
thank you very much
, go in stop mode perfect!