Main Site Documentation

Serial Module - How to set AutoReadLineEnabled on Mountaineer Ethernet without exception?


#1

Hi,

i’m trying to use an RS232 module.

I’m getting a not supported exception when i try to do this:

rs232.serialPort.AutoReadLineEnabled = true;

Is it really not supported???

Thanks


#2

If its telling you that, then yes it’s not supported.


#3

I am not sure I had the same issue.
I am using a RS232 module on a cobra II.

I get an InvalidOperation exception from this line:
rs232.serialPort.AutoReadLineEnabled = true;

I found a post describing a net bug that throws that exception if any Serial parameters are changed after the port has been opened.

rs232.Initialize() opens the port, so I needed to close the port before setting the value.

This code works for me:


rs232.Initialize(57600, Serial.SerialParity.None, Serial.SerialStopBits.One,
                8, Gadgeteer.Interfaces.Serial.HardwareFlowControl.NotRequired);
rs232.serialPort.LineReceived += new Serial.LineReceivedEventHandler(MySerialRead);
rs232.serialPort.Close();
rs232.serialPort.AutoReadLineEnabled = true;
rs232.serialPort.Open();



#4

I suggest those two errors are different, one says its not implemented in the firmware ( not supported) and yours just says you’re doing something invalid based on the order you do them. So your code isn’t going to help the original poster here.