1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

[SOLVED]Help with PIC soldered circuit sometimes work sometimes doesnt

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by KansaiRobot, Jun 10, 2015.

  1. KansaiRobot

    KansaiRobot Member

    Joined:
    Jan 14, 2010
    Messages:
    210
    Likes:
    2
    Location:
    Kyoto Japan
    Hello
    I would really appreciate if you can tell me please any idea you get by the following situation. (I really need help :( )

    I have soldered a socket to a perfboard, and put a 18F2550 in it. I have also soldered a circuit in it in which I use pin RB0~RB4. I also soldered RB6,7 to connect to the programmer. I have soldered other necessary components.

    The program I wrote basically gives 1s or 0s to pins B0 to B4. nothing else.

    I have successfully program the PIC.

    Then when I power the PIC sometimes it works, sometimes it doesn't. If it works it keeps working good until turn off (there is no instability)

    When it doesnt, a small push in the side of the PIC makes it work. Investigating more, when it does not work a touch with a metal to the PIN B5 makes it work. if it is working it makes it not work again!!!

    Now I suspect about the soldering. however here is the strange and bewildering fact:

    I used a oscilloscope to test the PINs directly.(Not the soldered connections) Pin Vdd is receiving 5V successfully. However Pins B0 to B4 are not outputing anything!
    If I touch B5 they start.
    So It is not the soldering or the connections!!!

    What is happening here? Any idea? really any idea?
    I have run out of possible solutions!:banghead:
     
    Last edited: Jun 11, 2015
  2. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,885
    Likes:
    500
    Location:
    Cleveland, OH, USA
    ONLINE
    Intermittent problems are extremely difficult to troubleshoot and solve regardless of what field of endeavor you are in. You have given very little concrete information from which to work. You may want to post your program, your schematic, and pictures of your soldered board.

    That said, last year I chased such a problem with a 16F1519 for months. Some of the symptoms were the same. I could re-program, and it wouldn't work. If I touched the pins or even let it sit overnight, it would work. Eventually, I found two problems and addressed them. I am not sure which of those problems was the real culprit. One problem was in the initialization of the EUSART module. I had not followed exactly the MC sequence and initialized the baud rate first. The second problem was initialization of RAM, i.e., General Purpose and Common (both were used). I added a small program to clear both in reset. The pin problems you mention may indicate a similar problem or a problem in initialization of your ports. Note that on reset, many of the registers are unknown or unchanged (Table 4-4). Do you have proper pull-up or pull-down resistors in your circuit?

    upload_2015-6-11_2-11-37.png

    John
     
  3. Diver300

    Diver300 Well-Known Member

    Joined:
    Oct 19, 2007
    Messages:
    3,062
    Likes:
    101
    Location:
    England
    You should program all the unused pins to be outputs or to have pull-ups. The change in behaviour when you touch an unused pin makes me think it is floating.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. KansaiRobot

    KansaiRobot Member

    Joined:
    Jan 14, 2010
    Messages:
    210
    Likes:
    2
    Location:
    Kyoto Japan

    Thank you very much for you reply.
    Here are pictures of the soldered PIC. I am a beginner and I have monkey hands :facepalm: so please forgive the uglyness

    DSC_0233.JPG DSC_0231.JPG DSC_0232.JPG

    In the first pic the pin that causes problems is the third lowest to the left (next to the red cable). Right now it is connected to nothing

    its TRIS is 0 so now it is configured as output.


    ------------------------

    I found this thread in microchip forum

    http://www.microchip.com/forums/m250127.aspx

    Apparently sometimes B5 causes a reset! that is what is happening to me!
    Should I disable LVP explicitly?
     
    Last edited: Jun 11, 2015
  6. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,141
    Likes:
    907
    Location:
    Rochdale UK
    Always... Unless you are using LVP.... This causes loads of heartache..
     
  7. dr pepper

    dr pepper Well-Known Member

    Joined:
    Oct 6, 2008
    Messages:
    4,641
    Likes:
    245
    Location:
    North west UK
    Have you configured the oscillator correctly, are the I/o pins configured correct, also have you enabled mclr, I've had a similar thing when I thought I'd disabled mclr and I hadn't, the pin was still mclr and it was picking up noise and randomly resetting the chip.
     
  8. KansaiRobot

    KansaiRobot Member

    Joined:
    Jan 14, 2010
    Messages:
    210
    Likes:
    2
    Location:
    Kyoto Japan
    the oscillator being used is the internal one. The I/O is configured to output (TRIS=0). I noticed that in the datasheet B0~B4 says "data output not affected by analog input" but B5 just says "data output". Does this mean anything?
    About MCLR right now it is pull up meaning connected to 5V with a resistor.

    Pin B5 is not connected to anything and it seems this pin can cause resets when LVP is not deactivated. I dont know if that is the reason but i will test it today

    EDIT: I implement the circuit on a breadboard and the same thing happens! So it is not a matter of bad soldering!

    When I connect a LED resistor to B5 it does not work (I expected that) but at least the problem of this thread does not happen. So this reseting thing is caused by B5.
    Next I ll try disabling LVP

    EDIT2 I did and the problem went away!
    turns out leaving Rb5 as LVP makes all kinds of strange things happen:nailbiting:

    thanks for all the help!!
     
    Last edited: Jun 11, 2015
    • Like Like x 1
  9. dr pepper

    dr pepper Well-Known Member

    Joined:
    Oct 6, 2008
    Messages:
    4,641
    Likes:
    245
    Location:
    North west UK
    Excellent you got there, now your more experienced.
     

Share This Page