BananaPro/Pi:UART

From BananaPro/Pi
Jump to: navigation, search

There are UART2 and UART3 on the CON3 of bananaPi, so is UART7 on the J12. This page will tell readers how to use these Uarts.
We will take UART2 and UART3 of the CON3 for example.

1. Use tool bin2fex to decompile script.bin decompile to script.fex.

2. Modify param [uart_para3] in the .fex file.For instance,If we use UART2 or UART7,modify [uart_para2] or [uart_para7].Generally,we
just need to modify the corresponding value of uart_used with:

uart_used = 1

3. Use tool fex2bin to compile script.fex to script.bin.Then substitute script.bin.

4. Insert the modified SD card into the usb port of bananaPi.When system starts,we need to confirm the device note.

cd /sys/bus/platform/devices/sunxi-uart.3/tty
ls

The message will displayed: ttySX, X=1,2,3.. For instance, ttyS3.

5. After confirming the device note, connect the serial line RX,TX with corresponding pin port,i.e CON3-P08(TX) , CON3-P10(RX).

6. Open serial tool,such as putty.The default baud rate is 9600 on bananaPi.So set buad rate as 9600 on the serial tool.Open the serial.

7. Input following command to checkout the serial on the bananaPi.

echo hello > /dev/ttyS3

If it goes well,we can confirm the UART3 is OK.
Then you can use serial correctly in your program.