Solving an intermittent 18F2431 PIC problem

Discussion in 'Embedded Systems and Microcontrollers' started by camerart, Nov 8, 2015.

  1. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi,

    An intermittent PIC problem has returned:(

    3x 18F2431 Programmed using Pickit2 and 3, with added voltage supply. I've read two different PICs using MPLAB and compare the HEX files, the same.

    They were programmed using an adapted socket which GNDs PIN 28 (PGM).

    PIC1: Works most times, and once started works fine. I noticed that the PIC is not on the adapted socket, so all free pins are floating. There is a LED toggle to show that the PIC has initialised. If the PIC doesn't initialise, I can touch pin 28 (Or the circuit reset button) and it initialises. If I put the PIC on the adapted socket it doesn't work. If I don't use a socket it works. If I set up all free PORTB PINs to 0 (including PIN28) it doesn't work.

    PIC2 and 3: Don't work under any conditions. They work otherwise.

    I checked the circuit board for tracking between the PINS/TRACKS ok, and a motor for continuity of tracks, where I could.

    Any ides of the likely problem welcome please.

    Camerart.
     
    Last edited: Nov 9, 2015
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,606
    Got a schematic?

    Got a definition of "works"?

    How did you program MCLR? If it is set to be clear (and not I/O) do you have a pull up resistor on it?
     
  3. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,015
    It didn't happen without a schematic.

    All unused pins are floating. Does this include MCLR? If so there's one of your problems.
     
  4. nigelwright7557

    Senior Member

    May 10, 2008
    487
    71
    Sounds like you don't have a pull up resistor on reset pin. A 10K will be fine.
    You can also program PIC to ignore reset pin.
     
  5. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Do you have LVP (Low Voltage Programming) disabled in CONFIG? If not, are you pulling up the PGM pin?
     
  6. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi M,

    Please see post #1 regarding programming adaptor socket.

    C.
     
  7. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi,

    See post #565 on thread: http://forum.allaboutcircuits.com/threads/gps-nmea-antenna-aiming-tracker.96520/page-29 for all technical information.

    QEI_PWM1c--18F2431 AZ LVP 8MHz INT 110415 is the program.

    See program DEFINE CONFIG4L, I think it is programmed for LVP. I normally use PICKIT2 with no extra power supply.

    EDIT: There is a 10K pull up on RESET/MCLR PIN, but I'm not sure how it is programmed.

    I hope I've answered all of the questions.

    NOTE1: For testing the 18F2431 PICs, I inject the required data (e,g, A123E123) into PIN18 RX, from a computer terminal, and read the resulting data from PIN17 TX into a second terminal. The output of the 18F2431 PICs got to an H-Bridge, and motors move, also I can see on an oscilloscope, when it is working.

    NOTE2: When it is not working and the reset button is pressed and the initialising LED flashes, it still does not work.

    C.
     
    Last edited: Nov 9, 2015
  8. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi C,
    Why is LVP Enabled.???
    E
    Code (Text):
    1.  
    2. Define CONFIG1L = 0x00
    3. Define CONFIG1H = 0x08  '8MHz INT
    4. Define CONFIG2L = 0x0c
    5. Define CONFIG2H = 0x20
    6. Define CONFIG3L = 0x04
    7. Define CONFIG3H = 0x80
    8. 'Define CONFIG4L = 0x80  'LVP= 0 = Set for HVP
    9. Define CONFIG4L = 0x84  'LVP= 1 = Set for LVP
    10. Define CONFIG4H = 0x00
    11. Define CONFIG5L = 0x0f
    12. Define CONFIG5H = 0xc0
    13. Define CONFIG6L = 0x0f
    14. Define CONFIG6H = 0xe0
    15. Define CONFIG7L = 0x0f
    16. Define CONFIG7H = 0x40
    17.  
    Also /MCLR is being used as agreed, with a PU resistor.
    Ref image from Oshonsoft.
     
  9. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi Eric,

    It must have been a choice between two past programs.

    Is LVP 3.3v and HVP 5V ? If so I can see that it should be HVP.

    Thanks, C.
     
  10. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
  11. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Last edited: Nov 9, 2015
  12. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    It is simple programming. You simply have to know and nail down each and every possible configuration choice. It is the ONLY way to go.
     
  13. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi PB,

    What I meant by simple programming was that I used to use a simple programmer (Velleman) but perhaps all this was applicable then, and I got away with it.

    C.
     
  14. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,015
    There is another problem. Get yourself a pick it iii. And we are still waiting on the schematic.
     
  15. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,015
    Found it on that other thread. You sure make things difficult for others to help. Is mclr floating? It is not immediately apparent as to how it is wired.
     
  16. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi S,

    sorry for the confusion.

    The MCLR is pulled up by a 10K resistor.

    C.
     
  17. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,015
    Do you have a bypass capacitor? How is the circuit wired? Is it a PCB or is it a perf board? If prefboard have you checked all of your connections? If PCB have you checked all of your solder joints? Any cold solder joints?
     
  18. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi S,

    All of your questions are answered already in the thread, especially if you look again at the link in post #7.

    C.
     
  19. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi,

    Can someone double check for me please, is the MCLR pin set correctly in the program?

    C.
     
  20. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,015
    I am not seeing any of those questions answered in this thread. Again, why are you making it so difficult for others to help you. Even if you need to answer the same questions twicw even three times, it is all of us taking our time to try and help you. Not the other way around.
     
Loading...