Skip to main content
Topic: Strange ICSP PIC programming problem (Read 4664 times) previous topic - next topic

Strange ICSP PIC programming problem


I'm back to my PIC experiments...
I'm trying to bring up my PIC board after doing some other stuff for the last few weeks.
The board is a partially-populated "RGB color changer" and has a PIC 18F2553, a 8MHz xtal + 2x33pf caps (not sure it's the right value), two 0.1uF caps for VUSB, connectors for ICSP, USB and serial. MCLR is pulled high by a diode and a resistor, as in all DP's PIC circuits.
I hook it though a BP v3a with the PIC programming adapter. PGC,PGD, GND and MCLR are connected. V+ on the PIC programming adapter is disconnected.
When I hook up the board's VDD to 3.3V, I can successfully read the PIC using piratePICprog. When VDD is 5V, my 18F2553 is not recognized??!!

This is very consistent - the board is fed with VCC from a bench lab power supply. At 3.3V, reading is fine. at approx 4.5V, the device starts acting flaky, and is no longer recognized.

Any ideas?

Re: Strange ICSP PIC programming problem

Reply #1
Maybe the 18F2553 needs 3.7volts at 5v supply for a 1 state? The Bus Pirate output is 3.3volts only. I thought all pic programming pins were Schmidt triggers with 2/.8 thresholds, but I have checked them all.
Got a question? Please ask in the forum for the fastest answers.

Re: Strange ICSP PIC programming problem

Reply #2
What happens if I set the jumper on the PIC programming adapter to 5V?
(In practice, I already tried setting this jumper to 5V, but it didn't help).

As far as I could understand from the schematics, this sets the target's VDD (The V+ pin on the adapter's ICSP) minus the forward voltage on D2, as well as driving it on pin 6 towards the BP. On the BP I see this is used for driving the pullups on pins 1-4, which drive all the PIC adapter's relevant pins (PGC,PGD). Wouldn't this be enough to drive those signals high enough? How are these signals driven from the BP? Are they open collector or normal outputs?

[some time later]OK, I dug through my piratePICprog sources, and came back with some new speculations:

according to this line:
buspirate.c:128      if (BP_WriteToPirate(fd, "x4F")){
The pullups themselves are already enabled (bit 2).

However, it seems that the output pins are set to 3.3V mode and not HiZ.
buspirate.c:115       if (BP_WriteToPirate(fd, "x88")){
This makes the pullups irrelevant, since the output pins will be pulled to the output voltage that are much stronger than the pullup's 10K resistance.

According to ... 3Dnot_used , this should have been 0x80 to enable HiZ mode.

It seems that changing line 115 to 0x80, and setting the HVP adapter's jumper to 5V should fix the problem.
I'll try this later tonight.



Re: Strange ICSP PIC programming problem

Reply #3
Thank you for the investigation. Please keep us updated.
Got a question? Please ask in the forum for the fastest answers.

Re: Strange ICSP PIC programming problem

Reply #4
This device should suit your needs and it comes with a Python software framework, which would not be available for the Bus Pirate.