Continue to Site

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.

  • 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.

Intermittent working PICs

Status
Not open for further replies.
Hi,

Here is the link to the project, that I have just updated: https://forum.allaboutcircuits.com/threads/gps-nmea-antenna-aiming-tracker.96520/page-29

This morning I remembered that I also had trouble coincidental with the above problem, that might shine a light. While trying to print out the programs for analysis, I switched between Notepad, Wordpad and Libra office writer. I was trying to set (with difficulty) the text size, font and bold, for easier smaller reading. When I tried to open it again in Oshonsoft, it went crazy and wouldn't open properly. I renamed the file as .BAS opened it, but it wouldn't allow me to name the file and saved it as an old name. This took quite a while to sort out. Could this cause a problem?

Camerart.
 

Attachments

  • QEI_PWM1c--18F2431 AZ 18.03.15 100pwm commented.txt
    8.3 KB · Views: 364
Last edited:
Morning camerart ...Can u post a picture of the PIC programmer socket setup or a sketch ? 470uF ? where ? what for ? running issues could be power associated, BOR , WDT power source ....

your link ...Thats a lot of posts to digest... you seem to have been going some time
 
Last edited:
Morning camerart ...Can u post a picture of the PIC programmer socket setup or a sketch ? 470uF ? where ? what for ? running issues could be power associated, BOR , WDT power source ....

your link ...Thats a lot of posts to digest... you seem to have been going some time

470uF see #12.

I wouldn't try to follow the LINK saga, as it has morphed many times, I try to update the latest corrections etc.

The programmer is the normal Pickit2 with a Ziff socket. I would hazard a guess the problem more likely to do with Oshonsoft.

Camerart.
 
Just had a thought!!!!!!
I'm working with a pic16f1825.... Giving me a real heartache... What was the problem I hear you all asking..

MCLRE is OFF and I use it as an input.... Deep analysis I read the PCON ... MCLRE being tripped over and over.. But I have disconnected MCLRE and used internal reset!!!

Ahhh!! The same pin is LVP which is on but default... This pin cannot be low whilst LVP is active...

A lesson learned....
 
You and eric have been busy... the story so far ,,,, the 18F2431 program is burnt to a single PIC and is working , other PIC burns seem ok but fail in circuit , I have no Oshonsoft experience , but many Years programming PIC's ,
You need to monitor pcb voltage it only needs a spike / dip to set BOR , is this enabled ?
 
So what is 470 uF doing ?????????????? is this just on the programmer socket ?
 
Ian... Eureka Sunday... For me too i hope , Suddenly all my code delays have halved since i switched to XC16. v 124 (MPLABX) can't see why yet....
 
Ian... Eureka Sunday... For me too i hope , Suddenly all my code delays have halved since i switched to XC16. v 124 (MPLABX) can't see why yet....
What compiler where you using before that C30 or Hitech?..
 
XC16.121 as far as i recall think its my delay coding for Timer 2 , but getting diverted to household chores at moment !
 
You and eric have been busy... the story so far ,,,, the 18F2431 program is burnt to a single PIC and is working , other PIC burns seem ok but fail in circuit , I have no Oshonsoft experience , but many Years programming PIC's ,
You need to monitor pcb voltage it only needs a spike / dip to set BOR , is this enabled ?

Does this tell you?

EDIT: I just monitored the voltage while PIC is being programmed, it showed slight sign wave 4.5 to 5V.
 

Attachments

  • Config bits.jpg
    Config bits.jpg
    248.2 KB · Views: 335
Last edited:
Sorry but #12 does not answer the question ... there is no way you need 470 uF ( is this correct value ) on the pic power pins and you say no external power , so PK2 is charging this large capacitor during programming ? at the end you could still have power on the PIC as you take it out , or even as you put another pic in ! ( better get pin 1 correct ! ) why is this cap there ? the watch dog timer references to other bits to enable SWDTEN , it will reset hw pic on rollover it has to be cleared by sw. what is state of SWDTEN.
 
Sorry but #12 does not answer the question ... there is no way you need 470 uF ( is this correct value ) on the pic power pins and you say no external power , so PK2 is charging this large capacitor during programming ? at the end you could still have power on the PIC as you take it out , or even as you put another pic in ! ( better get pin 1 correct ! ) why is this cap there ? the watch dog timer references to other bits to enable SWDTEN , it will reset hw pic on rollover it has to be cleared by sw. what is state of SWDTEN.

