cancel
Showing results for 
Search instead for 
Did you mean: 

Should the USB start of frame (SOF) interrupt really be enabled?

DiBosco
Senior II
Posted on October 12, 2016 at 15:01

Folks,

I'm trying to get a VCP going on an F107.

Is it correct that with USB on an F107 that the USB OTG interrupt should be going off every 600us or so? It seems unlikely, as that is a heck of overhead to put on a micro.

I've tried disabling that interrupt but then it [the VCP]  just doesn't work at all.

Many thanks!

2 REPLIES 2
Walid FTITI_O
Senior II
Posted on October 12, 2016 at 19:32

Hi wood.robert,

I think the VCP should work even the SOF is not enable. Only rh SORM interrupt is not enabled when the SOF not enabled.

In the driver ''STM32F4xx_ll_usb.c'', inside '''' function you find the following code :

/* Disable all interrupts. */

USBx->GINTMSK = 0U;

/* Clear any pending interrupts */

USBx->GINTSTS = 0xBFFFFFFFU;

/* Enable the common interrupts */

if (cfg.dma_enable == DISABLE)

{

USBx->GINTMSK |= USB_OTG_GINTMSK_RXFLVLM;

}

/* Enable interrupts matching to the Device mode ONLY */

USBx->GINTMSK |= (USB_OTG_GINTMSK_USBSUSPM | USB_OTG_GINTMSK_USBRST |\

USB_OTG_GINTMSK_ENUMDNEM | USB_OTG_GINTMSK_IEPINT |\

USB_OTG_GINTMSK_OEPINT | USB_OTG_GINTMSK_IISOIXFRM|\

USB_OTG_GINTMSK_PXFRM_IISOOXFRM | USB_OTG_GINTMSK_WUIM);

if(cfg.Sof_enable)

{

USBx->GINTMSK |= USB_OTG_GINTMSK_SOFM;

}

if (cfg.vbus_sensing_enable == ENABLE)

{

USBx->GINTMSK |= (USB_OTG_GINTMSK_SRQIM | USB_OTG_GINTMSK_OTGINT);

}

So even SOF is not enabled, all interrupts matching the device mode Only are enabled.

-Hannibal-

DiBosco
Senior II
Posted on October 14, 2016 at 15:39

Many thanks, Hannibal. The problem was that although disabling SOF stopped the echo in the demo, it wasn't actually stopping the receive happening.

I finally got it working by disabling the SOF in software (doing it in the header file defines doesn't seem to work), then assembling the incoming message over the VCP and sending it out in a thread, later, when I have more time.

Many thanks again, that little prompt helped me solve a long standing issue.