Enabling UART2
#1
UPDATE: Solved.

uart2 is the Devil.  Long live uart3.  Enabled ias overlay on /dev/ttyS3 and Pi2 Bus Pins 37 and 36 (which differ between models)



I'm trying to adapt an Elelab Zigbee Shield( https://elelabs.com/products/elelabs-zigbee-shield.html) for use on a H64b but I'm finding it very difficult given the "Pi2" GPIO block is not actually compatible with pi shields.  The device works on simple (and universal) serial connection@115200 baud.  It should be trivial to get working and I can't figure out why .

So where I'm at with the h64b:
uname -a:
Code:
Linux ServerName 5.8.16-sunxi64 #20.08.16 SMP Sat Oct 24 23:52:46 CEST 2020 aarch64 GNU/Linux


According to schematics, there 5 system UART.  One of which is the console (uart0)
  • uart0 is the bitch of uboot and then getty.
  • uart1 is attached to pins on the wifi
  • uart2 is attached to the GPIO as the second function of pins 8 and 10
  • uart3 is, maybe, attached to GPIO mysteriously at pins 38 and 37
  • uart4 is a mysterious unicorn that is no longer enabled in many linux flavours.
Enabling uart2 causes the system to hang on reboot.  I don't have a 3.3v serial USB dongle so I can't currently read off uart0 at boot to see what's going on Sad I'd prefer to use this end of the GPIO but I'd go anywhere on the board to make this work.

Only uart2 and uart3 are suitable for my use case.  I've used device tree overlays to enable uart1 and uart3, but there is no README for the H6 in the /boot/dtb/allwinner/overlays/ folder like there is for the A64 and H5 chips so I'm flying a little blind.

Originally, while still targeting uart2, I decompiled the dtb and tore it apart in a couple different ways (removing all other uarts, rearranging serial@, pnctrl, etc) but I was never able to enable by overlay uart2 without hanging the system.

enabling uart3 works according to dmesg | grep serial:
Code:
[    2.243978] sun50i-h6-pinctrl 300b000.pinctrl: pin-198 (5000400.serial) status -517
[    2.244013] dw-apb-uart 5000400.serial: Error applying setting, reverse things back
[    2.244292] sun50i-h6-pinctrl 300b000.pinctrl: pin-119 (5000c00.serial) status -517
[    2.244328] dw-apb-uart 5000c00.serial: Error applying setting, reverse things back
[    2.246801] sun50i-h6-pinctrl 300b000.pinctrl: pin-198 (5000400.serial) status -517
[    2.246837] dw-apb-uart 5000400.serial: Error applying setting, reverse things back
[    2.247109] sun50i-h6-pinctrl 300b000.pinctrl: pin-119 (5000c00.serial) status -517
[    2.247145] dw-apb-uart 5000c00.serial: Error applying setting, reverse things back
[    2.647327] sun50i-h6-pinctrl 300b000.pinctrl: pin-198 (5000400.serial) status -517
[    2.647364] dw-apb-uart 5000400.serial: Error applying setting, reverse things back
[    2.647856] sun50i-h6-pinctrl 300b000.pinctrl: pin-119 (5000c00.serial) status -517
[    2.647893] dw-apb-uart 5000c00.serial: Error applying setting, reverse things back
[    2.704724] 5000400.serial: ttyS1 at MMIO 0x5000400 (irq = 26, base_baud = 1500000) is a 16550A
[    2.706044] 5000c00.serial: ttyS3 at MMIO 0x5000c00 (irq = 27, base_baud = 1500000) is a 16550A


Ok, I'm targeting my final option, uart3.  I've got the shield hooked to the 3v, Tx->RX(Pin 38), rx->TX(Pin 37), GND->GND(Pin 39).  But nothing!

