go away spammer

Author Topic: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?  (Read 5435 times)

0 Members and 1 Guest are viewing this topic.

Offline cosminprundTopic starter

  • Robot Overlord
  • ****
  • Posts: 284
  • Helpful? 8
Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« on: December 15, 2008, 05:54:35 AM »
I've got an really bad habit of putting MCU's the wrong way around into the socket. And then connecting the power supply in the wrong direction. I've played a little bit with an PIC16F654 (a 14 pin part - maybe I've got the part number wrong). I've managed to make a few boards with this uC, managed to control an servo, made an nice servo controller that featured an POT to turn the servo (I wanted to play with ADC). So I moved on to an smarter/bigger part, the PIC16F874 (again, I don't have the part number on hand, it's an 40 pin 16F part). Because I had a really hard time soldering wires to a perforated board I made my own PCB. When it was all done I placed the uC in the socket the wrong way around! Because of the way the pins are numbered, if you put it in the socket the wrong way around you get the VDD/VSS pins in the revers position, linking VDD to ground and VSS to +V volts. Of course, I only noticed this after connecting the ICSP pins and trying to program the part (subjecting the part to +11 volts on yet an other wrong pin). After noticing the error I moved rotated the part in the socket and now I can program it: The programmer programmes it and then tests it and says it's allright, but the part does nothing! Is my 40 pin PIC16F burned? How can I test that?

