Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:c1_hardware_uart [2016/11/13 18:37] odroid |
en:c1_hardware_uart [2016/11/14 17:19] (current) odroid [How to use enable another UART /dev/ttyS1 on 40 Pin Header] |
||
---|---|---|---|
Line 7: | Line 7: | ||
The second one is mapped to /dev/ttyS0 which is connected to Serial Console Port CON5. | The second one is mapped to /dev/ttyS0 which is connected to Serial Console Port CON5. | ||
- | === How to test external UART pin on the 40-pin header === | + | ==== How to test external UART pin on the 40-pin header ==== |
You need to prepare below items. | You need to prepare below items. | ||
Line 44: | Line 44: | ||
Send characters via minicom. | Send characters via minicom. | ||
- | === Pin Map : UART pin on the 4-pin CON5 connector === | + | ==== How to enable another UART /dev/ttyS1 on 40 Pin Header ==== |
+ | === Pin Map : GPIOX.4[29, TXD], GPIOX.5[18, RXD] === | ||
+ | |||
+ | <WRAP center round important 100%> | ||
+ | To use the UART(/dev/ttyS1), you first need to update the kernel version to "3.10.104" or higher. | ||
+ | sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade | ||
+ | </WRAP> | ||
+ | |||
+ | 1. Install the device-tree compiler package | ||
+ | <code> | ||
+ | sudo apt-get install device-tree-compiler | ||
+ | </code> | ||
+ | |||
+ | 2. Download dts file from our github. | ||
+ | <code> | ||
+ | wget https://github.com/hardkernel/linux/raw/odroidc-3.10.y/arch/arm/boot/dts/meson8b_odroidc.dts | ||
+ | </code> | ||
+ | |||
+ | 3. Edit dts file. | ||
+ | <code> | ||
+ | vi meson8b_odroidc.dts | ||
+ | </code> | ||
+ | |||
+ | 4. find uart_ao & add uart_0 definition. | ||
+ | <code> | ||
+ | ... | ||
+ | uart_ao{ | ||
+ | compatible = "amlogic,aml_uart"; | ||
+ | port_name = "uart_ao"; | ||
+ | status = "okay"; | ||
+ | dev_name = "uart_ao"; | ||
+ | pinctrl-names = "default"; | ||
+ | pinctrl-0 = <&ao_uart_pins>; | ||
+ | }; | ||
+ | |||
+ | /* edit & add code */ | ||
+ | uart_0{ | ||
+ | compatible = "amlogic,aml_uart"; | ||
+ | port_name = "uart_a"; | ||
+ | status = "okay"; | ||
+ | dev_name = "uart_0"; | ||
+ | pinctrl-names = "default"; | ||
+ | pinctrl-0 = <&a_uart_pins>; | ||
+ | }; | ||
+ | /* end add */ | ||
+ | |||
+ | uart_1{ | ||
+ | compatible = "amlogic,aml_uart"; | ||
+ | port_name = "uart_b"; | ||
+ | status = "okay"; | ||
+ | dev_name = "uart_1"; | ||
+ | pinctrl-names = "default"; | ||
+ | pinctrl-0 = <&b_uart_pins>; | ||
+ | }; | ||
+ | ... | ||
+ | </code> | ||
+ | |||
+ | 5. find pinmux & add uart_0 pin mux. | ||
+ | <code> | ||
+ | ... | ||
+ | ao_uart_pins:ao_uart{ | ||
+ | amlogic,setmask=<10 0x1800>; | ||
+ | amlogic,pins="GPIOAO_0", "GPIOAO_1"; | ||
+ | amlogic,pullup=<1>; | ||
+ | amlogic,pullupen=<1>; | ||
+ | }; | ||
+ | |||
+ | /* edit & add code */ | ||
+ | a_uart_pins:a_uart{ | ||
+ | amlogic,setmask=<4 0x30000>; | ||
+ | amlogic,pins="GPIOX_4", "GPIOX_5"; | ||
+ | amlogic,pullup=<1>; | ||
+ | amlogic,pullupen=<1>; | ||
+ | }; | ||
+ | /* end add */ | ||
+ | |||
+ | b_uart_pins:b_uart{ | ||
+ | amlogic,setmask=<4 0x0300>; | ||
+ | amlogic,pins="GPIOX_16", "GPIOX_17"; | ||
+ | amlogic,pullup=<1>; | ||
+ | amlogic,pullupen=<1>; | ||
+ | }; | ||
+ | ... | ||
+ | </code> | ||
+ | |||
+ | 6. save dts file & compile dts file | ||
+ | <code> | ||
+ | dtc -O dtb -o ./meson8b_odroidc.dtb ./meson8b_odroidc.dts | ||
+ | </code> | ||
+ | |||
+ | 7. update dtb file & reboot | ||
+ | <code> | ||
+ | sudo cp ./meson8b_odroidc.dtb /media/boot/meson8b_odroidc.dtb && sync | ||
+ | sudo reboot | ||
+ | </code> | ||
+ | |||
+ | ==== Pin Map : UART pin on the 4-pin CON5 connector ==== | ||
<code> | <code> | ||
_____UART____ | _____UART____ | ||
Line 57: | Line 153: | ||
3.3V LVTTL | 3.3V LVTTL | ||
- | === Automatically configure the UART settings. === | + | ==== Automatically configure the UART settings. ==== |
This is an example of default setting for a GPS module which has a 9600bpsN81 UART interface.\\ | This is an example of default setting for a GPS module which has a 9600bpsN81 UART interface.\\ | ||
Add the following to the end of /etc/rc.local (before the exit 0)\\ | Add the following to the end of /etc/rc.local (before the exit 0)\\ | ||
Line 63: | Line 159: | ||
This way the tty port is setup for use with the gps on system boot, without user interaction.\\ | This way the tty port is setup for use with the gps on system boot, without user interaction.\\ | ||
\\ | \\ | ||
- | === Tips for UART port === | + | ==== Tips for UART port ==== |
[[http://forum.odroid.com/viewtopic.php?f=115&t=17279|How to enable the RTS/CTS]] | [[http://forum.odroid.com/viewtopic.php?f=115&t=17279|How to enable the RTS/CTS]] |