It turns out that Arduino pinMode(pin, OUTPUT) puts the GPIO pin in GPIO_INPUT_OUTPUT mode, that is, in driven rather than open drain mode. If you read the pin configuraton with gpio_config_t then both input and output are turned on, but the 'od' and is not. Switching from input to input_output automatically disables the pullup.
I also discovered that although the data bus can operate in open drain mode, the control bus signals have to be driven, so I can't just use the _OD option across the board. On the other hand, using INPUT_OUTPUT mode without _OD emulates pinMode() and does work. I am still unsure why pure OUTPUT mode does not work, but I am pretty sure that its related to how digitalRead() behaves. It behaves differently between OUTPUT and INPUT_OUTPUT modes.
It may be that I need to make changes to my program to account for this, but at least I do now have a set of functions that work as intended.
Thank you for the helpful comments.
Switching between OUTPUT and INPUT_PULLUP using registers
Who is online
Users browsing this forum: Baidu [Spider], meta-externalagent, PerplexityBot and 6 guests