CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

18f4550 tqfp dedicated icsp pins connection problems
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
doguhanpala



Joined: 05 Oct 2016
Posts: 120

View user's profile Send private message

18f4550 tqfp dedicated icsp pins connection problems
PostPosted: Fri Apr 28, 2017 7:45 am     Reply with quote

hello

I have 18f4550 tqfp. I want to program it with icsp. 18f4550 is on a completed pcb and the icsp headers are connected to dedicated pins.

I made the connections, but Pickit 2 can't find the pic. I looked at the datasheet and it says this.

Quote:

25.9.1 DEDICATED ICD/ICSP PORT

The 44-pin TQFP devices can use NC pins to provide an alternate port for In-Circuit Debugging (ICD) and In-Circuit Serial Programming (ICSP). These pins are collectively known as the dedicated ICSP/ICD port, since they are not shared with any other function of the device.

When implemented, the dedicated port activates three NC pins to provide an alternate device Reset, data and clock ports. None of these ports overlap with standard I/O pins, making the I/O pins available to the user’s application.

The dedicated ICSP/ICD port is enabled by setting the ICPRT Configuration bit. The port functions the same way as the legacy ICSP/ICD port on RB6/RB7. Table 25-5 identifies the functionally equivalent pins for ICSP and ICD purposes.

Even when the dedicated port is enabled, the ICSP functions remain available through the legacy port. When VIHH is seen on the MCLR/VPP/RE3 pin, the state of the ICRST/ICVPP pin is ignored.


Note 1:
The ICPRT Configuration bit can only be programmed through the default ICSP port (MCLR/RB6/RB7).


Aas i understand, i should enable ICPRT configuration bit via rb7 and rb6. The problem is when i try rb7 and rb6 as icsp pins, the Pickit 2 still can't find the pic, and even if I manage to do that i don't know how to enable it.

Did anyone encounter the problem before?

Thank you very much.

Best wishes

Doğuhan
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Apr 28, 2017 8:43 am     Reply with quote

Obvious question..
Does your version of Pickit2 KNOW about the 18F4550. IF the 4550 was made AFTER the PK2, the PK2 firmware will need to be 'upgraded'.

I use the PK3 and it knows the 4550.

Jay
doguhanpala



Joined: 05 Oct 2016
Posts: 120

View user's profile Send private message

PostPosted: Fri Apr 28, 2017 8:46 am     Reply with quote

temtronic wrote:
Obvious question..
Does your version of Pickit2 KNOW about the 18F4550. IF the 4550 was made AFTER the PK2, the PK2 firmware will need to be 'upgraded'.

I use the PK3 and it knows the 4550.

Jay


hello Jay

I enabled manual device select. 18f4550 is on the list, but the Pickit 2 gives the warning "Parts are in this family are not auto-detect".
doguhanpala



Joined: 05 Oct 2016
Posts: 120

View user's profile Send private message

PostPosted: Sat Apr 29, 2017 1:32 am     Reply with quote

I tried troubleshooting.

At the first section, it says an external voltage detected on Vdd even though i give the Vdd and Gnd from pickit itself. I don't know what is wrong and i skipped that part.
After testing vpp i always get different values. Sometimes it passes the test and gives 12V, other times (%90 mostly) it says low Vpp.

I checked the pgc and pgd with oscilloscope and checked high, low and 30 kHz. The frequency changed to 22, 26 and 28 khz each second. I checked the frequency with 18f2550 and got the same values, so i thought there is nothing wrong with the frequency.

I thought it was a problem with Pickit 2 but i tried the troubleshoot with 18f2550. It passed all the test.

Any ideas about low Vpp voltage?

Note: I tried giving voltage from an external source the low Vpp result is still same.
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Sat Apr 29, 2017 2:11 am     Reply with quote

What circuit have you got on the MCLR pin?.
There is a standard problem, that the programmer can only deliver a very low current to this pin, yet has to pull it up to Vpp. Many standard circuits generate too much load on this pin. This is why you will see some of the recommended circuits having a jumper to disconnect the normal connections for programming...
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Sat Apr 29, 2017 7:04 am     Reply with quote

To add to what Ttelmah has said, programmers are also quite picky about the load on the PGD and PGC pins as well. I've had to incorporate jumpers on those pins as well.
doguhanpala



Joined: 05 Oct 2016
Posts: 120

View user's profile Send private message

PostPosted: Tue May 02, 2017 6:03 am     Reply with quote

Ttelmah wrote:
What circuit have you got on the MCLR pin?.
There is a standard problem, that the programmer can only deliver a very low current to this pin, yet has to pull it up to Vpp. Many standard circuits generate too much load on this pin. This is why you will see some of the recommended circuits having a jumper to disconnect the normal connections for programming...


Hello Ttelmah

Thank you for your answer and sorry for late reply. i have one 4.7k resitor to 5v from mclr and one 4.7uf 25V capacitor to gnd from mclr. i am suspecting from the capacitor. i bpught a new 18f4550 and try to program it with my own circuit. maybe i can find the problem trying that.
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Tue May 02, 2017 7:00 am     Reply with quote

Yes. The capacitor will stop ICSP from working properly. The Vpp pin has to go up to about 12v to actually do the programming. 4K7 is also a bit 'pushing' the drive capability of most programmers as well. The normal recommendation is to have the resistor/capacitor circuit, and then have a resistor from the junction of this, to the MCLR pin. In normal use the rise time is basically unaffected by this extra resistor (since the input impedance of the MCLR pin is high), but when the programmer pulls the line high this allows a much faster rise time, and lower current requirement from the programmer.
doguhanpala



