Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:c2_hardware_uart [2017/01/10 16:11] odroid |
en:c2_hardware_uart [2017/01/31 13:16] (current) brian.kim |
||
---|---|---|---|
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 === | + | ==== Pin Map : UART pin on the 4-pin CON5 connector ==== |
<code> | <code> | ||
_____UART____ | _____UART____ | ||
Line 58: | Line 58: | ||
- | === Another UART port on 40pin header === | + | ==== Another UART port on 40pin header ==== |
- | If you don't use the I2C interface i2c-1 on pin#3 & pin#5, you can use them as UART pins.\\ | + | If you don't use an I2C interface(i2c-1) on pin#3 & pin#5, you can use them to activate the UART2.\\ |
- | Just follow user "campbell"'s development note to have a new UART-2port on /dev/ttyS2.\\ | + | Just follow **campbell**'s development note to have a new UART2 port via /dev/ttyS2.\\ |
- | Note that Pin#3 is Tx and Pin#5 is Rx.\\ | + | Note that Pin#3(SDA1) is mapped to Tx and Pin#5(SCL1) is Rx.\\ |
[[http://forum.odroid.com/viewtopic.php?f=139&t=25371|How to enable a third UART ttyS2 by "campbell"]] | [[http://forum.odroid.com/viewtopic.php?f=139&t=25371|How to enable a third UART ttyS2 by "campbell"]] | ||
- | === 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 75: | Line 75: | ||
[[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]] | ||
+ | ==== How to enable UART_B and UART_C ports ==== | ||
+ | Up to 4 ports can be used for UART in ODROID-C2---UART_A0(Serial console), UART_A, UART_B and UART_C.\\ | ||
+ | There are UART_A, UART_B and UART_C in [[http://odroid.com/dokuwiki/doku.php?id=en:c2_hardware#expansion_connectors|expansion connectors of ODROID-C2]]. | ||
+ | * //<UART pin>// | //<Pin number>// | ||
+ | * UART_A TX | 8 | ||
+ | * UART_A RX | 10 | ||
+ | * UART_B TX | 3 | ||
+ | * UART_B RX | 5 | ||
+ | * UART_C TX | 32 | ||
+ | * UART_C RX | 26 | ||
+ | In order to enable UART_B and UART_C ports, it is necessary to modify the //meson64_odroidc2.dts// file. | ||
+ | |||
+ | 1. Kernel source download | ||
+ | |||
+ | <code> | ||
+ | sudo apt-get update | ||
+ | sudo apt-get install git | ||
+ | git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidc2-3.14.y | ||
+ | </code> | ||
+ | |||
+ | 2. Delete I2C_A definition | ||
+ | |||
+ | I2C_A uses same pins as UART_B by pinmux. So, i2c_a definition needs to be removed. | ||
+ | |||
+ | * //($LINUX)/arch/arm64/boot/dts/meson64_odroidc2.dts// | ||
+ | <code> | ||
+ | iff --git a/arch/arm64/boot/dts/meson64_odroidc2.dts b/arch/arm64/boot/dts/meson64_odroidc2.dts | ||
+ | index e6a25b0..db09b04 100755 | ||
+ | --- a/arch/arm64/boot/dts/meson64_odroidc2.dts | ||
+ | +++ b/arch/arm64/boot/dts/meson64_odroidc2.dts | ||
+ | @@ -813,18 +813,6 @@ | ||
+ | |||
+ | }; | ||
+ | |||
+ | -&i2c_a { | ||
+ | - status = "okay"; | ||
+ | - | ||
+ | - /* Hardkernel I2C RTC */ | ||
+ | - pcf8563: pcf8563@51 { | ||
+ | - status = "disabled"; | ||
+ | - compatible = "nxp,pcf8563"; | ||
+ | - reg = <0x51>; | ||
+ | - #clock-cells = <0>; | ||
+ | - }; | ||
+ | -}; | ||
+ | - | ||
+ | &i2c_b { | ||
+ | status = "okay"; | ||
+ | |||
+ | </code> | ||
+ | |||
+ | 3. Add UART_B and UART_C definitions | ||
+ | * //($LINUX)/arch/arm64/boot/dts/meson64_odroidc2.dts// | ||
+ | <code> | ||
+ | diff --git a/arch/arm64/boot/dts/meson64_odroidc2.dts b/arch/arm64/boot/dts/meson64_odroidc2.dts | ||
+ | index e6a25b0..fd41552 100755 | ||
+ | --- a/arch/arm64/boot/dts/meson64_odroidc2.dts | ||
+ | +++ b/arch/arm64/boot/dts/meson64_odroidc2.dts | ||
+ | @@ -31,6 +31,8 @@ | ||
+ | aliases { | ||
+ | serial0 = &uart_AO; | ||
+ | serial1 = &uart_A; | ||
+ | + serial2 = &uart_B; | ||
+ | + serial3 = &uart_C; | ||
+ | }; | ||
+ | |||
+ | gpu_dvfs_tbl: gpu_dvfs_tbl { | ||
+ | @@ -459,6 +461,32 @@ | ||
+ | pinctrl-0 = <&a_uart_pins>; | ||
+ | }; | ||
+ | |||
+ | + uart_B: serial@c11084dc { | ||
+ | + compatible = "amlogic, meson-uart"; | ||
+ | + reg = <0x0 0xc11084dc 0x0 0x18>; | ||
+ | + interrupts = <0 75 1>; | ||
+ | + status = "okay"; | ||
+ | + clocks = <&clock CLK_XTAL>; | ||
+ | + clock-names = "clk_uart"; | ||
+ | + fifosize = < 64 >; | ||
+ | + pinctrl-names = "default"; | ||
+ | + pinctrl-0 = <&b_uart_pins>; | ||
+ | + resets = <&clock GCLK_IDX_UART1>; | ||
+ | + }; | ||
+ | + | ||
+ | + uart_C: serial@c1108700 { | ||
+ | + compatible = "amlogic, meson-uart"; | ||
+ | + reg = <0x0 0xc1108700 0x0 0x14>; | ||
+ | + interrupts = <0 93 1>; | ||
+ | + status = "okay"; | ||
+ | + clocks = <&clock CLK_XTAL>; | ||
+ | + clock-names = "clk_uart"; | ||
+ | + fifosize = < 64 >; | ||
+ | + pinctrl-names = "default"; | ||
+ | + pinctrl-0 = <&c_uart_pins>; | ||
+ | + resets = <&clock GCLK_IDX_UART2>; | ||
+ | + }; | ||
+ | + | ||
+ | canvas { | ||
+ | compatible = "amlogic, meson, canvas"; | ||
+ | dev_name = "amlogic-canvas"; | ||
+ | </code> | ||
+ | |||
+ | * [[https://gist.githubusercontent.com/bkrepo/ae548109e3f94fd41fed2defa270057b/raw/b50265071e0c4bfe22fcc418aba938bf843bfa8a/meson64_odroidc2.dts|meson64_odroidc2.dts]] | ||
+ | |||
+ | 4. Install modified dtb file | ||
+ | <code> | ||
+ | make odroidc2_defconfig | ||
+ | make dtbs | ||
+ | sudo cp -f arch/arm64/boot/dts/meson64_odroidc2.dtb /media/boot/ | ||
+ | sudo reboot | ||
+ | </code> | ||
+ | 5. Done |