Just before I threw up my hands in defeat last night, I came across the post for the similar issues with a z-wave shield on the A64+ (https://forum.pine64.org/showthread.php?...3#pid20643).  Their diagram: http://i0.wp.com/blog.etiennebretteville...otique.jpg indicates 100k resistors.  Do those pull the the pins high, serving UART instead of it's primary function?

Can someone explain how I can get this device to talk to uart3 or, preferably, how to do the same on uart2 without the system hanging?

Cheers,
R.
#2
(11-10-2020, 01:06 PM)Trying to use pi gpio rs-485 can hat rock won’t boot how did you make your change? Wrote: UPDATE: Solved.

uart2 is the Devil.  Long live uart3.  Enabled ias overlay on /dev/ttyS3 and Pi2 Bus Pins 37 and 36 (which differ between models)



I'm trying to adapt an Elelab Zigbee Shield( https://elelabs.com/products/elelabs-zigbee-shield.html) for use on a H64b but I'm finding it very difficult given the "Pi2" GPIO block is not actually compatible with pi shields.  The device works on simple (and universal) serial connection@115200 baud.  It should be trivial to get working and I can't figure out why .

So where I'm at with the h64b:
uname -a:
Code:
Linux ServerName 5.8.16-sunxi64 #20.08.16 SMP Sat Oct 24 23:52:46 CEST 2020 aarch64 GNU/Linux


According to schematics, there 5 system UART.  One of which is the console (uart0)
  • uart0 is the bitch of uboot and then getty.
  • uart1 is attached to pins on the wifi
  • uart2 is attached to the GPIO as the second function of pins 8 and 10
  • uart3 is, maybe, attached to GPIO mysteriously at pins 38 and 37
  • uart4 is a mysterious unicorn that is no longer enabled in many linux flavours.
Enabling uart2 causes the system to hang on reboot.  I don't have a 3.3v serial USB dongle so I can't currently read off uart0 at boot to see what's going on Sad I'd prefer to use this end of the GPIO but I'd go anywhere on the board to make this work.

Only uart2 and uart3 are suitable for my use case.  I've used device tree overlays to enable uart1 and uart3, but there is no README for the H6 in the /boot/dtb/allwinner/overlays/ folder like there is for the A64 and H5 chips so I'm flying a little blind.

Originally, while still targeting uart2, I decompiled the dtb and tore it apart in a couple different ways (removing all other uarts, rearranging serial@, pnctrl, etc) but I was never able to enable by overlay uart2 without hanging the system.

enabling uart3 works according to dmesg | grep serial:
Code:
[    2.243978] sun50i-h6-pinctrl 300b000.pinctrl: pin-198 (5000400.serial) status -517
[    2.244013] dw-apb-uart 5000400.serial: Error applying setting, reverse things back
[    2.244292] sun50i-h6-pinctrl 300b000.pinctrl: pin-119 (5000c00.serial) status -517
[    2.244328] dw-apb-uart 5000c00.serial: Error applying setting, reverse things back
[    2.246801] sun50i-h6-pinctrl 300b000.pinctrl: pin-198 (5000400.serial) status -517
[    2.246837] dw-apb-uart 5000400.serial: Error applying setting, reverse things back
[    2.247109] sun50i-h6-pinctrl 300b000.pinctrl: pin-119 (5000c00.serial) status -517
[    2.247145] dw-apb-uart 5000c00.serial: Error applying setting, reverse things back
[    2.647327] sun50i-h6-pinctrl 300b000.pinctrl: pin-198 (5000400.serial) status -517
[    2.647364] dw-apb-uart 5000400.serial: Error applying setting, reverse things back
[    2.647856] sun50i-h6-pinctrl 300b000.pinctrl: pin-119 (5000c00.serial) status -517
[    2.647893] dw-apb-uart 5000c00.serial: Error applying setting, reverse things back
[    2.704724] 5000400.serial: ttyS1 at MMIO 0x5000400 (irq = 26, base_baud = 1500000) is a 16550A
[    2.706044] 5000c00.serial: ttyS3 at MMIO 0x5000c00 (irq = 27, base_baud = 1500000) is a 16550A


Ok, I'm targeting my final option, uart3.  I've got the shield hooked to the 3v, Tx->RX(Pin 38), rx->TX(Pin 37), GND->GND(Pin 39).  But nothing!

Just before I threw up my hands in defeat last night, I came across the post for the similar issues with a z-wave shield on the A64+ (https://forum.pine64.org/showthread.php?...3#pid20643).  Their diagram: http://i0.wp.com/blog.etiennebretteville...otique.jpg indicates 100k resistors.  Do those pull the the pins high, serving UART instead of it's primary function?

Can someone explain how I can get this device to talk to uart3 or, preferably, how to do the same on uart2 without the system hanging?

Cheers,
R.
#3
Hardware: Pine H64 Model B
Hat: Elelabs Zigbee Raspberry Pi Shield


Step 1. Software
  • Started from fresh, simple, Armbian (by way of DietPi) install.
  • Disabled uart serial consoles with armbian-config/dietpi-config. (Or not, I re-enabled and used it later.)
  • Add:
    Code:
    overlays=uart3
    to /boot/armbianEnv.txt
  • Reboot
  • confirm device creation with
    Code:
    dmesg | grep tty
  • Output should be close to: [    3.819251] 5000c00.serial: ttyS3 at MMIO 0x5000c00 (irq = 26, base_baud = 1500000) is a 16550A
  • If you aren't sure peripheral is working use uart0 as a loop back source by connecting uart0TX(EXT Pin 1) to uart3RX( Pin 36), and uart0RX(EXT3) to uart3Tx(pin 37).  You can then use "screen /dev/ttyS3 baudrate" to read input
Step 2. Hardware
  • Identify adapter pins
                 ________
                 |  |  |  |3|2|
    Pin 1-->|1|  |  |  |4|
Adapter <---> UART3 Pins:
1 VCC <---> 3v3 - Pin 1
2 TXD <---> uart3 RX - Pin 36
3 RXD <---> uart3 TX - Pin 37
4 GND <---> GND - pin 39


Step 3. Reverse TX and RX that you hooked up backwards despite checking 3 times. Wink

Step 4.... Profit!

Reference:
https://wiki.pine64.org/wiki/PINE_H64

Files:
https://files.pine64.org/doc/Pine%20H64/...ematic.pdf  - NOTE - pin assignments differ from my particular model B
https://files.pine64.org/doc/Pine%20H64/...rev2.0.pdf - NOTE - These assignments DO reflect my Model B but I don't even know where this file came from anymore.


Forum Jump:


Users browsing this thread: 1 Guest(s)