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

Intermittent working PICs

Discussion in 'Oshonsoft' started by camerart, Mar 21, 2015.

  1. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,398
    Likes:
    11
    Location:
    Dorset UK.
    Hi,

    Has anyone experienced PICs that work unpredictably or intermittently?

    I'm using 18F2431 PICs, programmed in Oshonsoft, and programmed with Pickit2 V2.61.

    These PICs need to have certain pins connected to program them, so have a dedicated programming socket. When there is a problem, I >choose the program>Program PIC>erase PIC>blank check>re-program PIC>verify PIC. (I use this sequence if I suspect programming issues)

    I have a number of PICs, one works 'nearly' every time, and all of the others don't. I've tried 10s of times, changing them, re-programming, all with the same result.

    Does anyone have any ideas what's going one?

    Camerart.
     
    Last edited: Mar 21, 2015
  2. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,816
    Likes:
    121
    Location:
    Buenos Aires - Argentina
    Hola,

    Maybe it is software, not HW. Do they come from salvaging components?

    I would try to see what they have (or not) in common.

    Have you checked if each micro has a specific flaw? Do the failure pattern repeats?

    Had I more of them available I would start afresh with three (really) new ones and see if the failure pattern repeats. If pattern at all.
     
  3. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    What crystal are you using???? It sounds to me like the osc isn't stable enough!!
     
  4. dave

    Dave New Member

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


     
  5. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,398
    Likes:
    11
    Location:
    Dorset UK.

    Hi Atferarri and Ian,

    To clarify, I've tried 4 new PICs 10s of times.

    I'm using the internal oscillator, not XTL.

    Camerart.
     
  6. JimB

    JimB Super Moderator Most Helpful Member

    Joined:
    Sep 11, 2004
    Messages:
    6,390
    Likes:
    592
    Location:
    Peterhead, Scotland
    Do you have some I/O port pins which are floating? ie not connected to anything.
    Are any of those pins configured as inputs?
    Can any of those inputs create an interupt?

    I once had a problem with a 16F84 which would stop working at random times.
    The problem was that I had some unused PORTB pins configured as inputs and left floating, and any pin on PORTB was set to create an interupt.

    The fix was to add some 10k pull-down resistors on the two unused pins.
    A better way is to ensure that all unused port pins are set as outputs and do no have interupts enabled,

    JimB
     
  7. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    Have you some code??? Maybe something silly... You may need to post a schematic..
     
  8. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,233
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    Hi C,
    As you know the 18F2431 has these two extra AVdd and AVss [ +V and 0V respectively] pins, many Prommers do not have these two pins internally connected, also pin #26 PGM has to be at 0V.
    The option we discussed some time ago was to modify our Prommer's, mine is a PICStart+.

    To avoid modifying the Prommer I added the extra links to a 28 turned pin IC socket, I insert the PIC into the socket and then the socket into the prommer, it works every time OK.

    I suspect your problems with the 18F2431 are due to your Prommer.

    Eric
     
  9. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    762
    Likes:
    76
    Location:
    Worcestershire UK
    Excess capacitance on wire to ICSP pins can give problems. keep wire length to minimum , power all PIC Vdd / Vss pins also USBv if it has one. don't forget 0.1uF bypass caps .
     
  10. picbits

    picbits Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    2,007
    Likes:
    95
    Location:
    Northants, United Kingdom
    As granddad said above - make sure you use a minimum of a 0.1uF bypass cap between the power pins as close to them as you can get. Strange things happen when you run PIC microcontrollers without bypass capacitors.
     
  11. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,059
    Likes:
    519
    Location:
    Cleveland, OH, USA
    I had a problem with erratic behavior -- some chips seemed to work while others didn't.

    The biggest problem was in initialization of the hardware EUSART. I did something out of sequence. Sometimes it started fine; sometimes it didn't, and I got gibberish. The second problem was my RAM (both common and general purpose) that had various flag registers. They were not always cleared on programming, or at least they didn't appear to be. I added a routine to clear all ram during processor set-up and everything started working smoothly with all of the chips I had tried, even the ones that didn't seem to work before.

    John
     
  12. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,398
    Likes:
    11
    Location:
    Dorset UK.
    Hi Eric,

    I have a couple of IC sockets, wired as we discussed some time ago for programming. The PICs are programming, as I have added a LED into the 'LOOP' which flashes at start-up, also a TOGGLE LED that works once running, but only on the 'GOOD' PIC.

    As I have one working PIC, I haven't tried programming it again. (I want to keep one working) This PIC verifies ok.

    Camerart.
     
  13. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,398
    Likes:
    11
    Location:
    Dorset UK.
    I have 0.1uF caps also a large one EDIT: 470uF at the Power connections to the PICS. The wires are as short as possible.

    Camerart.
     
    Last edited: Mar 22, 2015
  14. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    762
    Likes:
    76
    Location:
    Worcestershire UK
    Does PIC fail during detecting / programming or verify are you using PicKit2 standalone SW , where is PIC power coming from during burn ?
     
  15. JimB

    JimB Super Moderator Most Helpful Member

    Joined:
    Sep 11, 2004
    Messages:
    6,390
    Likes:
    592
    Location:
    Peterhead, Scotland
    Camerart wrote:
    It is possible that I, and maybe others, have misinterpreted your description of the fault.
    Is the problem:

    A. The PIC burns correctly, but the program will not run reliably every time it is switched on, or runs OK and then does wrong things.

    or

    B. The PIC does not burn correctly sometimes, and so the program never runs at all in those badly burned PICs.

    Please clarify.

    JimB
     
  16. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,398
    Likes:
    11
    Location:
    Dorset UK.
    Hi Grandad,

    I have clarified post #1. The power for the Pickit2 comes from the USB socket.

    Camerart.
     
  17. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    762
    Likes:
    76
    Location:
    Worcestershire UK
    Hi camerart , OK Pickit2 on USB power...and 5 wires connect to PIC18F2431 is that it.... or do you have any external power to PIC in your program socket ?

    Reason , Had problems with PIC24 , would program OK ...but not verify using Programmer power ,(PK3) had to supply external power to PIC. all was well..
     
  18. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,398
    Likes:
    11
    Location:
    Dorset UK.
    Hi Jim,

    There have been programming issues in the past, that sometimes happen when 'say' the wrong PIC is chosen then corrected. Once cleared, any problem goes away for months.

    I'm guessing that the PICs are being programmed ok, but as suggested perhaps and interrupt is being triggered.

    The program was mainly written, by a better programmer than I am, setting all of the necessary registers.

    There are LED flashes in the program to help with diagnosis, the first runs ok, and there is an output to a Terminal screen that also works, then nothing.

    Camerart.
     
  19. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,398
    Likes:
    11
    Location:
    Dorset UK.
    As mentioned in #1 All verifies ok. (And as mentioned starts to run) No external power.
     
  20. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    762
    Likes:
    76
    Location:
    Worcestershire UK
    camerart . change of direction.... so PIC programs and verifies, but has running issues... WDT enabled or disabled ?

    Edit 2 you say " No external power " at all ?

    Edit 1 . I would still only program using external power...
     
    Last edited: Mar 21, 2015
  21. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    762
    Likes:
    76
    Location:
    Worcestershire UK
    PS What does this mean ?

     

Share This Page