Joined: 05 Oct 2016
Posts: 120

View user's profile Send private message

PostPosted: Tue May 02, 2017 9:52 am     Reply with quote

Ttelmah wrote:
Yes. The capacitor will stop ICSP from working properly. The Vpp pin has to go up to about 12v to actually do the programming. 4K7 is also a bit 'pushing' the drive capability of most programmers as well. The normal recommendation is to have the resistor/capacitor circuit, and then have a resistor from the junction of this, to the MCLR pin. In normal use the rise time is basically unaffected by this extra resistor (since the input impedance of the MCLR pin is high), but when the programmer pulls the line high this allows a much faster rise time, and lower current requirement from the programmer.


You were right Ttelmah. the problem was capacitor. I removed it and the problem is solved. But my other problem remains. I can not program the pic with dedicated icsp port. I tried to enable ICPRT register. I chose the manual device select and edited the register. After that i tried with pickit .dat file editor but no luck. Any ideas?

Note: The dedicated ports do not have any load on them.
doguhanpala



Joined: 05 Oct 2016
Posts: 120

View user's profile Send private message

PostPosted: Tue May 02, 2017 10:01 am     Reply with quote

newguy wrote:
To add to what Ttelmah has said, programmers are also quite picky about the load on the PGD and PGC pins as well. I've had to incorporate jumpers on those pins as well.


Thank you for your answer newguy! I checked the load with multimeter and oscilloscope. there was none.
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue May 02, 2017 10:15 am     Reply with quote

Maybe an obvious question but can you program another PIC type, say a 16F84 ?

If you can, then your PK2 is working, suggesting the 4550 PIC and/or connections to it are faulty.


Also while you can't program it, can you erase it and confirm it is blank?


Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Tue May 02, 2017 12:11 pm     Reply with quote

The port selection, is not a register. It's a fuse.

Just add ICSP2 to the fuses for your PIC. This selects the second location.
Once set using the primary ICSP pins, this allows further writes to use the secondary pins.
Beware that all your code must have this selected. Though you can't set it using the secondary port, you can clear it using this port, so once selected, the code you write in must always have it set.
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Wed May 03, 2017 12:48 am     Reply with quote

OK. Lets step back.

You are currently trying to program the chip using the default pins?.

How are you powering the circuit?.
If using the PK2 to supply power, is it going to be able to supply everything needed on the board?. Generally the programmer can only supply a few tens of mA, and if there is any significant circuitry, you need instead to have the board powering itself, and the programmer setup to not supply power.

Have you increased the pullup resistor on MCLR?. 4K7, is lower than is recommended for the PK2.

How long is your cable?.

Also the ICRST pin has to be pulled high if you enable the secondary ICSP port. This is just like the MCLR pin for normal programming.
doguhanpala



Joined: 05 Oct 2016
Posts: 120

View user's profile Send private message

PostPosted: Wed May 03, 2017 2:03 am     Reply with quote

Hello Ttelmah

Ttelmah wrote:

You are currently trying to program the chip using the default pins?



Yes. I am using legacy ports to program my pic. Since i removed capacitor i had no problems. It worked fine.


Ttelmah wrote:

How are you powering the circuit?.
If using the PK2 to supply power, is it going to be able to supply everything needed on the board?. Generally the programmer can only supply a few tens of mA, and if there is any significant circuitry, you need instead to have the board powering itself, and the programmer setup to not supply power.


I tried both pickit and voltage suplly. The board needs 40 ma max. I am going with supply for now just to be sure.


Ttelmah wrote:

Have you increased the pullup resistor on MCLR?. 4K7, is lower than is recommended for the PK2.


No i didn't. I will try that know. the datasheet says

"To take advantage of the POR circuitry, tie the MCLR pin
through a resistor (1 kΩ to 10 kΩ) to VDD. "

is 10k enough? or am i looking the wrong place?

Ttelmah wrote:

How long is your cable?


The cables are approximately 12 cm long.

Ttelmah wrote:

Also the ICRST pin has to be pulled high if you enable the secondary ICSP port. This is just like the MCLR pin for normal programming.


THAT is a problem. I looked at schematics, and there is nothing connected to that pin. i saw this on datasheet on section 25.9.1

Even when the dedicated port is enabled, the ICSP functions remain available through the legacy port.
When VIHH is seen on the MCLR/VPP/RE3 pin, the state of the ICRST/ICVPP pin is ignored.

If i want to program through dedicated ports, i should use ICRST pins? I thought i could use MCLR on both ICSP ports but i think i misunderstood.

Note:
temtronic wrote:

Maybe an obvious question but can you program another PIC type, say a 16F84 ?

If you can, then your PK2 is working, suggesting the 4550 PIC and/or connections to it are faulty.


Also while you can't program it, can you erase it and confirm it is blank?


Jay



Thank you for answer Jay. My problem is, i cant program using dedicated ports. I managed to program it through legacy ports
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Wed May 03, 2017 4:11 am     Reply with quote

The recommendation in the PicKit2 manual uses 10KR.

Once you program the ICSP2 fuse, the secondary port should work. There was mention in the MicroChip site of problems once this is done, unless the ICRST pin is also pulled gently high (10KR again). Problem is that during boot, the MCLR pin is not at Vihh, and so the level on ICRST can sometimes matter....
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group