Unfortunately I didn't have an other similar part so I moved on to an PIC18F 40 pin part. This time I made the circuit onto a solderless breadboard. I wanted to make the circuit step-by-step so I can better debug it. That of course made no difference, I've managed to connect power to the wrong pin AND in the wrong direction (I counted from the wrong direction AND inverted the wires). This has been an really bad weekend :(

Both those parts can be programmed and verified. They can be erased. Programming works fine but they do *nothing* - ie, the program simply doesn't run. Is it possible that part of the core is burnt, making it impossible to run, but the programming part still works? Is there a low-cost way to test? I don't want to buy yet an other "development board" because I know I'll grow out of it really-really fast. I've only made 1 program on my PICKit1! I've tried googling allot, looking for possible ways to test this, but I'm only finding ways to test the software, not the hardware. I guess that's what usually goes wrong...

Any ideas?

Thanks,
Cosmin Prund

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
    • izua electronics
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #1 on: December 15, 2008, 06:11:38 AM »
reset is probably floating.
PICs are pretty sturdy, I've ran 12V @ 40MHZ on a 18F4550 and it worked fine (with some cooling, though).
« Last Edit: December 15, 2008, 06:12:18 AM by izua »
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline Half Shell

  • Robot Overlord
  • ****
  • Posts: 225
  • Helpful? 0
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #2 on: December 15, 2008, 09:27:03 AM »
I'll second that - PICs do burn sometimes, but not often. If you can verify the chip then it's still good - it is most likely a software issue.

paulstreats

  • Guest
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #3 on: December 17, 2008, 01:14:49 PM »
are you using an external crystal or resonator? and if not has the internal oscillator been configured properly. also do you have the watchdog timer switched on?

Offline cosminprundTopic starter

  • Robot Overlord
  • ****
  • Posts: 284
  • Helpful? 8
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #4 on: December 18, 2008, 03:15:16 AM »
Here's some more detail. I tried to make the simplest circuit that's supposed to work. My MCU is connected to nothing but the power supply and the ICSP connector. I'm using an multimeter to see if the pins that I want "high" are in fact becoming high. I'm setting the configuration with the menu setting in the top menu bar (MPLAB) (ie: not in the assembler file) - I'm doing that to reduce the probability for error.

"Schema.jpg" shows my circuit on the breadboard. I tried overlaying text to explain what's what. The wire from "+9V" looks like it's going all the way to the "+5V" rail - it's not, it's stopping at the 7805 voltage regulator. I've tested all the voltages with an multimeter and they're allright. (not that may voltages to test since the circuit is so simple: I've got 5.02 V betwen VSS and VDD at the MCU pins).

"Config.png" shows what I've selected for my configuration bits. I've tried with "Power on timer" on and off, it made no difference.

Here's the code I'm testing with:
Code: [Select]
LIST P=PIC16F871
#include "p16f871.inc"

org 0x00
nop
goto start
start
bsf STATUS, RP0
bcf STATUS, RP1
clrf TRISD
clrf TRISC
bcf STATUS, RP0
rep
movlw B'11111111'
movwf PORTD
clrf PORTC
goto rep

END

I've tested the code with the MPLAB simulator. I started the simulator and stepped throw the code. I've got the "special registers window" visible and watched what happens. TRISD and TRISC become 0x00 as expected and then PORTD becomes 0xFF (again, as expected). My PIC knowledge tels me the software is OK and I should have +5V betwen GND and the PORTD pins on the MCU. I don't, I have zero volts.

P.S: Is it possible to make an image show in line with the post without uploading it onto an external web server?

paulstreats

  • Guest
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #5 on: December 19, 2008, 11:48:06 AM »
One more thing....

 When you are programming the mcu, do you isolate the mclr pin from the rest of the circuit (apart from the icsp header of course). During programming, the mclr pin is pulled up to around 13v by the programmer so you need to make sure that this isnt connected to the rest of the circuit during programming or your entire 5v bus gets pulled up to 13v. (I know from experience that this is a sure fire way of killing your pic)

Offline cosminprundTopic starter

  • Robot Overlord
  • ****
  • Posts: 284
  • Helpful? 8
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #6 on: December 19, 2008, 01:09:00 PM »
The MCLR pin is connected to the rest of the +5V rail with a 10k resistor. Are you sure the pin needs to be isolated from the rest of the circuit while programming? Now that you mentioned it I double-checked the schematic in the "Using MPLAB ICD 2" leaflet and it clearly shows an resistor from the MCLR pin to target VDD.

The way I understood how MCLR reset works, MCLR needs to be pooled high so the device can function (if it's low it's in an Reset state). Since the ICD2 uses the ICSP connector for debugging, it needs to have the part in working order. The device can't work with MCLR disconnected (unless it's one of those parts that can be configured to have an internal poolup on MCLR - and in that case it would be the same thing, wouldn't it?). If the device doesn't work it can't be debugged. Then again I might be wrong, I have allmost no experience with microcontrollers.

If the MCLR pin really needs to be disconnected from VDD while debugging and if that can cause the part to fry then yeh, I've got two dead PIC's. The trouble is I don't have any more 40 pin PIC's and the 14 pin PIC I used so far (PIC16F684) is working just fine with a similar circuit. I guess I'll have to order an other 40 pin PIC to test. Shipping will be just as expensive as the part itself and I might not get it any time soon because of the Holiday season. I've got some PIC24F's but I'm afraid to touch them before I get this sorted out, I don't want to fry them.

Thanks,
Cosmin Prund

paulstreats

  • Guest
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #7 on: December 19, 2008, 02:05:38 PM »
have you signed up to the microchip samples programme? You can get 3 PIC's free every month as free samples (including free shipping).
Just make sure that you credit them in anything that you publish on the net, in competitions or otherwise.

paulstreats

  • Guest
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #8 on: December 19, 2008, 02:18:11 PM »
The mclr pin definately needs isolating from the circuit during programming. As i said earlier that pin gets raised to around 13volts by the programmer. If its not isolated, that voltage also raises the normal power to 13 volts which is bad news :(

 Most development boards etc.. will use the 10k pull up resistor in conjunction with a diode. The diode will allow the 5v to pass during normal use but will also block the 13volts from backing up into the rest of the circuit.

http://www.instructables.com/id/EPMBPXODWWES175W85/ this link might help to understand.

(the only time i have ever killed a pic is by accidentally not isolating mclr during programming).

Offline cosminprundTopic starter

  • Robot Overlord
  • ****
  • Posts: 284
  • Helpful? 8
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #9 on: December 20, 2008, 01:15:12 AM »
The "instructables" page links to this Microchip document:
http://ww1.microchip.com/downloads/en/AppNotes/91016b.pdf

In THIS Microchip document it clearly says the MCLR pin needs to be isolated from the rest of the circuit and it shows a nice schematic using a diode (as you suggested). Maybe I should ask for those free samples, after all I've probably killed the PIC because of Microchip's inconsistent documentation! I've got the printed leaflet from the ICD2 showing NO diode on MCLR and I've got this other PDF from the Microchip site clearly saying the MCLR needs to be isolated.

Oh well, moving to the PIC24F parts. Those are lower power and 16 bit with a very nice instruction set. The only catch is that they're 3V - not 5V!

Just one questions remains:

Why did the same circuit with the PIC16F684 work just fine? I've done ICSP on it many-many times without any problems and it has the same setup: Resistor from MCLR to VDD and no diode.

paulstreats

  • Guest
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #10 on: December 20, 2008, 06:06:53 PM »
There are a few other inconsistencies in the actual devices too...

One that i have noticed is that sometimes the vcc voltage provided by my programmer is fine for programming and on an exact same device, i will have to connect an external power source for it to program successfully.

(If you add anything else onto your circuit you will always need an external power source while programming).

I never bothered with the 24F series myself. They just seem to be neither 1 thing or the other. (meaning not a low end device and not a high end device but seeming to have all of the worst things from both). I do have a couple of 24F's sitting around but never used them.

Quote
Just one questions remains:

Why did the same circuit with the PIC16F684 work just fine? I've done ICSP on it many-many times without any problems and it has the same setup: Resistor from MCLR to VDD and no diode.

maybe the 16f684 is a bit more resilient? - i dont know really...

Also do you have a facility to read the hex file back off the microcontroller? if so you can easily verify that it is the same code that you wrote in the first place. (if this is true then it is unlikely the microcontroller is broken)

Offline cosminprundTopic starter

  • Robot Overlord
  • ****
  • Posts: 284
  • Helpful? 8
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #11 on: December 21, 2008, 02:13:53 AM »
I'm using ICD2 to program from the MPLAB IDE. I don't have a hex file and I don't have a way to verify what's been written (If MPLAB has a way of reading the device using ICD2 then I haven't found it - but I did search for it).

After programming MPLAB allways says it verifies the result. It also has a "verify" option and I assume it works against the last written hex file. I've programmed the device and MPLAB said it's OK. I've verified the device and it said it's OK. I've erased the device and then verified the device and MPLAB said it's no longer OK (so I assume it's doing something).

About the 24F's: I've ordered those PIC's because I found the 8bit PIC's too limiting. The 24F was the only part with an PDIP package, all the other 16bit parts being SMT. I haven't looked at dsPIC or 32 bit PIC's. Since I didn't find them in Romania I ordered them from MicrochipDirect - and since international shipping always has a fixed price component I ordered 10 x PIC24F's to make the shipping-price per unit more acceptable. Now I'm stuck with them so I'll put them to some use!

P.S: The 16MIPS / 32MHz PIC24F is waaaay more powerfull then the first desktop PC I've used. Amazing how technology evolves.

paulstreats

  • Guest
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #12 on: December 21, 2008, 12:01:18 PM »

Problem solved ----
The PIC16F874 does not have an internal oscillator, and probably nor does the pic18f's that you tried.

The RC in the oscillator types refer to a crude external oscillator that you can use by hooking up a resistor and a capacitor as in this link: http://www.romanblack.com/pic2clk.htmfigure 6.4 and resulting text

Using this oscillator will make it difficult to do any real timing work such as reliably moving servo's. You really want a crystal or a ceramic oscillator.

The oscillator is what makes the PIC tick without one it will not be able to perform any commands because without the tick/tock it doesnt when its supposed to perform the next one.

The original pic that you used more than likely had an internal oscillator that you used (probably 8mhz). This feature isnt available on all of them. You either need to start using crystals or ceramics or make sure that any future devices you get contain an internal oscillator

Offline cosminprundTopic starter

  • Robot Overlord
  • ****
  • Posts: 284
  • Helpful? 8
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #13 on: December 22, 2008, 02:26:23 AM »
Grate detective work, thanks! I've just read the datasheet for both my 16F871 and my 18F458 and they do not include an internal RC oscillator network! I missed this because I thought it would work just as the smaller part I played with. Besides there are some references to "internal RC oscillators" but those are very specific oscillators: The A/D RC oscillator network and the Timer0 RC oscillator network. Oh well, I'm one step upper on the learning curve!

I'll set up the circuit (again) when I get home from work, I really want to see those circuits going. Happily I did not throw them away :). Yestarday I did manage to start the PIC24F part, because that part has an internal RC resonator. I avoided the external resonator because I wanted the simplest possible circuit with the least points of failure - now I know better.

paulstreats

  • Guest
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #14 on: December 22, 2008, 01:00:17 PM »
Try not to rely on the r/c oscillators, they are unreliable timing wise, even just a small room temperature change can alter the oscillation rate.

Offline cosminprundTopic starter

  • Robot Overlord
  • ****
  • Posts: 284
  • Helpful? 8
Re: Did I burn my 40 pin PIC18F? How about my 40 pin PIC16F?
« Reply #15 on: December 22, 2008, 01:35:37 PM »
Thanks again paulstreats, I want to confirm: the oscillator was the only problem! I've just rebuilt my circuit on the breadboard, stuck in an 8Mhz oscillator and two 15pF capacitors, programmed and voila, I'm single stepping through my code using MPLAB and the ICD2 clone! I can't beleive I wasted so much time for such a simple problem. Anyway, I did learn to read the datasheet more carefully and I did learn the trick to isolating the MCLR pin with a diode.

About the internal RC oscillator: I'm not relying on it. I simply wnated to start the device using the simplest possible setup with the minimum ammount of external components. I was hoping to start the MCU with just it's internal oscillator and then switch to the external oscillator.

Thanks again,
Cosmin Prund

 


Get Your Ad Here