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

XON is always activated #58

Open
jvalrog opened this issue Feb 17, 2015 · 1 comment
Open

XON is always activated #58

jvalrog opened this issue Feb 17, 2015 · 1 comment

Comments

@jvalrog
Copy link

jvalrog commented Feb 17, 2015

I'm trying to control an Arduino board with serialport, but I'm having difficulties. I'm calling "readbyte" several times to retrieve binary data, but it triggers a timeout at random intervals.

I found that the solution was to open the Arduino IDE, open the Serial Monitor, and close it.
By doing this, the Arduino IDE changed some parameters in the serial port and all the errors were gone after that.

Arduino requires no xon/xoff protocol.

So I investigated a bit and found that "serialport" disables xoff but not xon, while the arduino ide disabled both.

The output of "stty --file=/dev/ttyUSB0 -a" after opening the serial port with "serialport" is this (only interesting lines):

werase = ^W; lnext = ^V; flush = ^O; min = 0; time = 10;
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff

And the output after opening it with the Arduino IDE is this:

werase = ^W; lnext = ^V; flush = ^O; min = 0; time = 0;
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff

The only differences are the "time = 0" and "-ixon".
I'm opening the port with this code:

@serial = SerialPort.new(port, BAUDRATE, 8, 1, SerialPort::NONE)

I don't understand why XON is not disabled.

Also wanted to thank you for coding this gem!

@jvalrog
Copy link
Author

jvalrog commented Feb 17, 2015

This issue is related to this one: #34

Same problem/bug. I had to add "@serial.flow_control = SerialPort::NONE" by hand to fix my problem.

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

No branches or pull requests

1 participant