Open drain pins on PIC24HJ64GP502

Author
tomcuga
Starting Member
  • Total Posts : 37
  • Reward points : 0
  • Joined: 2007/05/30 07:55:29
  • Location: Croatia
  • Status: offline
2009/07/18 12:06:29 (permalink)
0

Open drain pins on PIC24HJ64GP502

Hello,
Can someone tell me does pin RB15 have open drain feature implemented?
It seems to me there are some contradictions between C30 p24HJ64GP502.h
file and datasheet. In .h file all portb bits are defined in ODCBBITS structure
and porta bits 0 to 4 are defined in ODCABITS structure. But when I look in
PIC24HJ64GPX02/X04 (70293C.pdf) datasheet, table 4-29 on page 43 I can see
that only pins 5 to 11 on portb have open drain feature. Olso there is no pins
on porta with open drain feature at all?!
Olso in 24h FRM, section 10 about I/O ports, page 10-4 it is said:
"The open-drain I/O feature is not
supported on pins that have analog functionality multiplexed on the pin"
And RB15 is analog channel 9 in 24HJ64GP502.
So am I missing something?
Thanks to everyone for answers!


http://tomlab.weebly.com
#1

15 Replies Related Threads

    Mike017
    Super Member
    • Total Posts : 2698
    • Reward points : 0
    • Joined: 2007/08/25 08:11:31
    • Location: Lincoln, RI, USA
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/18 19:31:55 (permalink)
    0
    Hi,
     
    I think you are out of luck using RB15. As you quoted...
    "The open-drain I/O feature is not
    supported on pins that have analog functionality multiplexed on the pin"
    And RB15 is analog channel 9 in 24HJ64GP502.
    .. this is part of it.
     
    Also, from...
    But when I look in PIC24HJ64GPX02/X04 (70293C.pdf) datasheet, table 4-29 on page 43 I can see
    that only pins 5 to 11 on portb have open drain feature.
    ... you'll notice that these are also the ones labeled as up to 5V tolerant in the pin diagram. So, the open drain criteria is digital and 5 volt tolerant.
     
    Maybe someone else can add to the post.
     
    Good Luck,
    Mike
     
     
     
     
    #2
    rbreesems
    Super Member
    • Total Posts : 472
    • Reward points : 0
    • Joined: 2005/02/07 15:08:08
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/20 06:29:25 (permalink)
    0
    I already posted this on the Sparkfun board, will post it here also.

    There are inconsistencies between the PIC24 FRM and the datasheets.

    a. The DS70289D datasheet for the PIC24HJ32GP202, pg 36, Table 4-18 shows all of the open-drain bits for PORTB defined. Pins RB15-12 on the PIC24HJ32GP202 have analog functionality, so this is inconsistent with the PIC24 FRM that states that port pins with analog functionality do not have open drain capability.

    b. The compiler header files for both the PIC24HJ32GP202 and PIC24HJ64GP502 have the open drain bits defined for all PORTB pins.

    c. Direct breadboard experimentation with both the PIC24HJ32GP202 and the PIC24HJ64GP502 shows that open drain is supported on RB15. This is easy to do - hook up an LED in series with a resistor.  Configure the port as a normal output port and blink the LED - it will blink normally.  Now, configure the port for open drain operation -- the LED does not blink (this is because the port floats ('Z', high impedance) when a  '1' is written to the port when open drain is enabled).  If open drain was not supported, then the LED should continue to blink in this mode.

    d. If you insist on believing the datasheets (ie. the datasheet for the PI24HJ32GP202 shows open drain supported for all PORTB bits while the datasheet for the PI24HJ32GP502 only shows support for pins PORTB 5-11), then I would ask this question -- these parts are supposed to be pin-compatible  from a parallel port viewpoint, why would Microchip purposefully remove open-drain functionality from some pins of one part, and leave it on the same pins of another part?    

    I believe this is a datasheet errata in the PORTB description of the PIC24HJ64GP502.  I have a ticket into Microchip to check the resolution.

    This would not be the first datasheet errata I have encountered. Another one is the PIC24 FRM description of the change notification feature of port pins. On page 10-7 of the IO port section, it says "When a CN interrupt occcurs, the user should read the PORTx register with the CN pins. This clears the mismatch condition and sets up the CN logic to detect the next pin change". This is wrong - this a holdover description from how PORTB interrupt-on-change feature worked on the PIC18.  On the PIC24, there is no need to read PORTB to re-enable the CN logic - all you have to do is clear the CN interrupt flag which agrees with the hardware diagram shown for the CN logic (and this was confirmed by a Microchip ticket resolution a few months back and they still have not updated the PIC24 FRM documentation).

    So, anyway -- there are undocumentated errata in the datasheets, and the only way to get  a clear answer on an inconsistency like this is to convince yourself by direct experimentation (the best way) or to seek an answer via a Microchip ticket resolution.
    post edited by rbreesems - 2009/07/20 07:53:24

    PIC24 code examples at http://www.reesemicro.com
    #3
    Kruse
    Super Member
    • Total Posts : 1224
    • Reward points : 0
    • Joined: 2005/04/15 09:04:09
    • Location: Denmark
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/21 03:30:47 (permalink)
    0
    . Direct breadboard experimentation with both the PIC24HJ32GP202 and the PIC24HJ64GP502 shows that open drain is supported on RB15. This is easy to do - hook up an LED in series with a resistor.  Configure the port as a normal output port and blink the LED - it will blink normally.  Now, configure the port for open drain operation -- the LED does not blink (this is because the port floats ('Z', high impedance) when a  '1' is written to the port when open drain is enabled).  If open drain was not supported, then the LED should continue to blink in this mode.

     
    I can't say if RB15 supports 'open drain', but I will say that your test here doesn't clarify that issue.
     
    The open drain feature is related to 5V tolerance. If you wants to check this you will have to connect your LED (correctly polarised) with it's (appropiate) series resistor to +5V -> RB15 and see if it still will blink. Ofcourse the LED should then be lit when the port is set low if the open drain is supported.
    If it flashes let run for a while to see if the uC survives it.
     

    A PIC listens to your commands -not your intentions.
    #4
    flubydust
    Super Member
    • Total Posts : 1265
    • Reward points : 0
    • Joined: 2005/05/19 13:44:42
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/21 07:07:32 (permalink)
    0
    ORIGINAL: Kruse
    The open drain feature is related to 5V tolerance.


    You seem to be making the same mistake the data sheet authors did. Open drain and 5v tolerance are independent features.

    Pins are not required to have both features just because a particular application requires a pin with both features.

    #5
    Kruse
    Super Member
    • Total Posts : 1224
    • Reward points : 0
    • Joined: 2005/04/15 09:04:09
    • Location: Denmark
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/21 12:42:34 (permalink)
    0

    ORIGINAL: flubydust

    You seem to be making the same mistake the data sheet authors did. Open drain and 5v tolerance are independent features.

    Pins are not required to have both features just because a particular application requires a pin with both features.


    Could be.

    Still the above test doesn't say anything about the presence of a open drain output or not.

    A PIC listens to your commands -not your intentions.
    #6
    nice
    Super Member
    • Total Posts : 1023
    • Reward points : 0
    • Joined: 2004/09/18 11:42:25
    • Location: Germany
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/21 13:09:18 (permalink)
    0
    Still the above test doesn't say anything about the presence of a open drain output or not.

    For sure it does, if

    hook up an LED in series with a resistor

    intends 'hook up an LED in series with a resistor to GND'.

    Best regards,
    Bernd
    #7
    Kruse
    Super Member
    • Total Posts : 1224
    • Reward points : 0
    • Joined: 2005/04/15 09:04:09
    • Location: Denmark
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/21 22:50:54 (permalink)
    0
    A open drain output consist of a transistor that pulls the pin down gnd.
     
    Connecting a LED+resistor to gnd and that pin, will result in no light from the LED when the transistor is 'active', actually the LED will never be lit regardless of the output state.
    Such a test does NOT reveal any open drain transistor.
    The same will happen if: the uC isn't powered or faulty, the output is actually configured as an input, the output is faulty ... and a lot more.

    A PIC listens to your commands -not your intentions.
    #8
    flubydust
    Super Member
    • Total Posts : 1265
    • Reward points : 0
    • Joined: 2005/05/19 13:44:42
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/22 08:38:22 (permalink)
    0
    ORIGINAL: Kruse

    A open drain output consist of a transistor that pulls the pin down gnd.

    Connecting a LED+resistor to gnd and that pin, will result in no light from the LED when the transistor is 'active', actually the LED will never be lit regardless of the output state.
    Such a test does NOT reveal any open drain transistor.


    Every pin with output capability has a connection to an N channel MOSFET drain which pulls the pin to ground they also have a connection to a P channel MOSFET drain to pull the pin to the supply voltage. The open drain function is achieved by disabling the P channel MOSFET. A LED + resistor to ground test can confirm the P channel MOSFET is disabled by the open drain output control.

    #9
    Kruse
    Super Member
    • Total Posts : 1224
    • Reward points : 0
    • Joined: 2005/04/15 09:04:09
    • Location: Denmark
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/22 09:11:51 (permalink)
    0

    ORIGINAL: flubydust

    Every pin with output capability has a connection to an N channel MOSFET drain which pulls the pin to ground they also have a connection to a P channel MOSFET drain to pull the pin to the supply voltage. The open drain function is achieved by disabling the P channel MOSFET. A LED + resistor to ground test can confirm the P channel MOSFET is disabled by the open drain output control.



    If was so the test rbreesems did showed that the open drain output is not present.

    Fortunately an open drain output does not consist of a transistor that pull the pin to supply, as you describe it.
    An open drain output is a transistor pulling the pin to gnd.

    Other wise it wouldn't be able to provide a 5V output open drain that conforms to High/Low voltage levels. The output voltages would be something between 5V and uC Vcc.

    A PIC listens to your commands -not your intentions.
    #10
    nice
    Super Member
    • Total Posts : 1023
    • Reward points : 0
    • Joined: 2004/09/18 11:42:25
    • Location: Germany
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/22 09:57:48 (permalink)
    0
    an open drain output does not consist of a transistor that pull the pin to supply, as you describe it.

    That's why flubydust wrote:
    The open drain function is achieved by disabling the P channel MOSFET.

    What's left if the P channel MOSFET is disabled? A single N channel MOSFET.

    Other wise it wouldn't be able to provide a 5V output open drain that conforms to High/Low voltage levels.

    Is there any standard I've missed that requires an open drain output to withstand 5V? Again, the open drain functionality has absolutely nothing to do with the applicable voltage.

    Added:
    The 5V tolerant open drain outputs of the PIC24H have the mentioned P channel MOSFETs as well. If there are no P channel MOSFETs, the pins couldn't be used as a standard push-pull output.

    If you're still not convinced, take a look at a 24K device datasheet. None of the port pins is 5V tolerant, but you can configure them as open drain.

    Best regards,
    Bernd
    post edited by nice - 2009/07/22 13:48:52
    #11
    Kruse
    Super Member
    • Total Posts : 1224
    • Reward points : 0
    • Joined: 2005/04/15 09:04:09
    • Location: Denmark
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/23 03:04:36 (permalink)
    0
    If you're still not convinced, take a look at a 24K device datasheet. None of the port pins is 5V tolerant, but you can configure them as open drain.


    You are reversing my words.
    I don't say the open drain feature provides 5V tolerance, there are a lot of devices with open drain for a complete different purpose eg. some comperators.
    What I say is that open drain and 5V tolerance is related ofcourse in the sense that a 5V (or higher than device supply) tolerance is depended on a open drain output. At least with the technology today.

    Should I be wrong in that I would like to know.... (with documentaion please).


    Should I understand you (Nice) in that way that you mean the rbreesems test concludes a open drain transistor is present by the fact that a LED is not lit ?

    Please observe that my partition in this thread was never aimed at the 5V tolerance existed or not. Solely in conclusion you all accepted that rbreesems test should prove a open drain transistor existed.
    post edited by Kruse - 2009/07/23 03:14:22

    A PIC listens to your commands -not your intentions.
    #12
    nice
    Super Member
    • Total Posts : 1023
    • Reward points : 0
    • Joined: 2004/09/18 11:42:25
    • Location: Germany
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/23 11:02:09 (permalink)
    0
    Should I understand you (Nice) in that way that you mean the rbreesems test concludes a open drain transistor is present by the fact that a LED is not lit ?

    Strictly speaking rbreesems proved, that configuring the pin as open drain disables the P channel MOSFET (writing a '1' to the LAT register doesn't lit the LED as opposed to push-pull mode). The N channel MOSFET shouldn't mystically vanish by configuring an output as open drain, since this MOSFET is the open drain transistor. If the open drain feature on RB15 doesn't behave differently from other pins, I would call this an indirect proof. A sanity check would be to connect a LED to 3.3V and see whether it lits when the pin is driven low.

    What I say is that open drain and 5V tolerance is related ofcourse in the sense that a 5V (or higher than device supply) tolerance is depended on a open drain output. At least with the technology today.

    There are a lot of low voltage standard logic devices with 5V tolerant push-pull outputs (device in 3-State). By connecting the low voltage input signal to the logic input and the enable input (active low), you'll get a 5V tolerant open drain output where a push-pull output is physically present.

    http://www.standardics.nxp.com/features/5v-io/


    Best regards,
    Bernd
    post edited by nice - 2009/07/23 11:04:36
    #13
    smartdrive
    Junior Member
    • Total Posts : 116
    • Reward points : 0
    • Joined: 2003/12/23 13:44:46
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/29 01:25:13 (permalink)
    0
    When trying to test such things it is always best to check all current paths concurrently, so a more appropriate test of whether an Open Drain output is present is actualy use two LEDs and series resistors - one LED & series resistor from Vdd (anode towards Vdd) to the output, the other from the output to Vss (anode towards the output).  The resistors should be selected such that with the output at high Z the LEDs are either very dim or prefferable off.  Then write a program that pulses the pin on-off at low speed (e.g. 2 Hz).  If only the Vdd LED flashes brightly then Open Drain is working, if both LEDs alternately flash brightly then the push-pull output is working, if only the Vss LED flashes brightly then only the high side output driver is operating and if nothing flashes then there is something else wrong i.e. program or dead pic etc.
    #14
    icserny
    Super Member
    • Total Posts : 258
    • Reward points : 0
    • Joined: 2008/09/07 13:27:08
    • Location: Debrecen, Hungary
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/30 00:45:11 (permalink)
    0
    The quickest test is: write 0xffff into both ODCA and ODCB then read their content. Unimplemented bits will read '0'. This quick test revealed, that - despite of the (false) info in the datasheet - all existing PORTA and PORTB bits (RA0-RA4, RB0-RB15) have the open drain feature implemented in the PIC24HJ128GP502!

    The  LED tests confirmed this: the tests showed that there is pull down, but no pullup when the corresponding ODCx bit is set.

    #15
    smartdrive
    Junior Member
    • Total Posts : 116
    • Reward points : 0
    • Joined: 2003/12/23 13:44:46
    • Status: offline
    RE: Open drain pins on PIC24HJ64GP502 2009/07/30 01:27:45 (permalink)
    0
    The quickest test is: write 0xffff into both ODCA and ODCB then read their content. Unimplemented bits will read '0'.

    True, but in ambiguous cases such as this one it's better to test the hardware end of things just in case!
    #16
    Jump to:
    © 2017 APG vNext Commercial Version 4.5