-
Notifications
You must be signed in to change notification settings - Fork 9
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
CDC_write is blocking #2
Comments
Hi, thank you very much for the tip. It's not entirely clear to me why it hangs, but if the fix helps, that's good. At least every serial monitor I know also sets the DTR flag, so that shouldn't be a problem. |
It hangs at the line I quoted above because the busy flag never gets cleared. Anyway, I found one other thing I had to fix that I might post a separate issue for. After that everything is working smoothly. |
Perhaps the problem depends on the CDC driver or operating system used. Actually, the packages should be accepted even if no serial monitor accesses the driver. |
In that case, it may be relevant that I'm using Mac OS. |
First off a big thank you for creating this and putting it on github!
I created a board with a CH551 on it to use as a build in SWD, however the DAPLink would become unresponsive. After some debugging I realized this was because my target was sending serial data to the CH551 UART, but I didn't have a serial monitor connected. This caused CDC_write to hang at the following line:
CH552-DAPLink/software/src/usb_cdc.c
Line 73 in c7975f8
My quick and dirty fix was to use the DTR flag to decide if it should try to write the data to the CDC, so I changed line 97 of daplink.c to:
if(CDC_getDTR() && UART_available()) {
This of course requires the serial monitor to set DTR, but it solved the problem for me.
With no terminal connected the UART just continues happily overwriting the old data in buffer.
The text was updated successfully, but these errors were encountered: