Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CH341 emulation class driver #1507

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Conversation

TravisRo
Copy link

Describe the PR
Adds CH341 USB to serial emulation class.

Additional context
The CDC driver (for windows at-least) is problematic which is probably why all of the USB to serial IC manufacturers use their own proprietary driver. In my case, I was trying to implement an ESP32 programmer with a CDC interface only to discover that the windows CDC driver (usbser.sys) doesn't handle the RTS signal properly so there was no way to get it to work without modifying the esp scripts.

This CH341 emulation class supports all of the signals. DTR RTS CTS DSR RI DCD as well as BREAK.

Everything is working as of now with the latest master branch and an RP2040. I didn't look at the other bsp's so there may be a small amount of additional work to do.

Regards,
Travis Robinson
[email protected] (libusb-win32, libusbK, LibUsbDotNet)

TravisRo added 16 commits June 10, 2022 01:27
Add CH341 class driver.  This is not really a class but rather CH341 emulation firmware. It allows any supported general purpose microcontroller to appear to the host as a CH341 device (IC)
Add CH341 to built-in driver list (CFG_TUD_CH341)
Add CH341 example
Add ch441_device.c to rp2040/family.cmake. Add ch341_device.h include to tusb.h
unused parameters
const static / static const
TUSB_OPT_DEVICE_ENABLED / CFG_TUD_ENABLED
CFG_TUD_MAX_SPEED=TUSB_SPEED_FULL
Added high speed descriptors though I'm not sure if the CH341 driver will work as a high speed device.

Changed "buffer size" define names in tusb_config to clarify whether we are specifying fifo buffer sizes or endpoint max packet sizes
Remove floating point math
Remove multi-interface support
Remove un-needed logging
Add missing comments
Reduce memory footprint
@TravisRo
Copy link
Author

I have build_arm and build_aarch64 workflows fully green lit. Hopefully the others will go through too. I had to setup my own self-hosted runner to get through your workflow maze. You can't even have a printf in the example code. yikes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

Successfully merging this pull request may close these issues.

1 participant