BPI-M2U UART on gpio pins

please see here:

https://bananapi.gitbooks.io/bpi-m2-ultra-open-source-single-board-computer/content/bpi-m2ultragpiopindefine.html

I’ve been there. As i said (and as it is mentioned in that link) i connected to pins 8 and 10. But what next?

  • Documentation (worth the name)
  • vendor support
  • a community around this board
  • (maybe even more)

As you can see from the link (and the answer) @sinovoip provided they simply don’t give a shit about documentation or caring about user problems. The table this person refers to is completely messed up (the columns are wrong/mixed) but they just don’t care (nothing new, we users suffer from this level of ignorance/stupidity since Lemaker doesn’t do documentation/support any more – with Sinovoip we’re lost).

If the information in @sinovoip’s GPIO table is correct (better check schematic!) you would need to disable SPI functionality if it’s enabled (check yourself) and enable uart1 to get /dev/ttyS1. So if it’s really PI18 and PI19 this here https://github.com/BPI-SINOVOIP/BPI-M2U-bsp/blob/420a1ad51515d63306df465b05f91c32b4711528/sunxi-pack/allwinner/azalea-m2ultra/configs/BPI_M2U_1080P/sys_config.fex#L433-L454 needs to be replaced with that

[uart1]
uart1_used       = 1
uart1_port       = 1
uart1_type       = 2
uart1_tx         = port:PI18<2><1><default><default>
uart1_rx         = port:PI19<2><1><default><default>

[uart1_suspend]
uart1_tx         = port:PI18<7><1><default><default>
uart1_rx         = port:PI19<7><1><default><default>

And then you most probably need to recompile their github repository. Went through this shit with their crappy BPi M3 two years ago (also a board that receives ZERO support by vendor with no community around, none of the knowledgeable people is here any more) and won’t do it again.

Good luck!

Can I decompile script.bin to .fex, edit them, compile again and replace in original place? Like described here: http://linux-sunxi.org/How_to_modify_script.bin Or it is not posible on M2U? Where is located script.bin on M2U?

Don’t ask me please, the above procedure is based on what I had to do with the shitty M3 Banana (not even script.bin support so you had to recompile u-boot or something like that) and what I do with my various Orange Pi (same support by vendor as here: ZERO but at least these boards are supported by Armbian and a community unlike M2U)

As you can see clearly by looking through the forums everything that has been released after first Bananas is without any support (no community and Sinovoip doesn’t care, they do not even provide correct information)

@sinovoip: What do you tell your unfortunate customers? How to resolve the issue that you don’t enable the GPIO stuff users need?

There is no script.bin here (at least i can’t find it). So probably Charles is right and You have to recompile whole u-boot.

Is this M2U using still kernel 3.4 or something higher? If it’s at least 3.10 there’s a chance that the fex got translated into device tree so I would look for something with .dtb in its name below /boot/. Maybe you’re lucky and can use dtc tool if you find something like this.

Still it’s a shame @sinovoip doesn’t participate in such basic support situations and even don’t care about documenting this whole mess at all.

I’am try edit .fex in BPI-M2U-bsp/sunxi-pack/allwinner/azalea-m2ultra/configs/BPI_M2U_720P/sys_config.fex


[uart2]
uart2_used = 1
uart2_port = 2
uart2_type = 4
uart2_tx = port:PI18<4><1>
uart2_rx = port:PI19<4><1>
uart2_cts = port:PI17<4><1>
uart2_rts = port:PI16<4><1>

[uart2_suspend]
uart2_tx = port:PI18<7><1>
uart2_rx = port:PI19<7><1>
uart2_rts = port:PI16<7><1>
uart2_cts = port:PI17<7><1>

[uart4]
uart4_used = 1
uart4_port = 4
uart4_type = 2
uart4_tx = port:PH4<4><1>
uart4_rx = port:PH5<4><1>

[uart4_suspend]
uart4_tx = port:PH4<7><1>
uart4_rx = port:PH5<7><1>

and rebuild all following this. Build and boot success, but nothing changes. I’am still not seen /dev/ttyS2 and /dev/ttyS4. Maybe need edit something else?

Try again tar -xvf BPI-BOOT-bpi-m2u.tgz -C /boot (previous I may fogot do that) - something changes.
Before:

