View previous topic :: View next topic |
Author |
Message |
Aycan
Joined: 02 Apr 2004 Posts: 13 Location: TURKEY
|
icsp pin programing error in pic24fj128gb204 |
Posted: Wed Jun 27, 2018 7:01 am |
|
|
ccs c ver 5.075
mplab-x ver 4.05
Code: |
#include <24FJ128GB204.h>
#device ICSP=1
#use delay(internal=4MHz)
#FUSES FRC
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOJTAG //JTAG disabled
void main(void) {
while(TRUE){
}
}
|
I try to program pic24fj128gb204 with pickit3.
When i select icsp3 pins programing is ok.
When i select icsp1 pins getting error.
Error message page is as follows on mplab-x.
*****************************************************
Connecting to MPLAB PICkit 3...
Currently loaded firmware on PICkit 3
Firmware Suite Version.....01.51.06
Firmware type..............dsPIC33F/24F/24H
Target voltage detected
Target device PIC24FJ128GB204 found.
Device ID Revision = 4
Device Erased...
Programming...
The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x3ff
configuration memory
Failed to program device
*****************************************************
Thanks for your help. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jun 27, 2018 11:31 am |
|
|
Aycan wrote: | #include <24FJ128GB204.h>
#device ICSP=1 |
Try using this syntax instead:
Quote: | #include <24FJ128GB204.h>
#device ICD=1 |
The CCS manual says:
Quote: |
#device ICD=n
For chips with multiple ICSP ports, specify the port number
being used. The default is 1. |
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Wed Jun 27, 2018 6:16 pm |
|
|
While I don't use that PIC, I found it interesting that while PK3 found the device and erased it it couldn't program it. I'd have thought the hardware was OK (pin #s) as 2 out of 3 operation were sucessful.
Something else then got me thinking, as ICSP and ICD are 2 different concepts. ICSP (In Circuit Serial Programming) is just a way to 'stuff code into a PIC' whereas ICD (In Circuit Debugging) is a complicated 'master' program to allow the programmer a 'line by line' view of a PIC program running.
Then I wonder about the 'chicken and egg' problem where you want the PIC to use an optional set of pins for ICD/ICSP yet you need to program the PIC to tell which pins but the hardware is on the optional pins. All this hopefully is explained in the PIC datasheet. Maybe I'm getting too old for PICs...
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Thu Jun 28, 2018 12:30 am |
|
|
Any of the ICSP pairs can actually enter the programming mode. For programming _all_ the sets are permanently active. It is the manipulation of the MCLR line needed that prevents accidental entry to programming mode. Once the chip is in programming mode, for debugging, the debug executive program is loaded into the chip, and it is this that then only uses one pair of the pins to load the rest of the code, and for debugging.
So wrong pair of pins selected, the chip will still accept the initial executive programming and reply to this. However when the debug executive takes over, it'll then fail.
If he is just programming the device, there is no need to select the pin pair involved. If it is failing with a second pair, then look at the wiring (length of connections, capacitance etc..). The ICSP connections can be fussy on the faster PIC's in particular. On a couple of PIC24's I have to use cables that are half the length of the normally supplied ones for ICSP to work.... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Thu Jun 28, 2018 4:29 am |
|
|
Thanks for the explainatin Mr T. !
Things were a lot simpler when PICs had windows on them. |
|
|
Aycan
Joined: 02 Apr 2004 Posts: 13 Location: TURKEY
|
|
Posted: Fri Jun 29, 2018 8:21 am |
|
|
Hi everybody.
While i trying to fix problem in yesterday night, i realized pickit3 programmed when i connect oscilloscope probe to mclr pin for observe waveform.
Then i connect two of 0.1uF and 0.01uF additional capacitor to 3.3V power trace. Finally it worked. Thanks all of you for giving a time.
Have a nice days. |
|
|
|