• AVR Freaks

Hot!Which PGCx/PGDx pin pair for ICSP programming?

Author
MTSPIKE
Starting Member
  • Total Posts : 39
  • Reward points : 0
  • Joined: 2017/05/10 05:46:22
  • Location: 0
  • Status: offline
2019/07/01 09:43:01 (permalink)
0

Which PGCx/PGDx pin pair for ICSP programming?

Can anyone tell me if, and where, any data sheet provides a description of which PGCx/PGDx pin pair to use for ICSP programming when using PIC24FJ128GA010?
 
I have successfully used the Explorer 16 board for some time, which has PGC2/PGD2 connected to the ICD programmer (e.g., ICD3 or ICD4).  The pin pair PGC1/PGD1 is not used.  The Explorer 16 board was designed by Microchip personnel.  
 
The PIC24FJ128GA010 data sheet (DS39747F) states in section 5.0 "Flash Program Memory" states the following:
 
ICSP allows a PIC24FJ128GA010 family device to be
serially programmed while in the end application circuit.
This is simply done with two lines for Programming
Clock and Programming Data (which are named PGCx
and PGDx, respectively), and three other lines for
power (VDD), ground (VSS) and Master Clear (MCLR).
This allows customers to manufacture boards with
unprogrammed devices and then program the microcontroller
just before shipping the product.
 
I can find no discussion of which PGCx/PGDx pair to use, or if there is a default pair.  How would a typical customer know which pair of pins to use?
 
MTSPIKE
 
 
#1

14 Replies Related Threads

    mbrowning
    Just a Member
    • Total Posts : 1469
    • Reward points : 0
    • Joined: 2005/03/16 14:32:56
    • Location: Melbourne, FL
    • Status: offline
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/07/01 09:50:52 (permalink)
    5 (4)
    Any of the pairs works for programming. Debugging only works with the pair specified in config bits.

    Oh well - there's always next year
    #2
    NorthGuy
    Super Member
    • Total Posts : 5548
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: online
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/07/01 10:04:18 (permalink)
    0
    The different pairs are there so that you could find the one which is more convenient for you, based on what pins and peripherals are used in your design.
     
    #3
    MTSPIKE
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2017/05/10 05:46:22
    • Location: 0
    • Status: offline
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/07/01 10:04:35 (permalink)
    0
    mbrowning,
     
    Thank you. 
     
    Is that described anywhere in any data sheet?  I'm confused on how that would work at the hardware level.  For programming only, no debugging used, if I were to redirect the clock and data lined from an ICD3 or ICD4 from PGC2/PGD2 over to PGC1/PGD1 would it still program?  If so, is that described anywhere?
     
    MTSPIKE
    #4
    MTSPIKE
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2017/05/10 05:46:22
    • Location: 0
    • Status: offline
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/07/01 10:11:51 (permalink)
    0
    NorthGuy,
     
    Thank you.
     
    That makes perfect sense that different PGCx/PGDx pairs can be used for different applications, however it seems that which pin pairs are used would be specified somewhere.  I gather from a post a bit earlier that Configuration Word bits determine which pin pair is used for Debugging, but for programming any pair can be used.  
     
    #5
    mbrowning
    Just a Member
    • Total Posts : 1469
    • Reward points : 0
    • Joined: 2005/03/16 14:32:56
    • Location: Melbourne, FL
    • Status: offline
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/07/01 10:44:56 (permalink)
    0
    It’s in the family reference manual. I think section 33.

    Oh well - there's always next year
    #6
    NorthGuy
    Super Member
    • Total Posts : 5548
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: online
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/07/01 10:59:25 (permalink)
    0
    Mike L French
    ... but for programming any pair can be used.  



    This is because you build a new board, you should be able to program it before you have an opportunity to set any config bit. Moreover, even if there were config bits which specify programming pins, it would be very dangerous, because if you would be able to lock yourself out of the chip by select a wrong pair.
     
    There was one PIC - PIC18F4550 in 44-pin TQFP package which had two different pairs of programming pins, and one of them could be enabled/disabled through the config bits. This produced extraordinary mess.
     
    #7
    MTSPIKE
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2017/05/10 05:46:22
    • Location: 0
    • Status: offline
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/07/01 11:13:04 (permalink)
    0
    mbrowning,
     
    Thank you.  Based on your suggestion I obtained Section 33: Programming and Diagnostics.  In 33.2.1 it states:
     
    All PGCx and PGDx pins are functionally tied together and behave identically, and any one pair can be used for successful device programming. The only limitation is that both pins from the same pair must be used.
     
    In that the pins are "functionally tied together & behave identically", I gather that one could indeed for example reroute the Clock and Data from PGC2/PGD2 over to PGC1/PGD1 and one would be able to program the PIC24.
     
    Thanks again,
     
    MTSPIE
     
     
    #8
    MTSPIKE
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2017/05/10 05:46:22
    • Location: 0
    • Status: offline
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/07/01 11:15:29 (permalink)
    0
    NorthGuy,
     
    Thank you.  That helps me understand why they would "functionally tie together" the PGCx pins and the PGDx pins.
     
    MTSPIKE
     
    #9
    ric
    Super Member
    • Total Posts : 23259
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/07/01 13:25:10 (permalink)
    0
    Yes, you can use any pair.
    The one "gotcha" to watch out for is that ALL the PGDx pins will toggle during the program cycle when data is being read from the PIC.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #10
    sky14
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2015/01/16 14:38:43
    • Location: spb.ru
    • Status: offline
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/08/08 04:43:57 (permalink)
    0
    As I guess, any of all these pins may be used as general purpose in/out like PIC16? Or there are some restrictions?
    #11
    ric
    Super Member
    • Total Posts : 23259
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/08/08 05:34:19 (permalink)
    0
    Whatever it says for each pin in the datasheet.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #12
    oliverb
    Super Member
    • Total Posts : 204
    • Reward points : 0
    • Joined: 2009/02/16 13:12:38
    • Location: 0
    • Status: offline
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/08/08 07:17:01 (permalink)
    0
    NorthGuy
     
    There was one PIC - PIC18F4550 in 44-pin TQFP package which had two different pairs of programming pins, and one of them could be enabled/disabled through the config bits. This produced extraordinary mess.


    I always thought the concept was good, having a small microcontroller with four "no-connect" pins goes against the grain and if the "extra" pins could be used for the debug interface then a 44 pin device in an adaptor could be used as a debug target without having to share pins.
    #13
    NKurzman
    A Guy on the Net
    • Total Posts : 17623
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/08/08 07:24:40 (permalink)
    0
    They are not no connect. They are be careful what you connect. Things like undriven inputs and LEDs are fine.
    #14
    NorthGuy
    Super Member
    • Total Posts : 5548
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: online
    Re: Which PGCx/PGDx pin pair for ICSP programming? 2019/08/08 08:49:33 (permalink)
    0
    oliverb
    NorthGuy
    There was one PIC - PIC18F4550 in 44-pin TQFP package which had two different pairs of programming pins, and one of them could be enabled/disabled through the config bits. This produced extraordinary mess.

    I always thought the concept was good, having a small microcontroller with four "no-connect" pins goes against the grain and if the "extra" pins could be used for the debug interface then a 44 pin device in an adaptor could be used as a debug target without having to share pins.



    It would be very handy if these 4 extra pins were the only ICSP pins and the regular ICSP were freed up from the ICSP burden. But this is not the case. It's the same die as the DIP package. In the DIP package these pins are not routed out and invisible to outside, but you still can activate them with ICPRT=1 thus disabling debugging on the main pins.
     
    #15
    Jump to:
    © 2019 APG vNext Commercial Version 4.5