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 support@ccsinfo.com

SOLVED using delays with USB
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dan king



Joined: 22 Sep 2003
Posts: 119

View user's profile Send private message

PostPosted: Fri Jan 24, 2014 6:47 am     Reply with quote

thanks for the reply, I've been really confused about this one. I'm starting to think the USB failure is a side effect, like you noted about the master clock. I will try adding the resistor to the clock input.

One question though, when I lock up the device and the MCLR doesn't work I can initiate the bootloader without power cycling???? This doesn't make sense to me. Why would that function (holding the prog button on the board and cycling the reset) but my code won't reset?

I also noticed that the board will reliably lock up when I get near the bottom of the board where vias are located directly under the chip. There are 5 vias in a row (VPP, Vcc, GND, and then 2 i can't follow.) I'm going to trace the 2 unknown pins because the last one in the row when touched will always cause the lockup.

thanks Dan
dan king



Joined: 22 Sep 2003
Posts: 119

View user's profile Send private message

PostPosted: Fri Jan 24, 2014 7:04 am     Reply with quote

OK, that last pin is PGC for ICSP. If I configure those pins as outputs then the usb won't start and I think the pic hangs because the heartbeat LED won't blink. I change B to inputs and it will start but hang if i touch B7.

Is some internal ICSP mode initiating?

thanks,

Dan
Ttelmah



Joined: 11 Mar 2010
Posts: 19257

View user's profile Send private message

PostPosted: Sat Jan 25, 2014 1:59 am     Reply with quote

I'd say look at your bootloader code.

Suspicion is that it is actually getting to the bootloader, and getting hung inside this. If (for instance), a reset is being triggered, and whatever condition you use to trigger the bootloader is being 'met', it gets here, then sits not receiving data, so is hung...

Thing is that every part of the code needs checks. So (for instance), have the bootloader automatically cancel if data is not received in (say) ten seconds, to avoid exactly this, and also make sure that the 'trigger' cannot happen normally.

Best Wishes
dan king



Joined: 22 Sep 2003
Posts: 119

View user's profile Send private message

PostPosted: Sat Jan 25, 2014 3:24 pm     Reply with quote

so the quick and dirty fix, is to tie Port B.6 to GND, with it configured as an input. With this in place the USB works fine and there are no lockups while handling the board anywhere. Very odd, but it works.
Ttelmah



Joined: 11 Mar 2010
Posts: 19257

View user's profile Send private message

PostPosted: Sun Jan 26, 2014 1:28 am     Reply with quote

It's not possible you are compiling through MPLAB?.
Remember if so, this turns ICD on by default, and in this case B6 would need to be pulled low.
dan king



Joined: 22 Sep 2003
Posts: 119

View user's profile Send private message

PostPosted: Sun Jan 26, 2014 6:36 am     Reply with quote

I am compiling through MPLAB, never ran into this before or never noticed it I guess. Where do you turn that off?

Thanks,

Dan
dan king



Joined: 22 Sep 2003
Posts: 119

View user's profile Send private message

solved
PostPosted: Sun Jan 26, 2014 7:15 am     Reply with quote

Yup, that was the problem. I changed the build setting to RELEASE, from DEBUG and everything works perfectly. Thanks for the tip.

Dan
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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