Main Site Documentation

Serial communication hangs (DataReceived event stops trigger)


#1

To reproduce:

  1. Add event handler to DataReceived event of Serial class

		
_serialPort.Configure(115200, Gadgeteer.Interfaces.Serial.SerialParity.None,
		                       Gadgeteer.Interfaces.Serial.SerialStopBits.One, 8);    
_serialPort.SerialLine.Open();
_serialPort.SerialLine.DataReceived += handleReceivedData;
		
private void handleReceivedData(Gadgeteer.Interfaces.Serial sender, SerialData data)
{
       return;
}
  1. Write 1 byte to serial port from PC side - the handleReceivedData event handler is being triggered on Fez

  2. One more time, write 1 byte to serial port from PC side - the handleReceivedData event handler doesn’t trigger

Successive writing to serial port does not trigger event handler - serial communication hangs. Issue does not reproduce when at least one byte is being read in event handler.

My configuration:
Fez Spider
HalSystemInfo.halVersion: 4.2.0.0
ClrInfo.clrVersion: 4.2.0.0
ClrInfo.targetFrameworkVersion: 4.2.0.0
SolutionReleaseInfo.solutionVersion: 4.2.11.2
SoftwareVersion.BuildDate: Jan 27 2014
SoftwareVersion.CompilerVersion: 410713


#2

Add some code to read the bytes from the buffer inside the handler and it should work on the subsequent bytes.