I have written a C program to test the Edison serial loopback data transmission through Edison uart1.
In the Edison Arduino Board, connect the 0RX with 1TX, pin2 to pin4.
In fact, write is ok, but i cannot success read data from uart1, does anybody know the reason?
The UART pins are the pin 0 for Rx and the pin 1 for Tx. I'm confused because you said that you connected pin 2 to pin 4. Are those the pins you connected? If so, please use the pins 0 and 1 instead. The pins 2 and 4 are not for UART purposes.
First, I connected pin0 (0Rx) to pin1(1TX), but nothing read;
Then I see the hw guide that said the pin2 and pin4 is for flow control, and Uart1 with flow control, so i also connect pin2 to pin4, but it doesn't work yet.
I am no idea of how to use Edison's uart
To be clear - you have Pin 0 connected to Pin 1 AND you have Pin 2 connected to Pin 4?
1. Can you turn off flow control?
2. You say "write is ok" - how are you verifying? Did you put a 'scope on it?
Have you tried with the MRAA example for the UART? You can check it here: https://github.com/intel-iot-devkit/mraa/blob/master/examples/uart.c mraa/uart.c at master · intel-iot-devkit/mraa · GitHub. It should configure the UART to send data.
Additionally, you could test the UART with an Arduino sketch. The SerialEvent code is a good example to test the UART; however you have to change the "Serial" object by "Serial1". This example can be found in the Arduino IDE under File>Examples>Communication>SerialEvent