-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
CC2531 as USB CDC-ACM device stop TX data after ignoring it for a while #196
Comments
Rong, I have observed similar behaviour and I have changed the driver a bit to take better consideration of the cdc acm line state. I am hoping to include this fix with my next cc2530-related pull request. When this happens, I'll appreciate it if you can take some time to test a little and give feedback. Quick question, what OS is that behaviour on? You said putty so is this win or linux? I would also like to know if it's native or a VM. If it's on win, what driver are you using? Thanks for mentioning this, at least now I know it's not just me. On 14 Apr 2013, at 15:20, RONG Hongqian notifications@github.com wrote:
|
@g-oikonomou I have observed this behaviour on native Ubuntu 12.04, and also Ubuntu 12.04 in VM, when using Putty or cat /dev/ttyACM0 . With my very simple patch this behaviour disappears, tested using the Ubuntu in VM. I will test it later on the native Ubuntu. |
Can you try this patch and let me know whether it improves the situation? Cheers
|
Your patch works. I tested cat and putty on Ubuntu 12.04 in VM, and on native Ubuntu 12.04. The behaviour disappears in the tests. Cheers! My suggestion is to change the if(line_state == (USB_CDC_ACM_DTE | USB_CDC_ACM_RTS)) to if(line_state & USB_CDC_ACM_DTE ) In Universal Serial Bus Class Definitions for Communication Devices v1.1 (available http://www.usb.org/developers/devclass_docs/usbcdc11.pdf), Page 58( Page69 in pdf), D15..D2 in control signal bitmap are reserved. Also, D1 (USB_CDC_ACM_RTS) is ignored if device is full duplex. |
|
- For the CC2538, simplify handling of USB_CDC_ACM_LINE_STATE events. Ignore the Carrier Control (RTS) bit when receiving a SET_CONTROL_LINE _STATE request, we are a full duplex device. - Improve behaviour of the CC2531 USB stick when there is no process on the host to read IN data. Basically, we adopt the CC2538 approach and we only send data when a DTE is present Closes contiki-os#196
Fixed with #199 |
…init Netstack initializion fix
In my code some data is sent via USB to host periodically. If I plug the CC2531 device without running Putty to receive data, then after a while, open Putty, no data can be received. I guess some buffer overflows, and there are no proper code to recover from it. I made a simple patch but if someone have a way to make the device be able to recover from the overflow that will be better.
My solution now is to add these code:
to function usb_serial_writeb function in usb-serial.c .
So no single byte can be written to usb_tx_data[] buffer if DTR in line state word is not set.
I think this can possibly prevent some buffer from overflow if no application is reading from the USB. This patch is tested and it works, and host computer is using Putty or cat on Ubuntu 12.04.
But if someone have a way to make the device be able to recover from the overflow that will be better.
The text was updated successfully, but these errors were encountered: