Enable/disable connection check made with DTR #932
No reviewers
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!932
Loading…
Reference in a new issue
No description provided.
Delete branch "feature_cdc_disable_dtr_option"
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?
This gives users the option to disable DTR check.
this fixes issues #906, #921
Problem:
tud_cdc_connected is using DTR bit which is used in stdio_usb.c If DTR is not set by host (PC terminal or other device), we can't send anything to host.
src/class/cdc/cdc_device.h
src/class/cdc/cdc_device.h
how to fix
PICO_STDIO_USB_CONNECTION_WITHOUT_DTR option added to config file for who needs to enable.
It doesn't change current behavior because it's disabled by default. Just gives user an option to enable it.
Usage
add this to your CMakeLists.txt file and DTR check will be disabled.
add_definitions(-DPICO_STDIO_USB_CONNECTION_WITHOUT_DTR=1)
I guess this might affect the behaviour of the
PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MSandPICO_STDIO_USB_POST_CONNECT_WAIT_DELAY_MSoptions? 🤷@lurch
It depends on future plans for
stdio_usb_connectedso I respect that and change the code.I think you mean when PICO_STDIO_USB_CONNECTION_CHECK_WITH_DTR and those flags combined ?
how about this? when both flags are enabled adding sleep
I dunno, it's entirely up to @kilograham , but I was just wondering if it might be e.g. worth doing a compile-time
#warningifPICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MSis non-zero, andPICO_STDIO_USB_CONNECTION_CHECK_WITH_DTRis zero? 🤷And IMHO you probably don't want a sleep inside of
stdio_usb_connected, given how often it gets called?to be clear
PICO_STDIO_USB_CONNECTION_CHECK_WITH_DTRis default enabled. so sleep will be called ifPICO_STDIO_USB_CONNECTION_CHECK_WITH_DTRdisabled and ifPICO_STDIO_USB_POST_CONNECT_WAIT_DELAY_MSis set other than 0.in here, when
stdio_usb_connectedcalled, it is always returns true so, if PICO_STDIO_USB_POST_CONNECT_WAIT_DELAY_MS != 0 I though its best wait it in stdio_usb_connected.@kilograham Thanks,
I added a fix,
if you want to revert let me know.
nice, thanks