The loop-back example starting on page 78 of the Beginners E-Book does not work. It hangs up due to the fact that the Read method:
// read the data
read_count = UART.Read(rx_data, 0, rx_data.Length); // data.Length equals 10
is waiting for 7 more bytes after the reception of the three bytes, FEZ". Note that no specific timeout has been established when the SerialPort UART instance is created. Adding the timeout allows a way to exit from this method after only three bytes, “FEZ” of data have been received.
This code can be made to work by either changing
rx_data = new byte to rx_data = new byte;
by adding a UART.ReadTimeout = 10 right after SerialPort UART = new SerialPort(“COM1”, 115200) and then leaving rx_data = new byte as is.
Either way works.