pico_stdio_deinit doesn't necessarily use the right uart instace/pins #3173
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#3173
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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_fullsome of which come fromstdio_init_alland 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 youstdio_deinit_all()!)See also #3173
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
This reminds me of the conversation that happened in #811 (which obviously pre-dated RP2350).