I need to build communication between Multidrop bus nodes and main process running on Windows IoT over Raspberry Pi 3.
I know how to exchange data with 8 bit byte. It example of working code:
_serial_port = await SerialDevice.FromIdAsync(di.Id);
if (_serial_port == null) return false;
_serial_port.WriteTimeout = TimeSpan.FromMilliseconds(1000);
_serial_port.ReadTimeout = TimeSpan.FromMilliseconds(1000);
_serial_port.BaudRate = 9600;
_serial_port.Parity = SerialParity.None;
_serial_port.StopBits = SerialStopBitCount.One;
_serial_port.DataBits = 8;
dataWriteObject = new DataWriter(_serial_port.OutputStream);
dataReaderObject = new DataReader(_serial_port.InputStream);
dataWriteObject.WriteBytes(0xAA);
await dataWriteObject.StoreAsync();
await dataReaderObject.LoadAsync(1);
byte resp = dataReaderObject.ReadByte();
Here I transmit 1010 1010
and receive xxxx xxxx
from the remote node.
The question.
- Lets say, remote node sends me
1010 1010 1
- Lets say I need send
1010 1010 1
What the code need to looks like?
UPDATE
I think about workaround solutions:
- To use parity bit of the UART. But I actually don't understand, how.
- Use COM -> USB converter, but actually there can be same problems of 9th bit.
- Use Adruino in middle that will implement RxTx 9 bit over GPIO and output data to Raspberry in our inner format.