CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

USB_CDC enum after Watchdog reset

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Slim PICins



Joined: 03 Feb 2016
Posts: 2
Location: Nevada,USA

View user's profile Send private message

USB_CDC enum after Watchdog reset
PostPosted: Thu Feb 25, 2016 11:37 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Feb 25, 2016 12:35 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group