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 */
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