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.

CC2642R-Q1: Open drain (Pull -> Bug sysconfig)

Part Number: CC2642R-Q1
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Good morning,

I create a function to print the status of the GPIO.


void portsettings_printInfoExtended(uint32_t pin)
{
    // Note that the bits of pinConfig may overlap.
    // The order of checking is therefore extremely important!!

    GPIO_PinConfig pinConfig;
    GPIO_getConfig(pin, &pinConfig);
    uint32_t pinValue = GPIO_read(pin);

    //Pin Configuratie
    //GPIO_CFG_OUT_OPEN_SOURCE_INTERNAL  0x26000000  // never used?
    //GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL   0x24000000
    //GPIO_CFG_INPUT_INTERNAL               0x20000002
    //GPIO_CFG_OUTPUT_INTERNAL              0x20000000
    //GPIO_CFG_NO_DIR_INTERNAL              0x00000002
    const char *pinType;
    if ((pinConfig & GPIO_CFG_OUT_OPEN_SOURCE_INTERNAL) == GPIO_CFG_OUT_OPEN_SOURCE_INTERNAL)
    {
        pinType = pinValue ? "|   Output  | Open-source |  HIGH  " : "|   Output  | Open-source |  LOW   ";
    }
    else if ((pinConfig & GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL) == GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL)
    {
        pinType = pinValue ? "|   Output  | Open-drain  |  HIGH  " : "|   Output  | Open-drain  |  LOW   ";
    }
    else if ((pinConfig & GPIO_CFG_INPUT_INTERNAL) == GPIO_CFG_INPUT_INTERNAL)
    {
        pinType = "|   Input   |      -      |    -   ";
    }
    else if ((pinConfig & GPIO_CFG_OUTPUT_INTERNAL) == GPIO_CFG_OUTPUT_INTERNAL)
    {
        pinType = pinValue ? "|   Output  | Standard    |  HIGH  " : "|   Output  | Standard    |  LOW   ";
    }
    else if ((pinConfig & GPIO_CFG_NO_DIR_INTERNAL) == GPIO_CFG_NO_DIR_INTERNAL)
    {
        pinType = "|   No-dir  |      -      |    -   ";
    }
    else
        pinType = "|     -     |       -     |    -   ";

    //Pull-up/Pull-down configuratie
    //GPIO_CFG_PULL_NONE_INTERNAL       0x00006000
    //GPIO_CFG_PULL_UP_INTERNAL         0x00004000
    //GPIO_CFG_PULL_DOWN_INTERNAL       0x00002000
    const char *pullType;
    // Input or open drain
    if (((pinConfig & GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL) == GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL) || ((pinConfig & GPIO_CFG_INPUT_INTERNAL)  == GPIO_CFG_INPUT_INTERNAL))
    {
        if ((pinConfig & GPIO_CFG_PULL_NONE_INTERNAL) == GPIO_CFG_PULL_NONE_INTERNAL)
        {
            pullType = "| Float   ";  // Floating
        }
        else if ((pinConfig & GPIO_CFG_PULL_UP_INTERNAL) == GPIO_CFG_PULL_UP_INTERNAL)
        {
            pullType = "| Pull-U  ";  // Pull-up
        }
        else if ((pinConfig & GPIO_CFG_PULL_DOWN_INTERNAL) == GPIO_CFG_PULL_DOWN_INTERNAL)
        {
            pullType = "| Pull-D  ";  // Pull-down
        }
        else
        {
            pullType = "| BUG!!!  ";   // Unknown Open drain had no pull??
        }
    }
    else
        pullType = "|   -     ";       // Output has no pull

    // Interrupt configuratie
    // GPIO_CFG_INT_ENABLE_INTERNAL     0x00040000
    // GPIO_CFG_INT_DISABLE_INTERNAL    0x00000000
    // GPIO_CFG_INT_BOTH_EDGES_INTERNAL 0x00030000
    // GPIO_CFG_INT_RISING_INTERNAL     0x00020000
    // GPIO_CFG_INT_FALLING_INTERNAL    0x00010000
    // GPIO_CFG_INT_NONE_INTERNAL       0x00000000
    const char *interruptType;
    if ((pinConfig & GPIO_CFG_INT_ENABLE_INTERNAL) == GPIO_CFG_INT_ENABLE_INTERNAL)
    {
        if ((pinConfig & GPIO_CFG_INT_BOTH_EDGES_INTERNAL) == GPIO_CFG_INT_BOTH_EDGES_INTERNAL)
            interruptType = "| Int ON  | B edges ";
        else if ((pinConfig & GPIO_CFG_INT_RISING_INTERNAL) == GPIO_CFG_INT_RISING_INTERNAL)
            interruptType = "| Int ON  | R edge  ";
        else if ((pinConfig & GPIO_CFG_INT_FALLING_INTERNAL) == GPIO_CFG_INT_FALLING_INTERNAL)
            interruptType = "| Int ON  | F edge  ";
        else
            interruptType = "| Int ON  | None    ";
    }
    else
        interruptType = "| Int OFF |    -    ";

    Debug_printf("|%18s%-33s%-9s%-19s|\n", portSettings_getName(pin), pinType, pullType, interruptType);
}


