You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pico_stdio_deinit doesn't necessarily use the right uart instace/pins #3173
These APIs seem to have evolved over time; i just noticed this in passing...
there may not actually be a bug here, though i suspect there is... there are multiple paths of pico_stdio_uart_init/pico_stdio_uart_init_full some of which come from stdio_init_all and similarly for de-init. It doesn't look like we do the right thing in all cases. One correct-ish solution might be to record then pins used (we already record the instance, though don't actually use it in de-init), though i'm loathe to increase the code/data size for this (most people dont call deinit after all)
So maybe we just need to be clearer in the comments which paths are/aren't supported, and make sure there aren't other places in the code that blindly call pico_stdio_uart_deinit() or at least we should make sure we describe (and bless) what that is supposed to do (I'm looking at you stdio_deinit_all() !)
I think the only unsupported paths would be calling the stdout/stdin version of _uart_init() and then calling a different stdio/stdout/stdin version of _uart_deinit() after, because the deinit will isolate the unused pin (e.g. calling stdout_uart_init() followed by stdin_uart_deinit() will result in PICO_DEFAULT_UART_RX_PIN being isolated).
I'll add documentation to the functions to make this clear, but I don't think it's enough of an issue that it needs any code changes, as it is just the isolation latches which are affected
Activity
will-v-pi commentedon Sep 4, 2026
I think the only unsupported paths would be calling the
stdout/stdinversion of_uart_init()and then calling a differentstdio/stdout/stdinversion of_uart_deinit()after, because the deinit will isolate the unused pin (e.g. callingstdout_uart_init()followed bystdin_uart_deinit()will result inPICO_DEFAULT_UART_RX_PINbeing isolated).I'll add documentation to the functions to make this clear, but I don't think it's enough of an issue that it needs any code changes, as it is just the isolation latches which are affected
lurch commentedon Sep 4, 2026
This reminds me of the conversation that happened in #811 (which obviously pre-dated RP2350).