View previous topic :: View next topic |
Author |
Message |
championx
Joined: 28 Feb 2006 Posts: 151
|
supply voltage problem |
Posted: Wed Jan 11, 2017 6:57 am |
|
|
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...
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: 19477
|
|
Posted: Wed Jan 11, 2017 7:51 am |
|
|
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
|
|
Posted: Wed Jan 11, 2017 8:01 am |
|
|
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: 19477
|
|
Posted: Wed Jan 11, 2017 8:19 am |
|
|
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
|
|
Posted: Wed Jan 11, 2017 9:24 am |
|
|
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: 1907
|
|
Posted: Wed Jan 11, 2017 11:03 am |
|
|
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
|
|
Posted: Wed Jan 11, 2017 12:52 pm |
|
|
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: 9215 Location: Greensville,Ontario
|
|
Posted: Wed Jan 11, 2017 2:05 pm |
|
|
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
|
|
Posted: Wed Jan 11, 2017 2:26 pm |
|
|
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: 19477
|
|
Posted: Thu Jan 12, 2017 2:00 am |
|
|
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
|
|
Posted: Thu Jan 12, 2017 5:47 am |
|
|
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: 19477
|
|
Posted: Thu Jan 12, 2017 8:04 am |
|
|
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: 1342
|
|
Posted: Thu Jan 12, 2017 8:13 am |
|
|
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. |
|
|
|