root@bpi:~# cat /var/log/syslog | grep tty
Jun 8 15:04:26 bpi kernel: [ 0.000000] Kernel command line: enforcing=1 initcall_debug=0 console=ttyS0,115200n8 console=tty1 no_console_suspend board=bpi-m2u loglevel=4 root=/dev/mmcblk0p2 rw rootwait init=/init cma=256M panic=10 consoleblank=0 bootmenutimeout=10 datadev=mmcblk0p2 androidboot.serialno=1410503703105806068e
Jun 8 15:04:26 bpi kernel: [ 0.000000] console [tty1] enabled
Jun 8 15:04:26 bpi systemd[1]: Created slice system-getty.slice.
Jun 8 15:04:26 bpi kernel: [ 1.311331] uart0: ttyS0 at MMIO 0x1c28000 (irq = 33) is a SUNXI
Jun 8 15:04:26 bpi kernel: [ 1.377385] console [ttyS0] enabled
Jun 8 15:04:26 bpi kernel: [ 1.378189] uart3: ttyS3 at MMIO 0x1c28c00 (irq = 36) is a SUNXI
Jun 8 15:04:32 bpi systemd[1]: Started Getty on tty1.
Jun 8 15:04:32 bpi systemd[1]: Started Serial Getty on ttyS0.
Jun 8 15:05:31 bpi bpi-init[2389]: hciattach /dev/ttyS3 any

After:

root@bpi:~# cat /var/log/syslog | grep tty
Jun 8 16:04:19 bpi kernel: [ 0.000000] Kernel command line: enforcing=1 initcall_debug=0 console=ttyS0,115200n8 console=tty1 no_console_suspend board=bpi-m2u loglevel=4 root=/dev/mmcblk0p2 rw rootwait init=/init cma=256M panic=10 consoleblank=0 bootmenutimeout=10 datadev=mmcblk0p2 androidboot.serialno=1410503703105806068e
Jun 8 16:04:19 bpi systemd[1]: Found device /dev/ttyS0.
Jun 8 16:04:19 bpi kernel: [ 0.000000] console [tty1] enabled
Jun 8 16:04:19 bpi systemd[1]: Created slice system-getty.slice.
Jun 8 16:04:19 bpi kernel: [ 1.311109] uart0: ttyS0 at MMIO 0x1c28000 (irq = 33) is a SUNXI
Jun 8 16:04:19 bpi kernel: [ 1.377180] console [ttyS0] enabled
Jun 8 16:04:19 bpi kernel: [ 1.377978] uart3: ttyS3 at MMIO 0x1c28c00 (irq = 36) is a SUNXI
Jun 8 16:04:25 bpi systemd[1]: Started Serial Getty on ttyS0.
Jun 8 16:04:25 bpi systemd[1]: Started Getty on tty1.
Jun 8 16:05:25 bpi bpi-init[2388]: port /dev/ttyS1 could not be opened, error 2
Jun 8 16:06:30 bpi bpi-init[2388]: hciattach /dev/ttyS3 any

Now in /dev i see that:

root@bpi:~# ls -al /dev/
crw–w---- 1 root tty 250, 0 июн 8 16:04 ttyS0
-rw-r–r-- 1 root root 60 июн 8 16:06 ttyS1
crw-rw---- 1 root dialout 250, 3 июн 8 16:05 ttyS3

3.10.65-BPI-M2U-Kernel. And indeed i can see few *.dtb and over 100 *.dtbo in “overlays” folder.

*.dtbo sound wrong (Raspberry Pi), ahhhh IIRC the /boot/ partition is completely filled with junk for all other Bananas and even Raspberries to make it harder identifying which files are involved when booting. Sorry, can’t help further (enough time wasted already doing @sinovoip’s job – isn’t it funny how ‘much’ help users get here? :joy:)

Thank You anyway. It is true that @sinovoip is not much help here :frowning: I realy wanted to have sata capable SBC but it looks like that real jobs must be done by something like Raspberry Pi. BPI will stay only as cheap nas.

Uart4 & uart5 on GPIO works fine! Just edit
BPI-M2U-bsp/sunxi-pack/allwinner/azalea-m2ultra/configs/default/sys_config.fex
instead
BPI-M2U-bsp/sunxi-pack/allwinner/azalea-m2ultra/configs/BPI_M2U_720P/sys_config.fex

[uart4]
uart4_used = 1
uart4_port = 4
uart4_type = 2
uart4_tx = port:PH04<4><1>
uart4_rx = port:PH05<4><1>

