View previous topic :: View next topic |
Author |
Message |
Slim PICins
Joined: 03 Feb 2016 Posts: 2 Location: Nevada,USA
|
USB_CDC enum after Watchdog reset |
Posted: Thu Feb 25, 2016 11:37 am |
|
|
Usb_cdc working well, however, after watchdog (that I forced by message received) won't enumerate. The cable remains connected. It appears the PC must detach first then the sequence works OK. Hard power reset works OK.
Hmmmmmmmm, any ideas?
Code: |
void ResetHandler(void)
{
usb_detach(); // no help
while(1);
} |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19540
|
|
Posted: Thu Feb 25, 2016 12:35 pm |
|
|
You should not be triggering the watchdog.
If a serial port is open, Windows will hold it open, and can't re-enumerate the device.
You need to add a monitor to your Windows application, that if it doesn't see communications in a while closes the port. Have the Windows application set DTR when it opens the port. Then write the PIC code to test for DTR, and only communicate if this is seen.
You've actually got to disconnect at the Windows end. The PIC can't do anything about this. |
|
|
|