Now I have discovered a bug in the sysconfig.
If I set my GPIO as an open drain, the PULL_NONE, PULL_UP or PULL_DOWN is not set.
I am using SDK version 7_40_00_77 and sysconfig_1.18.1.
Do more people have this problem?

 
GPIO_CFG_OUTPUT_INTERNAL | GPIO_CFG_OUT_STR_MED | GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL | GPIO_CFG_OUT_HIGH, /* GPIO_MODEM_ON_OFF_RESET */
Missing 
GPIO_CFG_PULL_NONE_INTERNAL

 
GPIO_CFG_OUTPUT_INTERNAL | GPIO_CFG_OUT_STR_MED | GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL | GPIO_CFG_OUT_HIGH, /* GPIO_MODEM_ON_OFF_RESET */
Missing
GPIO_CFG_PULL_UP_INTERNAL
Where can I report this?? I have now solved it by creating an overrule function in the board_init to set the pull type for open-drain pins
  • Hello Jasper, 

    Hope you are doing well. I have tested this and see the same result you are seeing. Open drain outputs require pull up resistors to properly output high. Because of this, the open drain option will use the default value, no pull (3h). Read more about this in section 13.10.3.1 IOCFG0 Register of the Technical Reference Manual

    I am not sure why SysConfig gives an option to select pull, but this should not be an option for Open Drain. 

    Additionally, pull ups are typically used with open drain outputs, but it is recommended to use an external pull up resistor, as the internal pull up resistors may not be large enough for an open drain output. You may see some variance in the performance depending on different conditions when using the internal pull up for open drain outputs. It is recommended to use an external pull up resistor for this. 

    Thanks, 

    Isaac

  • Hi Isaac,

    It may be set as no pull by default.
    But when I do GPIO_getConfig it is not recognized as GPIO_CFG_PULL_NONE_INTERNAL that's strange.
    Thank you for your information. 
    So for now I solved it by making the board_init an overrule function that sets the pull type.
    The GPIO_getConfig then recognizes the different pullType


        if (((pinConfig & GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL) == GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL) || ((pinConfig & GPIO_CFG_INPUT_INTERNAL)  == GPIO_CFG_INPUT_INTERNAL))
        {
            if ((pinConfig & GPIO_CFG_PULL_NONE_INTERNAL) == GPIO_CFG_PULL_NONE_INTERNAL)
            {
                pullType = "| Float   ";  // Floating
            }
            else if ((pinConfig & GPIO_CFG_PULL_UP_INTERNAL) == GPIO_CFG_PULL_UP_INTERNAL)
            {
                pullType = "| Pull-U  ";  // Pull-up
            }
            else if ((pinConfig & GPIO_CFG_PULL_DOWN_INTERNAL) == GPIO_CFG_PULL_DOWN_INTERNAL)
            {
                pullType = "| Pull-D  ";  // Pull-down
            }
            else
            {
                pullType = "| BUG!!!  ";   // Unknown Open drain had no pull??
            }
        }
        else
            pullType = "|   -     ";       // Output has no pull

  • Hello Jasper, 

    It is strange, and I am following up with the team to find a reason/solution to this. 

    To reiterate, the default will be set to no pull. It is recommended to use an external pull up resistor on the board for the open drain pins. The internal pull up resistor value may not be large enough for your desired performance.

    Glad that you have solved it within code! 

    Thanks, 
    Isaac