STM32WB55: Wake up from Stop 1 Mode with the USB-VCP
Hello,
I'm using STM32WB55 for a while but I am quite new for using the different power modes. I am using the USB-VCP in order to open a virtual com port and my aim is controlling the board according to the data on the USB-VCP line. I can successfully receive and send data through this line.
However, I would like to put the board into Stop1 mode when there is no data is transffered and wake up with the interrupt on this USB-VCP line. If there is a specific character 's' on this line, I can go into Stop1 mode, however, I cannot wake up the board after this step. My aim is keeping the connection and waking up the board with a specific character 'w' on USB-VCP line. Here is my receive data handler under usbd_cdc_if.c file;
static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
char *str = 0;
if (*Buf == 's') {
str = "S is pressed. Going into sleep mode\n\r";
CDC_Transmit_FS((uint8_t*)str, strlen(str));
HAL_SuspendTick();
HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI);
} else if (*Buf == 'w') {
SystemClock_Config();
HAL_ResumeTick();
str = "W is pressed\n\r";
CDC_Transmit_FS((uint8_t*)str, strlen(str));
}
return (USBD_OK);
/* USER CODE END 6 */
}I am checking the reference manua at the same time but I am stucked. I will be glad, if someone suggest me the steps that I should follow or at least whether waking up from STOP1 mode with the USB-VCP data is possible or not. Thanks in advance.
Regards,
Ozan
