AnsweredAssumed Answered

USB SOF interrupt not working :(

Question asked by ln.thierry on Feb 1, 2016
Latest reply on Jan 20, 2017 by Khouloud G

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

// Low layer callback
void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) {

// 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 = {
    NULL,                 /*EP0_TxSent*/
    NULL,                 /*EP0_RxReady*/
    USBD_TMC_DataIn,         /*DataIn*/
    USBD_TMC_DataOut,        /*DataOut*/
    USBD_TMC_SOF,             /*SOF */