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.

Very weird 18F HSPLL problem

Status
Not open for further replies.

picbits

Well-Known Member
Well todays objectives were to get a bootloader running on one of the 18F4431 Microcontrollers I sampled from Microchip.

While waiting for them to arrive, I'd already adapted the AN851 bootloader code to run on the processor. I'd be running the processor at 40Mhz on the target board and as it was going to be well tucked away, the option of using a bootloader to get the firmware on it would make life a whole lot simpler.

I duly bunged the 18F into my trusty old Picstart Plus and burned the code. All went well (apart from the usual errors in 8.10 running under Win2k but thats another story).

I plugged the 18F into my prototyping board - its an old Millenium board but handy for testing stuff on as its got a MAX232 and 5V supplies. Hooked up both VDD and VSS pins, a 10Mhz resonator and fired up the AN851 software.

Nothing. Diddly squat. Dead as a dodo.

Checked all connections, found I had the Resonator one row of pins down - excellent. Rewired it. Still nothing.

Hooked up the small speaker onboard to the TX pin of the PIC to see if it was talking - still nothing. Every now and again at random though it would click. I then adapted the code to pulse a pin out as a tell tale - still random pin pulses.

Checked all the config bits - nothing wrong that I could see. Guessing it might not like my 10Mhz resonator, I jerry rigged a 10Mhz Crystal with a couple of 22pf caps and chucked that into the breadboard. Same result.

Changed the config bits to use the onboard 8Mhz internal clock - worked fine. AN851 connected and I could read/write to the PIC but it was only going at 8Mhz.

Hmmmm...........

Changed the config bits for HS and put it back on the breadboard with a 10Mhz resonator. Worked fine.

Changed config bits to HSPLL - nothing - random resets and no communications.

Thinking it might be the usual stray capacitance problem with breadboards, I soldered a 10Mhz resonator onto a spare 40 pin socket along with the VSS and VDD wires and a 100nF decoupling capacitor. Plugged the processor in and off it went but at 1/4 speed. Changed the config bits to HSPLL and it worked fine.

Checked all connections on the breadboard again - all exactly as the wired socket so I assumed it was a capacitance / clock problem. Bent the pins up out of the ZIF socket for the clock and soldered the resonator directly onto them. Turned it on - still bugger all.

Tried a different Microprocessor - still the same problem.

Then in a flash of inspiration, I plugged in a 100nF decoupling capacitor onto the breadboard between the two power pins - instant action. The processor started clicking away as it should do.

Burned the bootloader software again and tried again on the breadboard - instant success.

So let my mistakes help others when they Google their problem and find this thread - make sure you have at least one decoupling capacitor close to the processor when you are trying to run any 18F in HSPLL mode.

My power leads from the prototype board to the Processor are only 4". I ran seperate leads from each VSS and VDD to the power pins which have a 100nF capacitor there for decoupling anyway but obvously this 4" of cable has enough inductance/capacitance/resistance to thoroughly bugger up HSPLL operation of the processor on the board.

All the stuff I build ends up with a decoupling capacitor as close to the processor anyway - it was just trying to use it on the breadboard without a cap that caused the problem.

Hey ho - that was today almost wasted. Tomorrow will be spent playing with 4 channel PWM to try and get my CNC microstepping ..........
 
Been there, done that, got a T-shirt (grin).

Seriously, even a little 16F88 running on 8 MHz INTOSC does funny things in my solderless breadboard without a bypass cap' directly connected to the VDD and VSS pins on the PIC.

Glad you found the problem. And btw, you're welcome to look at my 18F4431 bootloader if you like. It uses Hyperterminal as the PC "front end".

Mike
 
And btw, you're welcome to look at my 18F4431 bootloader if you like. It uses Hyperterminal as the PC "front end".

Mike

Thanks for the offer - I've actually got a generic bootloader I wrote a while ago with encryption for some of the products I'll be sending out - don't want the customers to have access to some of the code (or at least make it a bit harder to work it out).

I only used AN851 on this as its fairly easy to get MPLAB to talk to it directly - it supports it on its list of programmers so its a compile and click solution for inhouse use.

Only problem now is that the standalone AN851 software works fine at 19200 baud or 38400 baud but MPLAB AN851 won't talk to it - I assume it uses either 9600 baud or 115200 baud.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top