PDA

View Full Version : I'm at a loss



ERMEGM
- 10th November 2013, 04:06
Hello,

OK, can't seem to figure this one out. I have a PIC16F628A that I have written code for. I try to program it and I get this, "Target Device does not match selected device". Now, the funny part is this...I have the microcontroller device ID entered correctly, as well as the ICSP pins connected correctly.

When I've made a mistake in the past on other chips and clicked program, the above message occurred immediately. What's happening now is the status bar runs about 3 times and then I get the message. It looks like it's going to program, but then it fails. Any thoughts? It's not my programmer because it'll program other chips, but as soon as I try to program the 628A, it fails after 3 status bar sweeps. Thoughts?

Archangel
- 10th November 2013, 04:42
Please post your code & a picture of MCS if you can. I will assume you have selected the appropriate PIC in MCS, yes?
Are you using MCS Plus? Does it support ICD for that chip?

rsocor01
- 10th November 2013, 05:23
Hmm, you usually get that message immediately not after three sweeps. Is that message showing when the programmer is doing the verification? Try to use programming only without verification. Are you using the diode in the Vpp chip pin?

Jerson
- 10th November 2013, 11:51
If you are programming in system, try doing it with the target power turned on. Maybe the PICKIT is unable to support the current drain. I've seen similar, but only when powered by the PICKIT-II or III. If you're programming the chip stand-alone, I don't know. Maybe a short video showing the problem will help diagnosis.

elproducts
- 10th November 2013, 12:15
Sounds like you have some capacitance on one of the programming lines delaying a signal.

Acetronics2
- 10th November 2013, 12:27
Hello,

OK, can't seem to figure this one out. I have a PIC16F628A that I have written code for. I try to program it and I get this, "Target Device does not match selected device". Now, the funny part is this...I have the microcontroller device ID entered correctly, as well as the ICSP pins connected correctly.

When I've made a mistake in the past on other chips and clicked program, the above message occurred immediately. What's happening now is the status bar runs about 3 times and then I get the message. It looks like it's going to program, but then it fails. Any thoughts? It's not my programmer because it'll program other chips, but as soon as I try to program the 628A, it fails after 3 status bar sweeps. Thoughts?

I always get such a message when I forget to enable power to the target with my PK2 or 3 ...

moreover, the Pickit current capacity is limited ... sooo, couldn't your board draw too much current ??? ( as you talk about ICSP ...)

and in the end, I remember a Microchip errata sheet about this subject for some series of those programmers ...

Alain

AvionicsMaster1
- 11th November 2013, 02:43
I'm not familiar with the Pickit but I have gotten a similar message when I haven't properly isolated the programming pins. I usually put a switch in the circuit to disconnect the rest of the circuit. If you look in the manual it recommends some minimum values when connecting your circuit.

ERMEGM
- 11th November 2013, 07:29
Thanks for the replies guys, but I am not using a Pickit. I have setup my boards to match the pin layout of my U2 programmer. I just use a wire harness from the U2 to my boards. It's quick and easy that way.

What I meant about the sweeps is the status bar indicator. It usually fills about 3 times and then it would fail.

I don't know what the problem was, but I placed another 628A on another board and tried programming it. That worked. I removed the first PIC on the first board and replaced it with the second PIC. Tried to program the second PIC on the first board and it failed immediately, however, I found a very tiny solder joint between 2 pins and I removed it. Now it works fine.

Don't know if something was wrong with the first PIC or if there was a tiny solder joint, but I'll have to play with that PIC later. Don't know why it would run through it's sequence and then fail.

I'd post some code, but it's over 1000 lines. But with respect to errors in the code, the PIC would still be programmed with the faulty code and fail on run, not programming.

And yes, the correct PIC was listed in both programs.

Thanks again guys.

Tony

Demon
- 12th November 2013, 03:07
I figure it can erase and program just fine with the solder jumper, but then fails on the verify. Most likely why you see the status bar fill a few times then fail.

Robert
AKA Captain Obvious

Art
- 12th November 2013, 03:37
More likely it screws up the erase, and the programming as well, but doesn't know that until it tries to verify.

ERMEGM
- 19th November 2013, 17:44
OK, back to square one. Here's what I have. Obviously there is some interference with the signals.

My programming pins are connected to the appropriate terminals. RA5, RB6 and RB7 are being used, but they are being used as inputs, so they have a 10k pull-up resistor on them which gets pulled to ground when the tactile button is pressed (RA5), or the optocoupler is activated on the other pins (RB6 and 7).

When I try programming my pic on the completed board, it fails. When I program it on the board with just the PIC and header pins, it programs just fine. Is one of the components causing the interference? Anyway to isolate this or just redesign the board to not use those pins other than for programming?

Thanks,
Tony

towlerg
- 19th November 2013, 19:02
I don't know if its a typo but the 10k resistors on RB6 and RB7 are in series to isolate external circuitry. See 32028a, 91016b, 51474a etc.

George

ERMEGM
- 20th November 2013, 01:21
The 10k resistor is part of the pull up resistor of the optocoupler.It's a 5 volt supply through the 10k and then to rb 6. Same setup for rb7. Rb 6 and 7 are driven high, then pulled low when triggered. Standard setup.

Should I apply power to the circuit when programming it, maybe?

towlerg
- 20th November 2013, 03:07
circuit diagram?

rsocor01
- 20th November 2013, 04:27
The 10k resistor is part of the pull up resistor of the optocoupler.It's a 5 volt supply through the 10k and then to rb 6. Same setup for rb7. Rb 6 and 7 are driven high, then pulled low when triggered. Standard setup.

Should I apply power to the circuit when programming it, maybe?

Why don't you use the internal pull-ups in your chip? The following is from the melabs webpage

http://melabs.com/support/icsp.htm

From the website

1. If possible, dedicate the Programming Clock and Data pins to ICSP. If you must also use these pins for other purposes on your board, some thought should be given to the type of hardware that is connected. The best case is to use the programming pins for normally-open, pushbutton inputs. As long as you don't push the buttons while programming, the switches won't affect things at all.

If loads are connected to the clock and data lines, they must not interact with the clock and data signals. Capacitive loads will cause problems. High-impedance loads are usually ok. LEDs with current-limiting resistors are less desirable, but usually don't cause problems.

You should always prototype and test the ICSP connections before sending your PCB design out for fabrication.

AvionicsMaster1
- 20th November 2013, 05:42
Well, I'm certain that the chip has to have power supplied during program and I'm certain you're going to have to pull the MCLR pin high or disable it for the chip to work.

Since there really isn't a standard installation all bets are off as to what those pull ups will do. The pins have to change state to transfer data and the pull ups may prevent that from happening. I've taken to putting a switch to disconnect the rest of the circuit if I must use the ICSP pins for other purposes. An easy way to find out would be to unsolder the resistors and attempt programming. That would be the one way you'll know if that's the issue.

Jerson
- 20th November 2013, 10:13
Some boards isolate the 2 programming pins via jumpers while performing ICSP.