Pic getting part power from Analog Port


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2009
    Location
    Boise, Id
    Posts
    44

    Default Pic getting part power from Analog Port

    I'm using an 18F2550 and have been struggling to keep it running. This is what happens: I program the pic, plug it into the bread board and it runs great. If I shut the pic off with a switch in my circuit, it won't start running again. If I remove the pic from the bread board and plug it back in, with power on it will take of again. I spent more time than I care to admit trouble shooting the external XT settings ( I was looking at the signal using a scope, when I turn the power off and back on the 4 Mhz XT wasn't starting ). Turns out the Pic is getting lost in a brown out.

    The cause: I'm switching power off to Vdd on the pic, PortA.0 still has an analog signal and PortA.1 has a digital signal. With power off, I measure 2-3 volts on the pics Vdd pin. Enough to make an LED glow dim. So when I remove Power from Vdd, the pic enters a brown out, but not enough to reset the default 2 volt BOR config.

    What I did: I set the brown out to hardware control and set the brown out reset at 4 volts. ( which is the min Vdd for the 18F2550 ). Now when I switch power on and off the pic starts and runs fine, most of the time, still seems to be a little glitch now and then.

    My question: I verified that Vdd was getting power from PortA.0 and PortA.1, if I remove these inputs the low voltage on Vdd goes away. I can see my digital signal on Vdd if the analog signal is removed. Am I crazy thinking that this shouldn't have been something I had to fight with? There is a possibility that the pic will have voltage on the analog pin before Vdd when the entire circuit is powered up, I'm concerned that the pic may not start correctly if it get's lost to the "dark side" and enters the brown out lockup I have been working with.

    Is there other settings I should configure? Do other models of Pics have this same issue? I've searched the forum and didn't find anything like this, I may have missed it?

    By the way, thanks for all the other great posts out there, there were enough solutions for other problems that I was able to figure out how to find the settings I needed in the 18F2550.inc and P18F2550.inc files. If I read the 18F2550 manaul any more I may go crazy!

    Thanks from a newbie,
    Shane

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Shane,
    I see this is your first post, Welcome to the forum !
    PICs like to have the power start up crisply. To solve your problem my first thoughts are to enable the power up timer in the config statement, to be honest I have not checked to see if this PIC has that function . . . Ah, yes it does in the config2
    Code:
    _PWRT_ON_2L
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    Hi Shane

    Welcome aboard. The phenomenon you describe is known as back-driving. It is used extensively by in-circuit-testers (ICT) to verify the working of components on a populated board. I would like a look at your schematics. This might help eliminate the back-driving issue.

  4. #4
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    Am I crazy thinking that this shouldn't have been something I had to fight with? There is a possibility that the pic will have voltage on the analog pin before Vdd when the entire circuit is powered up,
    Nope, you're not crazy. This is very typical of MCUs, FPGAs, and in particular ADCs. The inputs are diode protected (from datasheet "I/O pins have diode protection to VDD and VSS"), so if you apply power to the I/Os before applying power to the "core" guess what. You run the chance of reverse biasing the protection diode, and thus biasing the device through the I/Os.

    The best approach would be to not apply power to the I/Os before applying power to the "core" (i.e. make sure there is no possibility "that the PIC will have voltage on the analog pin before Vdd when the entire circuit is powered up"). This is sometimes inevitable, in which case you have to work around it. Buffering the I/Os is always the second best option. As an example, for the digital I/Os of an MCU you can use logic buffers (gates, latches, etc) which get turned on by the MCU after it has been powered-on; this way the I/Os are effectively buffered from the external world (sometimes series resistors could do the trick - but you never know). For analog I/Os you could use OPAMPs (again, which get turned on by the MCU). These are just suggestions, and I'm sure there will be others. But the main thing is that you are not going crazy, and this is something which has been tackled before time and time again.

  5. #5
    Join Date
    Apr 2009
    Location
    Boise, Id
    Posts
    44


    Did you find this post helpful? Yes | No

    Talking

    Thanks for the information, I don't feel like I'm crazy any more, sounds like it's a problem some of you have experienced before. I attached a simple block diagram of the circuit I have. There is more circuit to build, but I need to get this part working and be able to handle low voltage and brown outs and recover without a glitch.

    To sum up what I understand so far: If power is removed from the Pic, but power remains on the I/O pins, the pic will become reverse biased. This puts the Pic into a Brown out stage. The default BOR setting for the pic was 2 volts. Since there was greater than 2 volts still on Vdd, the Brown Out Reset was not "reset". Changing the BOR setting to 4 volts in the include file seems to mostly fix this issue.

    To completely fix the problem, I need to add an additional circuit. The pic will control the circuit so when the Pic is powered down it will shut off the rest of the circuit, removing voltage from the Pics I/O pins. Also, there will not be any voltage on the I/O until the Pic Powered up and turns it on.

    Let me know if I have this correct. I'm using some Opto relays and Opto Isolators in other parts of my circuit. I could add those to the inputs and have the Pic control those to remove voltage from the I/O's. Might be over kill but I have them and would be easy to implement.

    Thanks again for the help
    Shane
    Attached Images Attached Images  

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    To completely fix the problem, I need to add an additional circuit. The pic will control the circuit so when the Pic is powered down it will shut off the rest of the circuit, removing voltage from the Pics I/O pins. Also, there will not be any voltage on the I/O until the Pic Powered up and turns it on.
    yup sounds right to me. Then you just need to choose the best solution for you, there's a load of possibility, from relay, to "digital switches", Mosfets, opamp buffers, and so on.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Aug 2005
    Location
    down south
    Posts
    90


    Did you find this post helpful? Yes | No

    Talking

    I have a set that had about the same problem
    I cheated and changed the power switch out for one that is double throw
    one set of contacts controls the power the other open the circuit going to the
    problem pin
    not the way a pro would have done it but works for me
    chow
    " be nice it's people like me that make people like you look smart"
    yes I read the datasheet, of the 300 pages I understood 10

  8. #8
    timmers's Avatar
    timmers Guest


    Did you find this post helpful? Yes | No

    Default

    Another way is to leave the power on permanently, and with the switch, ground out the MCLR and hold the PIC in reset. This will force the PIC into a sleep mode.

    May not be suitable for your application, but its worth looking at a problem from more than one angle!

    Tim.

Similar Threads

  1. Xtal speed vs PIC power
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th January 2010, 19:55
  2. pic18f analog comparator problem
    By david.silaghi in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th May 2009, 09:38
  3. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  4. PIC powered by capacitor for 0,5 second
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 25th August 2007, 09:23
  5. pic part models for electronic workbench
    By vacpress in forum Off Topic
    Replies: 0
    Last Post: - 17th January 2007, 22:42

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts