Hi all,
I am working with uVision5, Windows 10 and MK60FN1M0VMD12 (microcontroller)
I have implemented an USB as a virtual COM on my project and all work fine. When I load my program I am able to connect/disconnect the USB from my PC (host) and the communication is good in all the scenarios, but when I power off my board and I try to connect my USB again to the PC, I have a message that the PC doesn't recognized the USB port.
I have tried to update the drivers of the USB (done), and it doesn't work.
I have tried to manage the power management of the PC (done), and it doesn't work.
I have checked that the routine of connect/disconnect USB is working good. (When I power off the board, the USB is disconnected to the PC).
When I connect the USB to the PC I do the following routine:
USBD_Initialize((uint8_t) USB_DEVICE_ID); USBD_Connect((uint8_t) USB_DEVICE_ID);
And when I disconnect the USB to the PC I do the following routine:
USBD_Disconnect((uint8_t) USB_DEVICE_ID); USBD_Uninitialize((uint8_t) USB_DEVICE_ID);
All is good until I power off the board and try to connect again the USB to my PC.
The UART module works in all scenarios, so I suspect that I am forgetting something on the initialize/uninitialize routine.
Thanks all!
Hi javierrobledo,
I would suspect something with power from the USB once USB is plugged perhaps CPU resets and that would cause a problem.That seems why when you have debugger connected the debugger provides power also that reset does not happen.
Can you check if a rest happens when you plug-in the USB?
Best regards, Milorad
Hi Milorad,
I think that I have solved the problem. I had two problems, one of them was the priority of my USB task. When I reset my board this task went to the final of the program stack and it never interrupts again. And the other was that when my program detected that there was no current going inside the circuit, it goes to a secure mode with ultra-low power consumption and (with the problem of the priority) the USB task was not able to wake up the system.
I was very desesperate because I was doing all right with logic, but this is a program of another developer, and understanding how someone thought is really difficult...
Thank you very much for your support Milorad. God bless you.
BR.
it seems that there is a lot more going on in your program then USB :-).
You are welcome.