common:android_things:uart_callback

'ODROID-N2' on this page refers to the ODROID-N2 series (N2, N2+, N2L).

Android Things with Uart Callback

  • ODROID-C4
  • ODROID-N2
  • ODROID-M1
target
gpio readall
target
 +-----+-----+---------+------+---+--- M1 ---+---+------+---------+-----+-----+
 | I/O | wPi |   Name  | Mode | V | Physical | V | Mode |  Name   | wPi | I/O |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3V |      |   |  1 || 2  |   |      | 5V      |     |     |
 | 110 |   8 |    SDA0 | ALT5 | 1 |  3 || 4  |   |      | 5V      |     |     |
 | 109 |   9 |    SCL0 | ALT5 | 1 |  5 || 6  |   |      | 0V      |     |     |
 |  14 |   7 |  IO0_B6 |   IN | 1 |  7 || 8  | 0 | ALT5 | UART.TX | 15  | 126 |
 |     |     |      0V |      |   |  9 || 10 | 0 | ALT5 | UART.RX | 16  | 127 |
 |  16 |   0 |  IO0_C0 |   IN | 0 | 11 || 12 | 0 | IN   | IO3_D0  | 1   | 120 |
 |  17 |   2 |  IO0_C1 |   IN | 0 | 13 || 14 |   |      | 0V      |     |     |
 | 106 |   3 |  IO3_B2 |   IN | 0 | 15 || 16 | 0 | IN   | IO3_C6  | 4   | 118 |
 |     |     |    3.3V |      |   | 17 || 18 | 0 | IN   | IO3_C7  | 5   | 119 |
 |  89 |  12 | SPI.TXD | ALT4 | 1 | 19 || 20 |   |      | 0V      |     |     |
 |  88 |  13 | SPI.RXD | ALT4 | 1 | 21 || 22 | 0 | IN   | IO3_D1  | 6   | 121 |
 |  91 |  14 | SPI.CLK | ALT4 | 0 | 23 || 24 | 1 | ALT4 | SPI.CS0 | 10  | 90  |
 |     |     |      0V |      |   | 25 || 26 | 0 | IN   | IO3_D2  | 11  | 122 |
 |  12 |  30 |    SDA1 |   IN | 1 | 27 || 28 | 1 | IN   | SCL1    | 31  | 11  |
 | 145 |  21 |  IO4_C1 |   IN | 0 | 29 || 30 |   |      | 0V      |     |     |
 | 142 |  22 |  IO4_B6 |   IN | 0 | 31 || 32 | 0 | IN   | IO3_D3  | 26  | 123 |
 |  13 |  23 |  IO0_B5 |   IN | 1 | 33 || 34 |   |      | 0V      |     |     |
 | 125 |  24 |  IO3_D5 |  OUT | 1 | 35 || 36 | 0 | IN   | IO3_D4  | 27  | 124 |
 |     |  25 |    AIN1 |      |   | 37 || 38 |   |      | 1V8     | 28  |     |
 |     |     |      0V |      |   | 39 || 40 |   |      | AIN0    | 29  |     |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | I/O | wPi |   Name  | Mode | V | Physical | V | Mode |  Name   | wPi | I/O |
 +-----+-----+---------+------+---+--- M1 ---+---+------+---------+-----+-----+

All of the available UART pins table

Each board has a different number of UART pin sets. Here's how DTBO settings in config.ini look like if all available UART pins enabled.

Odroid-XU4
UART DTBO Pin header Phy Pin # (RX) Phy Pin # (TX) GPIO Pin # (RX) GPIO Pin # (TX) Device File
UART_0 uart0.dtbo CON10 (2*15 pins) 6 8 171 (GPA0.0) 172 (GPA0.1) /dev/ttySAC0
Shifter Shield 10 8
; Device Tree Overlay
overlay_resize=16384
overlay_profile=
overlays="uart0"
Odroid-N2/N2+
UART DTBO Pin header Phy Pin # (RX) Phy Pin # (TX) GPIO Pin # (RX) GPIO Pin # (TX) Device File
UART_EE_A uart0.dtbo J2 (2*20 pins) 10 8 489 (GPIOX.13) 488 (GPIOX.12) /dev/ttyS1
UART_EE_B uart1.dtbo J2 (2*20 pins) 15 35 483 (GPIOX.7) 482 (GPIOX.6) /dev/ttyS2
; Device Tree Overlay
overlay_resize=16384
overlay_profile=
overlays="uart0 uart1"
Odroid-C4
UART DTBO Pin header Phy Pin # (RX) Phy Pin # (TX) GPIO Pin # (RX) GPIO Pin # (TX) Device File
UART_EE_A uart0.dtbo J2 (2*20 pins) 10 8 489 (GPIOX.13) 488 (GPIOX.12) /dev/ttyS1
UART_EE_B uart1.dtbo J2 (2*20 pins) 15 33 483 (GPIOX.7) 482 (GPIOX.6) /dev/ttyS2
UART_EE_C uart2.dtbo J2 (2*20 pins) 26 32 23 (GPIOH.6) 24 (GPIOH.7) /dev/ttyS3
UART_AO_B uart3.dtbo J7 (1*7 pins) 4 6 505 (GPIOAO.9) 504 (GPIOAO.8) /dev/ttyS4
; Device Tree Overlay
overlay_resize=16384
overlay_profile=
overlays="uart0 uart1 uart2 uart3"
Odroid-M1
UART DTBO Pin header Phy Pin # (RX) Phy Pin # (TX) GPIO Pin # (RX) GPIO Pin # (TX) Device File
UART1_M1 uart0.dtbo J1 (2*20 pins) 10 8 127 (GPIO3 D.BIT7) 126 (GPIO3 D.BIT6) /dev/ttyS0
UART0 uart1.dtbo J1 (2*20 pins) 11 13 16 (GPIO0 C.BIT0) 17 (GPIO0 C.BIT1) /dev/ttyS1
[generic]
overlay_resize=16384
overlay_profile=
overlays="uart0 uart1"

In Odroid-C4, all the serial device files will be listed like,

target
$ ls -al /dev/ttyS?
crw--w---- 1 root tty     239, 0 Apr 26 05:45 /dev/ttyS0
crw-rw---- 1 root dialout 239, 1 Mar 17 21:36 /dev/ttyS1
crw-rw---- 1 root dialout 239, 2 Mar 17 21:36 /dev/ttyS2
crw-rw---- 1 root dialout 239, 3 Mar 17 21:36 /dev/ttyS3
crw-rw---- 1 root dialout 239, 4 Mar 17 21:36 /dev/ttyS4
  • /dev/ttyS0 in Odroid-N2 and Odroid-C4 is the default debugging UART interface.
  • /dev/ttyFIQ0 in ODROID-M1 is the default debugging UART interface.
2021/04/26 15:01 · joshua

Create the Project

Android Studio → Check out project from Version Control → Git → URL: https://github.com/xiane/thingsGpioExample → Clone

Change a branch to the Uart Callback

VCS → Git → Branches → origin/Uart_Callback → Checkout As… → OK

Uploading

After changing the branch to the Uart Callback, connect to the both of ODROID-M1 otg port.\ Click the Run 'app' Button.

  • common/android_things/uart_callback.txt
  • Last modified: 2022/11/08 14:34
  • by luke.go