Chris,
I got my cable today (TTL-232R-3V3-WE), but I'm not succeeding in sending data over the wire. Can you help me verify if I'm doing everything correct?
According to the datasheet, http://www.ftdichip....232R_CABLES.pdf, GND is black, TX is Orange and RX is yellow. So I've hooked up Orange to D0 and Yellow to D1 of the ShieldBase
As for code:
In my netduino project I do the following:
var shieldbase = new ShieldBase(GoSockets.Socket7);
var serialPort = new SerialPort(SerialPorts.COM1, 9600, Parity.None, 8, StopBits.One);
serialPort.DataReceived += DataReceivedHandler;
var threadWorker = new Thread(DoWork);
threadWorker.Start();
serialPort.Open();
Thread.Sleep(Timeout.Infinite);
And on the background thread I'm sending data all the time
var buffer = BitConverter.GetBytes(value);
serialPort.Write(buffer, 0, buffer.Length);
serialPort.Flush();
It's seems to operate (no exceptions at least when running)
On the computer I have a console app running, that listens to the USB COM port, which is on COM5 according to device manager
var port = new SerialPort("COM5", 9600, Parity.None, 8, StopBits.One);
port.DataReceived += PortOnDataReceived;
port.Open();
When data is received, the following happens
private static void PortOnDataReceived(object sender, SerialDataReceivedEventArgs serialDataReceivedEventArgs)
{
var port = (SerialPort) sender;
var buffer = new byte[4];
port.Read(buffer, 0, buffer.Length);
int i = BitConverter.ToInt32(buffer, 0);
Console.WriteLine(i);
}
The console app also starts fine...
But nothing happens when netduino performs a write, any ideas on what I'm doing wrong?
PS: I tried switching orange and yellow as well, and tried sending from console to netduino... all with same result, no exceptions but no data exchange either.
Kind regards,
Yves