Skip to content

XON is always activated #58

@jvalrog

Description

@jvalrog

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions