cancel
Showing results for 
Search instead for 
Did you mean: 

CTS signal on USB CDC

Willem La Grange
Associate II
Posted on May 15, 2018 at 09:13

Hi,

I need to send the CTS status from my target hardware to the Virtual com port driver in windows, USBser.sys.

I have managed to do all the other handshake signals (DTR, RTS, DCD and DSR) working except CTS. Apparently there is no provision for CTS in USBD PSTNv1.2 form USB.org and there seems to be a bug in the windows USBser.sys driver. The CTS signal status get set whenever you set the DSR signal but then you cant clear the CTS signal again. I am not using CTS for my hardware flow control (It is not necessary) but the program that needs to connect to the VCP driver uses the CTS signal in a login process together with DSR

Does anyone have a clever idea how to manipulate the CTS signal in the CDC class?

Your input would be highly appreciated.

5 REPLIES 5
Robmar
Senior III

It is a valid question, and again ignored by ST's "support" staff.

Pavel A.
Evangelist III

To verify that the Windows usbser.sys properly supports CTS signal, please ask on Microsoft Q&A forum, with tag “Windows Hardware Development”. Or use other Microsoft Windows support channels.

If you doubt the Windows usbser.sys behaviour, use Linux to test the STM32 firmware.

(I am not ST support, sorry for jumping in)

The USB CDC class spec document PSTN120.pdf version 1.2 (February 9, 2007) lacks definition of CTS bit in the UART state bitmap (6.5.4, Table 31 on page 33). But I've asked the Microsoft AI about the state bitmap and it produced the following:

 

 

// This example demonstrates how to update the CTS signal and send the SERIAL_STATE notification to the host

typedef union {
    uint8_t val;
    struct {
        unsigned dcd         :1;
        unsigned dsr         :1;
        unsigned break_err   :1;
        unsigned ri          :1;
        unsigned frame_err   :1;
        unsigned parity_err  :1;
        unsigned overrun_err :1;
        unsigned cts         :1;  // CTS signal bit
    };
} UART_StateBitmap;

UART_StateBitmap uart_state;

// Function to send SERIAL_STATE notification
void send_serial_state_notification() {
    uint8_t notification_packet[10] = {0xA1, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, uart_state.val, 0x00};
    USB_SendControlEndpoint(notification_packet, sizeof(notification_packet));
}

// Example of updating CTS signal
void update_cts_signal(bool cts_active) {
    uart_state.cts = cts_active ? 1 : 0;
    send_serial_state_notification();
}

 

The CTS bit is indeed documented in the USB spec, PSTN120.pdf as reserved.

We're not using Windows, this is the H743 in Host CDC mode communicating to a USB port controlled by a Silicon Labs CP2105.  We can access the port, query it, send it data, but it just doesn't respond.

The CDC Host code on the H743 works with other USB port devices, and we are testing on both of the dual ports on the CP2105 but the darn thing just doesn't reply, wasted a lot of days on this now.

Pavel A.
Evangelist III

The ST USB library is provided as is. Unfortunately all we can do about it is request the money back )). Then find either a product quality library or help to fix your existing code.

ST provide nothing for free, software is paid for by all the MCUs we buy.