2016-02-01 04:37 AM
Hi,
MCU : STM32F303RBT6 Library : STM32Cube_FW_F3_V1.4.0 () I want to use USB SOF (Start Of Frame) as 1ms timer to send usb datas. With the old standard library, it's works perfectly. So, I've set my function address inside the USBD_ClassTypeDef structure as described below. The device is well recognized by the host, but the interrupt occurs only one time, then no more happens ... Is something wrong in my code, or did I forget something ? Thanks for reply [code] // Low layer callback void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) { USBD_LL_SOF(hpcd->pData); } // my SOF function uint8_t USBD_TMC_SOF(USBD_HandleTypeDef *pdev) { static uint32_t sof_counter = 0; if (sof_counter++>=5) { HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_8); sof_counter = 0; } return USBD_OK; } // structure const USBD_ClassTypeDef USBD_TMC = { USBD_TMC_Init, USBD_TMC_DeInit, USBD_TMC_Setup, NULL, /*EP0_TxSent*/ NULL, /*EP0_RxReady*/ USBD_TMC_DataIn, /*DataIn*/ USBD_TMC_DataOut, /*DataOut*/ USBD_TMC_SOF, /*SOF */ NULL, NULL, USBD_TMC_ConfigDescriptor, USBD_TMC_ConfigDescriptor, USBD_TMC_ConfigDescriptor, NULL, }; [/code] #stm32-usb-sof2016-02-01 05:39 AM
Hi,
It's seems that SOF Interrupt enable is not set after a suspend/resume event! Extrated code from stm32f3xx_hal_pcd.c (Line 583) /*set wInterrupt_Mask global variable*/ wInterrupt_Mask = USB_CNTR_CTRM | USB_CNTR_WKUPM | USB_CNTR_SUSPM | USB_CNTR_ERRM \ | USB_CNTR_ESOFM | USB_CNTR_RESETM; I've added USB_CNTR_SOFM flag, and it's works :) /*set wInterrupt_Mask global variable*/ wInterrupt_Mask = USB_CNTR_CTRM | USB_CNTR_WKUPM | USB_CNTR_SUSPM | USB_CNTR_ERRM \ | USB_CNTR_SOFM | USB_CNTR_ESOFM | USB_CNTR_RESETM;2016-02-04 01:36 AM
Hi ln.thierry,
Thanks for your feedback and contribution. I will communicate this to our team. -Hannibal-2017-01-20 01:57 AM
Hi
,Issue confirmed and corrected in version V1.7.0.
Thanks a lot for your contribution and sorry for any inconvenience this may have caused.Khouloud.