public bool SetupSerialPort(string serialPortName)
{
var result = false;
SerialPort = new SerialPort(serialPortName)
{
//BaudRate = 57600,
BaudRate = 9600,
DataBits = 8,
Parity = Parity.None,
StopBits = StopBits.One
};
if (SerialPort.IsOpen)
{
SerialPort.Close();
}
SerialPort.Open();
SerialPort.DataReceived += SerialPort_DataReceived;
result = true;
return result;
}
private void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
var result = _serialPort.ReadTo(((char)3).ToString(CultureInfo.InvariantCulture));
ProcessData(result);
}
I’m using serial monitoring tool from HHD and the tool is registering the data sent out from my laptop but didn’t see any input from the FEZ Raptor. FEZ Raptor didn’t receive the data sent by my laptop too.
Try registering for the serial events after the serial port is opened. There used to be a problem if the registration was done before the open. I don’t know if it was fixed.
Hi,
I think some more informations are needed:
Gadgeteer application ? RS232 Module used? Button module used? Contents of Program.Started method
Cheers
Roland
The content of program started is already pasted in my first post.
I’m connecting the UART module to PC, i’m suspecting the voltage level being the culprit here. Anyone can help validate?
Saw in this doc - https://www.ghielectronics.com/docs/15/uart
[em]“When we need to interface a processor using UART to a computer’s serial port, we need to convert the UART TTL level to RS232 using some circuitry. For beginners or a quick hack, there are companies who provide ready circuits that convert RS232 to UART.”[/em]
Any help or confirmation that I can’t connect my RS232 module straight to PC? If yes, any adaptor module that i can use?
Hi,
if you have a PC with regular Serial port (RS232) you can directly connect it to the Gadgeteer RS232 Module but you must use a Null-Modem cable (this is a cable where the TX and RX lines are crossed). The RS232 Module already makes the voltage conversion from TTL-Level to RS232 Level.
Sorry, I cannot see the ProgramStarted method in your post.