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

Lockup due to config...

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







Lockup due to config...
PostPosted: Tue Jan 08, 2008 5:30 pm     Reply with quote

I'm having problems with, as far as I can tell, lockups due to config bits that I just cant figure out. I have some code I'm working with, someone elses, running on an 18F458. I have their "correct" version on a read-protected chip and their supposedly correct (but isnt) code in file form.

I've programmed a fresh PIC with the code that, as far as I can see, is written fine (with the possible exception of the config bits). When in place and connected to all of the hardware but one bit (a large valve, which is activated by relays) they both perform identically, even the output pins that control the relays act in the same manner (watched on a two-channel scope).

However when the one I have programmed is connected up to the valve the system locks as the valve begins to be actuated (simple pulses to turn the relays on for 50 ms). The power rail appears to be dragged down to around 2.5v average and oscillating at 100Hz. Naturally the PIC sits there unhappy and needs to be reset. When the "correct" pic is used in the same hardware the power rail droops to maybe 4.8 for a ms and then returns to 5.

I know its a stab in the dark but, since I cannot contact the original author, are there any likely culprits? I tried setting NOBROWNOUT- this cures some other issues and makes me thing the PSU is somewhat borderline, but since an identical (bar code) PIC is happy working reliably, it must be a config setting?

Any ideas welcome!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 08, 2008 5:59 pm     Reply with quote

Add NOLVP and NOXINST.
ceebee
Guest







PostPosted: Tue Jan 08, 2008 6:12 pm     Reply with quote

Nope :( NOLVP makes no odds and NOXINST is not valid on the 18F458 :(

I'll keep hacking, hoping more ideas flow. Cheers for your input!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 08, 2008 7:28 pm     Reply with quote

Quote:
a large valve, which is activated by relays

See these posts about problems with power supply glitches
due to relay wiring.
http://www.ccsinfo.com/forum/viewtopic.php?t=30336
http://www.ccsinfo.com/forum/viewtopic.php?t=30001
http://www.ccsinfo.com/forum/viewtopic.php?t=23634
CeeBee
Guest







PostPosted: Tue Jan 08, 2008 9:14 pm     Reply with quote

It has protection diodes in place and functions normally with the other PIC so I'm 99% sure its not hardware related. I'm going to go back through the code and check the relay activation routines for stupid mistakes! Its 3am here, no useful work gets done at this time so im off to bed! Thanks for the help!
SET



Joined: 15 Nov 2005
Posts: 161
Location: Glasgow, UK

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Jan 09, 2008 12:47 pm     Reply with quote

I would agree, your 'visible' code must be doing something naughty with your load, that is in turn pulling the supply down - and your 'read only' version isnt doing that. Have you compared all the relevant hardware outputs between the 2 versions?
CeeBee
Guest







PostPosted: Wed Jan 09, 2008 1:29 pm     Reply with quote

Yes, I've scoped all outputs and they all fire with the same timings. This is why I find it so odd. What I wonder is whether the "visible" PIC is, for some reason, more sensitive to the droop in the power rail. I would have thought the brownout would have caught this and reset it though? I'm going to start by backing up the 5v rail with a 220uF cap to see if thats the problem. The PSU for the whole unit is fairly low current and if the visible code is being naughty but not illegal, it may be tipping it over the edge. Grrr.
CeeBee
Guest







PostPosted: Wed Jan 09, 2008 4:16 pm     Reply with quote

I think I've found the issue. The relay-switched device is actually a coil tiny. With the original chip (appears to be a C0 revision) the noise produced by the back emf doesnt effect the PIC at all. With the supposedly new chip, a B4 revision, it gets driven nuts as the coil is de-activated. I've had a 10nf tantalum cap across the coil and it seems to behave OK. Just going to try slightly smaller ones as this is nearly the size of the unit itself Smile
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