AnsweredAssumed Answered

F107 CDC crashes when replugging into computer

Question asked by Wood.Robert on May 16, 2016
Latest reply on May 18, 2016 by Wood.Robert
I know this is a long shot and I can't give much information on to what's going on, but...

...A colleague used STM Cube to generate a simple FreeRTOS project for the F107 with a CDC class in device mode. Although I can plug it in, send and receive data from a serial terminal, if I unplug and then replug, FreeRTOS crashes when I plug the unit back in.

I was getting quite a lot of trace in the debugger and I could see that it was trying to enumerate, but when replugging it got here:

  case USB_DESC_TYPE_DEVICE:<br>    pbuf = pdev->pDesc->GetDeviceDescriptor(pdev->dev_speed, &len);<br>    break;

Which is in the function:

static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev ,
                               USBD_SetupReqTypedef *req)

You could see that

pdev->dev_speed

Wasn't right.

When it is right you get 
 pdev->dev_speed set to USBD_SPEED_FULL - which makes sense.  Len is set to 0.

When it crashes these values are Completely different. Len, for example, was 0x2000.

Now, even more frustratingly,  when it crashes I get no stack trace, it just goes straight to hard fault handler.

Has anyone seen this sort of behaviour? Anyone got any idea what might be doing it please?

Many thanks.




Outcomes