-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
initial support of CH34x CDC device #2391
Conversation
b8ae26c
to
1f2901e
Compare
Thanks! |
It would be nice, if you first review my other PRs. |
# Conflicts: # src/class/cdc/cdc_host.c
Which compatibility issue you are encoutering with, I actually want to wrap up this ch340 support since I need it in another project . Initial test giving great result, I have fixed some gcc strict warning regarding siged/unsigned cast and do more with code reviews and testing. If you plan to push more, please pull first, I will probably push a few more commits before merging. |
…into cdc_ch34x_support
There is no CH340/CH341 datasheet or programming guide available from vendor WCH.
All 3 differ in details and are NOT working with all derivatives on my desk, so I need to build an extract and to do many "try and errors". |
I just pushed the current but unfinished version. |
there is some .bak in the latest push since I am in need to get ch340 support, I will do the clean up right away. Please hold until my push, thank you. PS: when merging, please also retain my changes, it seems like your latest push discard most of my changes. But that is OK, there is an conflict going on since both of us are updating the driver. |
Thank you, I am cherry picking changes and re-added changes that got lost in the latest push. Please wait a bit before making more push. Hopefully we can got it merged asap. I only tested with an usb2uart dongle ch340g, what else are you testing with ? |
yes, it was a mistake |
sorry |
OK. |
no problem at all, I did a cherry picking and push the update to the PR. Please pull first before making more update. We got everything update now.
Thank you for your information. There is no worry to get it all working in the first PR. We can always fix it later on. |
Take care when testing! |
ch34x_set_line_coding() is finished |
- update ch34x_get_lcr and ch34x_get_factor_divisor
- change ch34x_xfer_get_itf_num() to simply 0
- add ch34x_set_line_coding()
- add typedef for cdc enum
I have pushed the update that implement 2 stage set line coding, also added single set_data_format() as new API. Please test it out to see if that works for you. I will probably do a bit more clean up before merging this.
missinng features will be implemented when needed and/or having free time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I advise not to change that.
There are explicit instructions that default line coding is necessary to start up the CH34x.
For this reason I created CFG_TUH_CDC_LINE_CODING_ON_ENUM_CH34X
.
It may happen, that the following steps 'CONFIG_CH34X_SPECIAL_REG_WRITE' etc. will not work properly.
see
Ok, I agree, setting default for ch34x when CFG_TUH_CDC_LINE_CODING_ON_ENUM not defined is totally OK since it does not take any extra request since it is part of SERIAL_INIT request. I kind of mixed up with linux driver. All is good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect, the PR is well tested and is optimized for ch34x support. Thank you very much for your patient and following up to my request as well as my modification. I am glad that we are finally getting this merged.
Thank you, I enjoyed working with you and learned a lot. |
thank you, I enjoyed co-working with you on this PR as well. |
this is the initial version to support the CH34x CDC device.
the CH34x is as popular as FTDI or CH34x.
this version supports only RX and TX and the line_coding settings.
modem control handling will follow...