[uart4_suspend]
uart4_tx = port:PH04<7><1>
uart4_rx = port:PH05<7><1>

[uart5]
uart5_used = 1
uart5_port = 5
uart5_type = 2
uart5_tx = port:PH06<4><1>
uart5_rx = port:PH07<4><1>

[uart5_suspend]
uart5_tx = port:PH06<3><1>
uart5_rx = port:PH07<3><1>

I’am still can’t run uart2 I try specify ports PG06-09 as in original sys_config.fex and PI16-19 as it described in manual. Now I see that in syslog:

Jun 9 11:36:57 bpi kernel: [ 1.311056] uart0: ttyS0 at MMIO 0x1c28000 (irq = 33) is a SUNXI
Jun 9 11:36:57 bpi kernel: [ 1.311072] sw_uart_pm()959 - uart0 clk is already enable
Jun 9 11:36:57 bpi kernel: [ 1.452300] sw_uart_request_gpio()818 - UART2 devm_pinctrl_get() failed! return -22
Jun 9 11:36:57 bpi kernel: [ 1.452312] uart2: ttyS2 at MMIO 0x1c28800 (irq = 35) is a SUNXI
Jun 9 11:36:57 bpi kernel: [ 1.453050] uart3: ttyS3 at MMIO 0x1c28c00 (irq = 36) is a SUNXI
Jun 9 11:36:57 bpi kernel: [ 1.453621] uart4: ttyS4 at MMIO 0x1c29000 (irq = 49) is a SUNXI
Jun 9 11:36:57 bpi kernel: [ 1.454187] uart5: ttyS5 at MMIO 0x1c29400 (irq = 50) is a SUNXI

In schematic you can see two uart2 ports. :confused:

One UART is all I need, so i am going to try Your method to get uart4 or uart5. Hope it works.

It’s alive! It’s alive!
All UARTs 2,4,5,7 located on GPIO header works perfect!


[uart2]
uart2_used = 1
uart2_port = 2
uart2_type = 4
uart2_tx = port:PI18<3><1>
uart2_rx = port:PI19<3><1>
uart2_rts = port:PI16<3><1>
uart2_cts = port:PI17<3><1>

[uart2_suspend]
uart2_tx = port:PI18<7><1>
uart2_rx = port:PI19<7><1>
uart2_rts = port:PI16<7><1>
uart2_cts = port:PI17<7><1>

[uart4]
uart4_used = 1
uart4_port = 4
uart4_type = 2
uart4_tx = port:PH04<4><1>
uart4_rx = port:PH05<4><1>

[uart4_suspend]
uart4_tx = port:PH04<7><1>
uart4_rx = port:PH05<7><1>

[uart5]
uart5_used = 1
uart5_port = 5
uart5_type = 2
uart5_tx = port:PH06<4><1>
uart5_rx = port:PH07<4><1>

[uart5_suspend]
uart5_tx = port:PH06<3><1>
uart5_rx = port:PH07<3><1>

[uart7]
uart7_used = 1
uart7_port = 7
uart7_type = 2
uart7_tx = port:PI20<3><1>
uart7_rx = port:PI21<3><1>

[uart7_suspend]
uart7_tx = port:PI20<7><1>
uart7_rx = port:PI21<7><1>

Good luck!

Hello,

How did /dev/ttyS2 come up for you? I’ve done all the steps mentioned here, but still have only S0, S1 and S3. Of course, none of the are on the GPIOs. Maybe I miss something, but some help could come really handy.

Thanks, Cheers

Hi, there,

I got it work by editing the sys_config in the BPI_M2U_1080P directory.

Cheers!

I am using this image Banana pi BPI-M2 Ultra/BPI-M2 Berry new image :2017-05-25-ubuntu-16.04-mate-desktop-preview2-bpi-m2u-sd-emmc.img and /boot there looks very different than yours. And with new compiled version it does not boot. So or there is other method to this image or i would have to change image.

Just a note. I’ve compiled BOOTLOADER and BPI-BOOT for Raspbian (kernel 3.10.107). UART2,UART4, UART5 work well. I’ve used Ubuntu 16.04 for cross compilation.

Does anyone work for UART1 and UART6? How to edit sys_config.fex? I see with ls /dev/tty* /dev/ttyS3, but I don’t know where to find UART3 on GPIO pins?