• AVR Freaks

Hot!PIC18F45K40 44-PIN TQFP ICSP

Author
nyholku
Senior Member
  • Total Posts : 124
  • Reward points : 0
  • Joined: 2008/04/30 05:13:58
  • Location: 0
  • Status: offline
2020/10/29 11:16:13 (permalink)
0

PIC18F45K40 44-PIN TQFP ICSP

Hi, I've been through the datasheet umpteen times and I would like to get a confirmation that I've understood things correctly.
 
Background: I have a design based on 40 PIN device but now I'm moving to 44-PIN TQFP and SMD componens and I would like to get at least the this part [ICSP/MCLR] of the first prototype correct so that I can program the device because SMD assembly is not that cheap.
 
If I got it correctly I can simply use the 'new' ICPGC/ICPGD/ICVPP(12,13,33) pins instead of the 'old' PGC,PGD,MCLR (16,17,18) because out of the box the  ICPRT = 1?

Further it can only be altered through the 'older' ICSP pins. How does that work when it defaults to the 'new' pins? Does that imply high voltage programming?
 
Do the new pins require anything special from the programmer or can I just use my PicKIT2 to do that?
 
Does the 'old' MCLR require pull up if I program MCLRE=0? Is it clear from factory?

I'm not asking anyone to vet my design (below) but if someone sees any glaring problems why not help a fellow out ;) 



post edited by nyholku - 2020/10/29 11:17:39

Attached Image(s)

#1

7 Replies Related Threads

    Mysil
    Super Member
    • Total Posts : 3946
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: online
    Re: PIC18F45K40 44-PIN TQFP ICSP 2020/10/29 15:03:33 (permalink)
    +1 (1)
    Hi,
    Are you really looking on datasheet for PIC18F45K40,
    or some other device?
    Looking at datasheet revision C,   DS40001816C-page 6  there is no mention of this feature on pin 12, 13 or 33.
     
    PIC18F45K50  with USB is a different device from PIC18F45K40.
     
        Mysil
    #2
    NorthGuy
    Super Member
    • Total Posts : 6404
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: online
    Re: PIC18F45K40 44-PIN TQFP ICSP 2020/10/29 18:45:53 (permalink)
    +1 (1)
    I tested the functionality of these pins and here's how they work:
     
    https://www.northernsoftware.com/dev/pic18f/pic18f45k50.htm
     
    Scroll down to "Alternative ICSP pins in TQFP-44 package".
     
    Note that this is different from PIC18F4550
    #3
    nyholku
    Senior Member
    • Total Posts : 124
    • Reward points : 0
    • Joined: 2008/04/30 05:13:58
    • Location: 0
    • Status: offline
    Re: PIC18F45K40 44-PIN TQFP ICSP 2020/10/30 05:08:50 (permalink)
    0
    @Mysil Yes, sorry about the typo, I'm working with PIC18F45K50
     
    @NorthGuy Thanks that was helpful and addressed many of my concern but there are still couple things not 100% clear.
     
    I'm going to use "Alternative ICSP pins" and I have no desire to use the other ICSP pins. 
     
    But I'm curious how can they [original/old ICSP pins] be used?
     
    The data sheet says "The dedicated ICSP/ICD port is enabled by setting the ICPRT Configuration bit. This bit is set by default on 44-pin TQFP devices and can only be set and cleared when using the MCLR/ RB6/RB7 ICSP interface."

    So originally ICPRT=1 and to clear I have to use the "MCLR/ RB6/RB7 ICSP"  pins but they are disabled when CPRT=1? Catch 22? 
     
    In an other part of the data sheet it says about "First and foremost, the ICRST pin functions as an additional MCLR pin and must be pulled high to keep the part out of Reset."

    Ok, but what about the original MCLR? Does this need to be pulled high when ICPRT=1 or do I need to program MCLRE = 0 ?
     
    Further in that same paragraph it says "Second, while the MCLR/RB6/RB7 pins can still be used to program the part, the dedicated ICPORT pins must be used to debug the part." Does this imply that MCLR/RB6/RB7 is available at the same time as the alternative pins or is that just referece to the debugging? I'm asking cause the paragraph would seem to apply to the situation when ICPRT=1 cause the paragraph starts with "
    When ICPRT is set, several things must be taken into consideration." 

    I'm not sure I need to know all this if it "just works" out of the box using the "alternative/new pins" but I'm curious and would like to understand this thoroughly.
     
     
    #4
    NorthGuy
    Super Member
    • Total Posts : 6404
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: online
    Re: PIC18F45K40 44-PIN TQFP ICSP 2020/10/30 06:21:58 (permalink)
    +1 (1)
    nyholku
    So originally ICPRT=1 and to clear I have to use the "MCLR/ RB6/RB7 ICSP"  pins but they are disabled when CPRT=1?

     
    No, they're not disabled. Look at my table. LVP is always available. HVP is always available on regular pins.
     
    nyholku
    Does this imply that MCLR/RB6/RB7 is available at the same time as the alternative pins or is that just referece to the debugging?



    Debugging is only available on one of the pairs, depending on ICPRT. See my table.
     
    Part of the documentation you read was copied from 4550, which is completely different. Don't pay attention to it.
    #5
    nyholku
    Senior Member
    • Total Posts : 124
    • Reward points : 0
    • Joined: 2008/04/30 05:13:58
    • Location: 0
    • Status: offline
    Re: PIC18F45K40 44-PIN TQFP ICSP 2020/10/31 07:53:23 (permalink)
    0
    Thanks. 
     
    Out of curiosity HOW are the two pins available at the same time?
     
    When I look at the ICSP clocking sequence I do not fully understand how the this works, how does the chip 'know' which interface to 'listen' to etc?
    #6
    NorthGuy
    Super Member
    • Total Posts : 6404
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: online
    Re: PIC18F45K40 44-PIN TQFP ICSP 2020/10/31 10:04:56 (permalink)
    0
    nyholku
    Out of curiosity HOW are the two pins available at the same time?
     
    When I look at the ICSP clocking sequence I do not fully understand how the this works, how does the chip 'know' which interface to 'listen' to etc?



    All the sequences start from pulling down MCLR (or up to Vpp if in HVP mode). Each group of pins has its own MCLR. Once the MCLR goes down, it resets the PIC and strarts listening to the sequence on the corresponding pins. The sequence is only needed for LVP. HVP gets entered immediately after you take the MCLR pin to Vpp.
     
    PIC24/dsPIC33/PIC32 have only one MCLR but many groups of PGC/PGD pins. So, it listens to the sequence on all of them. When it sees the sequence on any group, this group gets used for programming. Since this is only a single MCLR, the sequence is necessary even for HVP, although the majority of them don't support HVP at all. Only some small PIC24s support HVP.
     
    Debugging is different. You need to set config bits to select the debugging pins.
    #7
    nyholku
    Senior Member
    • Total Posts : 124
    • Reward points : 0
    • Joined: 2008/04/30 05:13:58
    • Location: 0
    • Status: offline
    Re: PIC18F45K40 44-PIN TQFP ICSP 2020/10/31 22:29:35 (permalink)
    0
    @NorthGuy Brilliant! Thank you for the explanation, I'm very interested in understanding the nitty gritty even if not strictly necessary. :) 
     
    #8
    Jump to:
    © 2020 APG vNext Commercial Version 4.5