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

supply voltage problem

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



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

supply voltage problem
PostPosted: Wed Jan 11, 2017 6:57 am     Reply with quote

Hi! here I am with another strange thing.

I have a board that measures some variables and send it over UART to a TTL device.

My board operates with 12vcc provided by a wall power supply.

The other device, the one that receive the data operates with an internal battery.

Everything works fine... BUT... when i disconnect the wall power supply (my board lost power but the other device don't) wait a few seconds and then reconnect the power supply, then my board doesn't work.

What i think is happening is that the pic get some current over the TTL lines and it doesn't restart and go to a strange state... then.. never get back to earth... Confused

These are my fuses:

Code:
#include <16f1847.h>                 
#fuses HS,PROTECT, PUT, NOMCLR, WDT_SW, BROWNOUT, NOLVP, PLL_SW, NOFCMEN, BORV25, NODEBUG


I was wondering... the Brownout reset should restart the pic in this situation?

Is there a code solution to this? i was thinking on put some 4k7 resistors in series on the TTL lines... but i prefer the soft solution.

thanks! (sorry for my inglish... it is not my first language)
Ttelmah



Joined: 11 Mar 2010
Posts: 19524

View user's profile Send private message

PostPosted: Wed Jan 11, 2017 7:51 am     Reply with quote

One possibility is it is nothing to do with voltages.
What is your UART setup line on the 'slave' device?.
Unless it has 'ERRORS', the UART could be hung by a continuous zero. Once hung, the code will not recover, unless you either do it yourself, or use 'ERRORS' which adds code to do this.
championx



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

PostPosted: Wed Jan 11, 2017 8:01 am     Reply with quote

Hi Ttelmah, thanks for your answer, yes, it have the ERRORS added on the UART line.

I will add a led to check if its a UART hang or a pic hang...

Any other suggestion?

thanks!
Ttelmah



Joined: 11 Mar 2010
Posts: 19524

View user's profile Send private message

PostPosted: Wed Jan 11, 2017 8:19 am     Reply with quote

What pins are you using for the 'TTL' device?.
Do you have any signal protection on the lines?.
If you are unplugging the master, then the slave becomes ungrounded. What does it actually connect to?.
championx



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

PostPosted: Wed Jan 11, 2017 9:24 am     Reply with quote

I'm using the uart pins to connect to the TTL device.

No protection on these lines, just a 1k resistor in series.

Both grounds are the same and always connected.

If I just cut the board positive, wait a few seconds and then reconnect it then the board doesn't work anymore.
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Wed Jan 11, 2017 11:03 am     Reply with quote

Grab a multimeter, cut the main board's power again, and then measure main's Vcc. Measure any digital lines that run back to the main processor, namely the (still connected) UART's TX and RX lines. You might be getting some partial feed through the logic lines and that's causing the processor to go into a weird lockup state. Does the oscillator still run while it's connected like this (can you measure a clock signal)? Are you using the watchdog on main?
championx



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

PostPosted: Wed Jan 11, 2017 12:52 pm     Reply with quote

Hi newguy, thanks for your help, i will make these measurements and post back.

I'm using the watchdog timer too.
temtronic



Joined: 01 Jul 2010
Posts: 9230
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Jan 11, 2017 2:05 pm     Reply with quote

comment.

Get rid of the watchdog timer ! There is zero need for it during testing, up until the product is ready to be shipped to clients. THEN and only then, enable and test for 1-2 weeks.
While it _might_ not be causing a problem, trouble shooting is a process of 'eliminations'. You have to get rid of 99% of the code to SEE the 1% that might be the cause.

While it sounds like backfeed of power might be the issue, I'd like to know how you've connected the 2 devices as you say ground is always connected.

Jay
championx



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

PostPosted: Wed Jan 11, 2017 2:26 pm     Reply with quote

Thanks temtronic, yes, the ground between the device and my board is always connected. And the ground from the power supply to the board is always connected too. The only wire that is disconnected is the positive coming from the power supply.
Ttelmah



Joined: 11 Mar 2010
Posts: 19524

View user's profile Send private message

PostPosted: Thu Jan 12, 2017 2:00 am     Reply with quote

What actual _pins_. Point is this affects what can be affected. Some pins on the PIC do not have the protection others have. I'd never rely on the internal protection diodes for something going 'off board'. It is possible if you are getting a nasty spike, for the FET's to actually become latched. If that happens, a soft reset won't restart the chip (had to be hardware).
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Thu Jan 12, 2017 5:47 am     Reply with quote

Quote:
My board operates with 12vcc provided by a wall power supply

Can be very noisy.
How the supply from there? What are your power supply components on the board? How you are filtering spikes?

Best wishes
Joe
Ttelmah



Joined: 11 Mar 2010
Posts: 19524

View user's profile Send private message

PostPosted: Thu Jan 12, 2017 8:04 am     Reply with quote

Also, another very important thing is how the grounds actually _route_. One (almost classic) would be that when the 'main' supply goes off the ground potential moves relative to the ground of the second system. There used to be a quite famous telescope sold commercially, which if you connected it to a computer would give problems when the computer switched off. The reason was that though it had a ground, there was in some cases a small potential difference between this and the computer. This connected through the serial port (a few years ago now...), and the spike on switch on/off could actually damage the input transistors...
The solution was to opto-isolate the signals, so that the grounds were not actually connected. Really there should only ever be one actual ground connection if the systems are permanently linked. Two grounds is a formula for an earth (or ground) loop (look it up...).
jeremiah



Joined: 20 Jul 2010
Posts: 1351

View user's profile Send private message

PostPosted: Thu Jan 12, 2017 8:13 am     Reply with quote

temtronic wrote:

While it sounds like backfeed of power might be the issue,


I agree, this would be my first guess based on the description and without seeing the schematic. Are there any buffers between the two boards so that when the one powers down it isn't powering off of the battery powered one through the UART lines? It can be enough to hold the PIC in a weird non brownout state, so the PIC stops working correctly. I've seen this before troubleshooting other designs (and we made the mistake on one of our early designs).

We usually have some buffer chips powered by our own board so that when board power goes, the UART lines from the other board are no longer able to get through to our board.

Heck, a few months ago, I had an IC leach power through a Chip Select line on me. I had disconnected the VCC input via a FET, but since the CS line was still high, the chip remained in a zombie state and would no longer work after the first turn off. Luckily we could change the power down procedure in software, but backfed power can bite you.
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