F107 CDC crashes when replugging into computer
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-16 12:52 PM
Posted on May 16, 2016 at 21:52
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.
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-18 4:06 AM
Posted on May 18, 2016 at 13:06
Well, there is clearly a problem with the Cube code that is generated as if I use a project I found here:
https://github.com/znuh/STM32_VCP When I turn it into a suitable project for my IDE and manually configure the clocks. I can plug and unplug as often as I want and it's fine. Sigh.