This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

driverlib missing open drain with pull up configuration

Other Parts Discussed in Thread: TM4C1232C3PM

I have an I2C device connected to my TM4C1232C3PM microcontroller. I don't have any external pullups, so I planned to use the internal pullups. At first I had some trouble, but after a bit of debugging I managed to get it to work correctly.

I added a couple of more #defines:

#define GPIO_PIN_TYPE_OD_WPU    0x0000000B  // Open-drain with weak pullup
#define GPIO_PIN_TYPE_OD_WPD    0x0000000D  // Open-drain with weak pulldown

Then I can call GPIOPadConfigSet() with these and everything works fine, but now I can't use DEBUG mode since
 they aren't official defines and the function checks all arguments. Could these defines be added to a future driverlib release?

The same effect can be made by manually turning the pull-up on after calling GPIOPadConfigSet() with GPIO_PIN_TYPE_OD, but it isn't as nice, and there already are GPIO_PIN_TYPE_STD_WPU and GPIO_PIN_TYPE_STD_WPD if you want push-pull pins.

Also, this comment from GPIOPinTypeI2C() seems to be wrong:

    //
    // Set the pad(s) for open-drain operation with a weak pull-up.
    //
    GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_OD);

It doesn't actually set the weak pull-up. Using my GPIO_PIN_TYPE_OD_WPU however would work.

  • Hello Esa-Pekka,

    A PU option can be added for Open Drain. BTW PD does not make sense for Open Drain.

    Regards

    Amit

  • OK that sounds great. 

    About the pull-down configuration: Wouldn't it still provide two disctinctive states. One state is low-impedance ground, and the other is high-impedance ground. I don't know any applications for that though.

  • Per Table 9-3 in the Datasheet Page 589 the PUR and PDR (pull up and pull down) configuration bits are ignored in Open Drain and I2C configurations.  

    An external pull resistor is required to ensure proper operation.

    Dexter

  • Esa-Pekka Pyokkimies said:

    About the pull-down configuration: Wouldn't it still provide two disctinctive states. One state is low-impedance ground, and the other is high-impedance ground. I don't know any applications for that though.

     

    I can think of one. 

    If you are transmitting over a wire it is useful to have three states.  On, off and disconnected.  In that case a weak pull down provides an off, a strong pull down provides an on and no pull down is disconnected.  Toggling strong pull down on and off while leaving weak pull down on provides the signalling.

     

    I don't think I'd want to do this directly to a vulnerable CPU pin though.  It's also rather low current and voltage for the task.  The analog equivalent to this is the 4-20mA current loop.

     

    Robert

  • Stellaris Dexter said:

    Per Table 9-3 in the Datasheet Page 589 the PUR and PDR (pull up and pull down) configuration bits are ignored in Open Drain and I2C configurations.  

    Thanks, I missed that table entirely. Is the datasheet wrong, because it seems to work? Should it be '?' instead in that table?

    Esa-Pekka