Morning Granddad,

Apologies! I misunderstood, I thought you were asking about when the PIC is in the circuit, which does have 0.1 and 470uF capacitors close to the PIC power connections. There are no additions to the programmer.

Will you clarify "the watch dog timer references to other bits to enable SWDTEN , it will reset hw pic on rollover it has to be cleared by sw. what is state of SWDTEN" please? What do I need to do?

Here is a photo of my Pickit2 and how the programming socket is wired up.
Pickit2.jpg
18F2431 Socket .jpeg

Camerart.
 
ICSP28.jpg


OBVIOUSLY NOT FOR 3.3V PICs

Hi camerart. OK . the zif is a good idea , as stray connections need to be considered if doing ICSP . however you still need power caps and a pull-up during programming , ( I don't see them on your pic) also I would use external power during programming , as not all USB power is the same as your .5v ac measurement shows. (Is this a laptop USB port ?). WDT may be a wild goose , but worth checking .
Judging from your other project posts you seem pretty capable , I would suggest a course of action... put the zif on a stripboard with all the connections as detailed . add an external 5V supply plus a switch and led indicator .

Think john's post was referring to a routine to clear or initialize registers / data memory at start up (most important ).

Edit. I added a quick circuit of my ICSP setup as used with PK2 and PK3 with my PIC 16 /18 /24 dev bds . above specifically for the 18F2431




power.jpgWDT.jpg
 
Last edited:
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

Yes John!!

NB: reading the silicon errata is as compulsory as RTFM!

Anyway, one of the two best pieces of advice I got in the Microchip forum, many years ago, from one of their most knowledgeable members was to reset all SFR and "clean" (or initialize) the whole RAM.

What motivated my question there, IIRC, was a port that refused to have all bits in a certain setting on startup. BTW, the cleaning or initialization (with a specific value) of the whole RAM also proved to be useful in simulations allowing to see who has changed and when.

I do both routinely since then.

/EDIT
Hola camerart I di not forget you are the OP (or it is TS?) The reply is also intended for you.:happy: My routines do what we John and I say.
EDIT/
 

Attachments

  • 010 INIT SFR.asm
    1.7 KB · Views: 332
  • 012 INIT CLEAN RAM.asm
    673 bytes · Views: 297
  • ROUT CLEAN RAM.asm
    710 bytes · Views: 305
Last edited:
Hi camerart. OK . the zif is a good idea , as stray connections need to be considered if doing ICSP . however you still need power caps and a pull-up during programming , ( I don't see them on your pic) also I would use external power during programming , as not all USB power is the same as your .5v ac measurement shows. (Is this a laptop USB port ?). WDT may be a wild goose , but worth checking .
Judging from your other project posts you seem pretty capable , I would suggest a course of action... put the zif on a stripboard with all the connections as detailed . add an external 5V supply plus a switch and led indicator .

Think john's post was referring to a routine to clear or initialize registers / data memory at start up (most important ).


If ICSP is in circuit programming? I don't do that.

Is the switch for switching power on/off?

I'll leave WDT until all else has failed.

Yes, I'm pretty capable, apart from programming, 89.4% of the programming is courtesy of EricGibbs;)

Camerart.
 
:) Forget I typed ICSP , just serial programming ... , switch is required to power off while inserting / removing PIC .. (dont forget )

Please take note of atferrari post re setup memory.

ED ...Just thought , LVP needs to be set in config bits also .?
 
Yes John!!

NB: reading the silicon errata is as compulsory as RTFM!

Anyway, one of the two best pieces of advice I got in the Microchip forum, many years ago, from one of their most knowledgeable members was to reset all SFR and "clean" (or initialize) the whole RAM.

What motivated my question there, IIRC, was a port that refused to have all bits in a certain setting on startup. BTW, the cleaning or initialization (with a specific value) of the whole RAM also proved to be useful in simulations allowing to see who has changed and when.

I do both routinely since then.

/EDIT
Hola camerart I di not forget you are the OP (or it is TS?) The reply is also intended for you.:happy: My routines do what we John and I say.
EDIT/

Hola John,

My limited programming is in Basic, would you send the .BAS file please?

Your explanation is a bit difficult for me. I don't know what RTFM IIRC or SFR is. Or even TS.

If I suspect a programming problem, I use this routine: In PicKit2: Load program>program>erase>check for blank>re-program>verify. This mostly works, but obviously not always. Is this similar to what you are suggesting?

Camerart.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top