CDC doesn't respect no flow control setting (DTR control needed to receive data) #906
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 milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#906
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?
Operating System
Windows 10, Mac OS, I think in all OS es.
Board
Raspberry pi pico
Firmware
just simple app to test cdc behavior.
RasPiPicoSDK_cdc_test-main.zip
What happened ?
When handshake is set to none, to receive data we need to enable DTR. We shouldn't be force to enable DTR to receive data. (other flow control status shouldn't be changed in cdc side if it is the case.)
I believe this caused by tinyusb lib. That's why I open this issue also in tinyusb repo.
please watch the gif file.
How to reproduce ?
RasPiPicoSDK_cdc_test-main.zip
Expected behavior
This the demonstration that 2 FDTI USB serial converter connected each other with 3 pins.
It shouldn't be forced to enable DTR to receive data either sides. Please watch the gif file.
Cause
This happens when raspberry pi usb cdc is used.
Discussed in here https://github.com/hathach/tinyusb/issues/1548 and https://github.com/hathach/tinyusb/discussions/932
Please check this file.
https://github.com/hathach/tinyusb/blob/master/src/class/cdc/cdc_device.c
it is checking DTR if it's on or not regardless checking flow control.
Are you sure that this isn't a quirk of your particular serial terminal program? I never had to fiddle with any DTR settings when using PuTTY as detailed in https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf
yes i'm sure. Check this out. This is with CoolTerm on MacOS.
data only received if only DTR is enabled.
PuTTY or Teraterm terminals are made for VT100 etc., not exactly plain text transmission. You can use if you want. But those are uses other pins too. DTR -> DSR and DSR <- DTR. That's the problem. Asking host application for DSR on is reduce the compatibility with other apps if user is explicitly select no flow control. I'm saying this because if you check 2 FDTI USB serial converter example gif, it doesn't uses DTR. If flow control set to none most 3rd party apps only uses RX, TX, GND.
I've never used any flow control when talking to an RP2040-based board. I've never even connected up the CTS/RTS or DSR/DTR pins when using UART adaptors, just RX/TX and GND. I can't replicate this problem. Downloading the UF2 binary in the OP's repo it works as expected on my machine.
you used screen command right? its also uses VT100.
I'm talking about CDC not UART. I can see that you connect the serial over rx,tx,gnd pins.
I did not use the
screencommand.This is my setup.
Raspberry pi pico -> USB thats all. No usb serial converters attached.
This happens when raspberry pi usb cdc is used.
The UF2 binary you provided doesn't have CDC enabled, only UART?Oops. No, I'm wrong. I wasn't paying enough attention. Sorry.
However, it turns out I am connected via CDC via USB, not UART serial at all. 🤦♂️
Yes, I checked again just to be 100% sure. I downloaded the file and write to my pico. Yes I only check CDC over USB. I didn't even check uart output because you can clearly see my setting that I disabled UART I'm not talking about uart.
https://github.com/MrGreensWorkshop/RasPiPicoSDK_cdc_test/blob/main/CMakeLists.txt
As I mentioned earlier here if you use VT100 terminal you can't catch it.
May I kindly ask you, please check with Coolterm as I mentioned here
Please make sure initial line states for DTR, RTS is off.
Thank you.
Might be worth flagging this up on the tinyUSB GitHub issue tracker, since it is their code.
"can't reproduce" feels sad.
@JamesH65
The problem is how tinyUSB implemented in pico-sdk source code.
https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_stdio_usb/stdio_usb.c
tud_cdc_connectedis used for checking connection but under the hood its checking DTR. I don't think usingtud_cdc_connectedis appropriate way to check the connection.Could you please consider to reopen the issue? Thank you.src/class/cdc/cdc_device.h
src/class/cdc/cdc_device.h
I made a PR #932 which gives user option to disable DTR check.
Not my call to reopen, @kilograham?
@JamesH65 Things are more clear now. You don't need to reopen the issue. I made a PR #932, but label
can't reproducecould be removed.