cancel
Showing results for 
Search instead for 
Did you mean: 

Init of cube MX USB CDC VCP stack

mmensch
Associate II
Posted on April 07, 2017 at 15:09

Hello,

I am using STs USB CDC VCP stack on a STM32L151.

Now I have the special case that some time I come to initialize it a second time, ie call MX_USB_DEVICE_Init(); though it is running. This does not take away the port from the windows device manager COM list but there are no more characters transmitted. I was looking through the sources but I can't find a reason (but I am not very familiar with it).

Please can anybody help with some idea.

Thanks a lot

Martin

2 REPLIES 2
Imen.D
ST Employee
Posted on April 07, 2017 at 16:52

Hi,

I recommend you to run a working USB CDC example within

STM32CubeL1 

firmware package, it may be helpful as start to deduce what is going wrong in your case:

STM32Cube_FW_L1_V1.6.0\Projects\STM32L152D_EVAL\Applications\USB_Device\CDC_Standalone

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
mmensch
Associate II
Posted on April 12, 2017 at 10:43

Hi Imen,

thanks for your answer.

What you suggest is how I started my project. I build an example application with cube MX and everything is fine with it as long as I don't call MX_USB_DEVICE_Init(); a second time.

To make my case a bit clearer I give you some details.

I have a boot loader at reset vector and an application at a higher address. Besides reset boot loader shall also be jumped to from the application. This means that control over USB peripheral must be switched to the boot loader routines , memory address in BTABLE must be set newly, interrupt vectors must be changed and so on. On the other hand towards the host all these changes shall be hidden and there shall be no interrupt in connection, so I avoid to shut down USB (DeInit function) before switching to the application

I can see in device manager that the VCP is still there after switch but there are no bytes transmitted. Also I checked it with Microsoft's usbview. When I update the screen after switching to the boot loader, end point descriptors are still there while full configuration descriptors are no longer there.

I really checked the code and tried some changes but no success. I think I need someone who knows more details about USB and ST's USB stack.

Thanks a lot for any help

Martin