UsbSerial supports the problematic CH340/341 chipset from 3.0 but the implementation lacked of some necessary features. Finally I managed to get some time to improve CH340 and I gladly announce that CH340/341 support has taken a very long leap!
Current Features
– Broader range of baud rates supported: 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600
– Flow control support for RTS/CTS and DTR/DSR.
– All parity modes.
With this new driver the support for the Arduino clones should be better.
More information about UsbSerial
Happy hacking!
Turns out the Cypress KitProg chip (0x04b4:f139) IS a CDC serial device, but actually has FOUR interfaces defined. Curiously, the serial port itself (class 10) is the fourth interface, but you need to use the third interface to set baud rates and play with the line.
IE: This code will always fail with -1:
int response = connection.controlTransfer(CDC_REQTYPE_HOST2DEVICE, request, value, 0, data, dataLength, USB_TIMEOUT); // where request is 0x20
But THIS code:
int response = connection.controlTransfer(CDC_REQTYPE_HOST2DEVICE, request, value, 2, data, dataLength, USB_TIMEOUT); // where request is 0x20
Will correctly set the UART parameters (baud rate, 8 N 1 etc…)
How to know what the correct “index” is? I have no idea. Do you?