Control CTS and DSR lines
Is your feature request related to a problem? Please describe. Hi, I'm trying to use an rp2040 to create an hardware project which should control the CTS and DSR lines of a CDC port. I see the current CDC code doesn't support them.
Describe the solution you'd like I'd like to know how to implement CTS and DSR control in tinyusb. I'm also able to read DTR, but RTS is not updated. Host is Windows 11/10. Thanks
to speed up the support, do you know
- on PC host, which API is used to get cts and dsr, preferably with python script
- And which CDC-ACM request that host issue when (1) is called to get CTS and DSR from device
Hi, I don't have those information. I'm using comtestserial to interact with the CDC port. I had success moving DSR with this function:
void set_dsr(uint8_t itf, bool value) {
cdcd_interface_t* p_cdc = &_cdcd_itf[itf];
uint8_t packet[10];
packet[0] = 0xA1; // bmRequestType
packet[1] = CDC_NOTIF_SERIAL_STATE; // bNotification
packet[2] = 0x00; // wValue
packet[3] = 0x00;
packet[4] = 0x00; // wIndex
packet[5] = 0x00;
packet[6] = 0x02; // wLength
packet[7] = 0x00;
packet[8] = value ? 0x02 : 0x00;
packet[9] = 0x00;
usbd_edpt_xfer(TUD_OPT_RHPORT, p_cdc->ep_notif, packet, 10);
}
with this code, CTS is always High. Before calling this function, I see it as low. Thanks
thanks for info, though it doesn't answer the 1st question, which script/API you run on windows to get CTS DSR state
On Windows 10/11 I open this software to read the serial port state: https://www.microridge.com/comtestserial.htm
Thanks, I don't use windows, but I could give it a try on my VM when I have the time to work on this later on.
Thanks, I can try something on Linux and OSX to verify my code, which platform are you working on?
I am on Linux
The pin state can be checked with pySerial
Something along these lines
import serial
tty = serial.Serial(port = '/dev/AMA0', baudrate = baud, parity = serial.PARITY_NONE, stopbits = serial.STOPBITS_ONE, bytesize = serial.EIGHTBITS, xonxoff = True, timeout = 2.0)
if (tty.getCTS()):
print("CTS")
You can also use coolterm under Linux for a checking the state of the cts/dsr pins with a nice GUI.
Hi I want to implement the same of having CTS flow control with pre existing RTS. Have you got it to work if yes can u share them please.