Kwan Xian Posted December 4, 2018 Share Posted December 4, 2018 Hello guys! I'm beginner of Armbian. The problem is: Install Armbian Stretch mainline kernel 4.14.y on my device(Orange_Pi_PC),But I don't know how to enable UART1 . I tried to select UART1 & UART2 & UART3 on armbian-config,now i can see 'overlays=uart1 uart2 uart3' in /boot/armbianEnv.txt Connect serial device with P40(RX) P39(GND) P38(TX) . when i check serial device on ssh, i can see this info: uname -a Linux orangepipc 4.14.84-sunxi #3 SMP Sat Dec 1 07:18:41 CET 2018 armv7l GNU/Linux ls -l /dev/ttyS* crw--w---- 1 root tty 4, 64 Dec 4 20:24 /dev/ttyS0 crw-rw---- 1 root dialout 4, 65 Dec 4 20:36 /dev/ttyS1 crw-rw---- 1 root dialout 4, 66 Dec 4 21:08 /dev/ttyS2 crw-rw---- 1 root dialout 4, 67 Dec 4 20:33 /dev/ttyS3 crw-rw---- 1 root dialout 4, 68 Dec 4 20:24 /dev/ttyS4 crw-rw---- 1 root dialout 4, 69 Dec 4 20:24 /dev/ttyS5 crw-rw---- 1 root dialout 4, 70 Dec 4 20:24 /dev/ttyS6 crw-rw---- 1 root dialout 4, 71 Dec 4 20:24 /dev/ttyS7 dmesg | grep tty [ 0.000000] Kernel command line: root=UUID=3d863bb3-b616-4229-94e7-8c92ac95501a rootwait rootfstype=ext4 console=tty1 console=ttyS0,115200 hdmi.audio=EDID:0 disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 loglevel=1 ubootpart=c0dd9a77-01 ubootsource=mmc usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_fb_mem_reserve=16 cgroup_enable=memory swapaccount=1 [ 0.000198] console [tty1] enabled [ 1.796248] console [ttyS0] disabled [ 1.816398] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 42, base_baud = 1500000) is a U6_16550A [ 1.816450] console [ttyS0] enabled [ 1.839525] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 43, base_baud = 1500000) is a U6_16550A [ 1.862474] 1c28800.serial: ttyS2 at MMIO 0x1c28800 (irq = 44, base_baud = 1500000) is a U6_16550A [ 1.885408] 1c28c00.serial: ttyS3 at MMIO 0x1c28c00 (irq = 45, base_baud = 1500000) is a U6_16550A [ 4.746240] systemd[1]: Created slice system-getty.slice. setserial -g /dev/ttyS* /dev/ttyS0: Permission denied /dev/ttyS1, UART: undefined, Port: 0x0000, IRQ: 43 /dev/ttyS2, UART: undefined, Port: 0x0000, IRQ: 44 /dev/ttyS3, UART: undefined, Port: 0x0000, IRQ: 45 /dev/ttyS4, UART: unknown, Port: 0x0000, IRQ: 0 /dev/ttyS5, UART: unknown, Port: 0x0000, IRQ: 0 /dev/ttyS6, UART: unknown, Port: 0x0000, IRQ: 0 /dev/ttyS7, UART: unknown, Port: 0x0000, IRQ: 0 When I saw this doc: https://docs.armbian.com/Hardware_Allwinner/ but there is no bin file in /boot: ls /boot armbianEnv.txt boot.scr initrd.img-4.14.84-sunxi vmlinuz-4.14.84-sunxi armbian_first_run.txt.template config-4.14.84-sunxi overlay-user zImage boot.bmp dtb System.map-4.14.84-sunxi boot.cmd dtb-4.14.84-sunxi uInitrd boot-desktop.png dtb.old uInitrd-4.14.84-sunxi I tried to use UART1 with Python3: #!/usr/bin/python #-*-coding:utf-8-*- import serial my_printer = serial.Serial('/dev/ttyS1',9600,timeout=1) if my_printer.isOpen(): pass else: my_printer.open() my_printer.write(b'\x1b\x40\x12\x54') but it doesn't work. BTW: serial device can work on Windows. Link to comment Share on other sites More sharing options...
martinayotte Posted December 4, 2018 Share Posted December 4, 2018 1 hour ago, Kwan Xian said: [ 1.839525] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 43, base_baud = 1500000) is a U6_16550A [ 1.862474] 1c28800.serial: ttyS2 at MMIO 0x1c28800 (irq = 44, base_baud = 1500000) is a U6_16550A [ 1.885408] 1c28c00.serial: ttyS3 at MMIO 0x1c28c00 (irq = 45, base_baud = 1500000) is a U6_16550A It seems that overlays did their job ... Are you sure of your wiring ? Maybe you can check by doing a loopback wire between pins 38/40 and do "picocom -b 9600 /dev/ttyS1", then every thing you type will be echoed back. Link to comment Share on other sites More sharing options...
Kwan Xian Posted December 4, 2018 Author Share Posted December 4, 2018 47 minutes ago, martinayotte said: It seems that overlays did their job ... Are you sure of your wiring ? Maybe you can check by doing a loopback wire between pins 38/40 and do "picocom -b 9600 /dev/ttyS1", then every thing you type will be echoed back. Thank you! It works. I need to check my code between windows & Linux. Link to comment Share on other sites More sharing options...
Kwan Xian Posted December 4, 2018 Author Share Posted December 4, 2018 50 minutes ago, martinayotte said: It seems that overlays did their job ... Are you sure of your wiring ? Maybe you can check by doing a loopback wire between pins 38/40 and do "picocom -b 9600 /dev/ttyS1", then every thing you type will be echoed back. Is't the same way to enable SPI0? Link to comment Share on other sites More sharing options...
martinayotte Posted December 4, 2018 Share Posted December 4, 2018 4 minutes ago, Kwan Xian said: Is't the same way to enable SPI0? A bit, yes ! look at the overlay doc : ### spi-spidev Activates SPIdev device node (/dev/spidevX.Y) for userspace SPI access, where X is the bus number and Y is the CS number SPI 0 pins (MOSI, MISO, SCK, CS): PC0, PC1, PC2, PC3 SPI 1 pins (MOSI, MISO, SCK, CS): PA15, PA16, PA14, PA13 Parameters: param_spidev_spi_bus (int) SPI bus to activate SPIdev support on Required Supported values: 0, 1 param_spidev_spi_cs (int) SPI chip select number Optional Default: 0 Supported values: 0, 1 Using chip select 1 requires using "spi-add-cs1" overlay param_spidev_max_freq (int) Maximum SPIdev frequency Optional Default: 1000000 Range: 3000 - 100000000 Link to comment Share on other sites More sharing options...
Kwan Xian Posted December 4, 2018 Author Share Posted December 4, 2018 4 minutes ago, martinayotte said: A bit, yes ! look at the overlay doc : ### spi-spidev Activates SPIdev device node (/dev/spidevX.Y) for userspace SPI access, where X is the bus number and Y is the CS number SPI 0 pins (MOSI, MISO, SCK, CS): PC0, PC1, PC2, PC3 SPI 1 pins (MOSI, MISO, SCK, CS): PA15, PA16, PA14, PA13 Parameters: param_spidev_spi_bus (int) SPI bus to activate SPIdev support on Required Supported values: 0, 1 param_spidev_spi_cs (int) SPI chip select number Optional Default: 0 Supported values: 0, 1 Using chip select 1 requires using "spi-add-cs1" overlay param_spidev_max_freq (int) Maximum SPIdev frequency Optional Default: 1000000 Range: 3000 - 100000000 Thank you sooooo much! That's verrrrrry help for me. Link to comment Share on other sites More sharing options...
Recommended Posts