BPI-M2 Zero Standard Serial Communication

Hello everyone! Happy to be here - spent some time reading a bit on the forum earlier today, glad to see there are some people out there that use this platform.

Hopefully, this hasn’t been asked before - if it has, I apologize in advance. In short, I am moving a project that’s been running on a Raspberry Pi 3, and then a Raspberry Pi Zero, over to the Banana Pi-M2 Zero platform and ran into a communication issue right out of the gate.The current hardware I have connects to UART 0 on pins 8 and 10 of the Raspberry Pi, which work with a standard MAX232 type of chip to communicate with a standard RS232 serial port. My hope was that I would be able to do the same thing with the Banana Pi, but I have not as of yet been able to get this to work. I did make sure that “Login shell accessible over serial” is turned on, but obviously no help.

By the way, the image I am using is named 2020-04-10-raspbian-jessie-ap6212-bpi-m2z-sd-emmc. I thought this was the most recent one, but it looks like there’s another one available. I’m also assuming that the default parameters of 115,200/8/N/1 are correct.

I’ve also tried moving my MAX232 over to UART 1 (pins 11 and 13, I believe) just to test; I believed I read something by frank-w that talked about some confusion between the two UARTs so I thought it was worth a try. This did not work either. I have not tried any further debugging (i.e., checking pin voltages for 3.3V, oscilloscope, etc.) as I think this is probably something simple.

Looking forward to any help anyone might be able to provide - any questions, feel free to ask.

Thanks in advance, Marshall

… and plus years of work https://www.armbian.com/bananapi-m2-zero/

Good afternoon,

Not sure I understand igorpec’s response, but I do have one update. I went ahead and soldered a connector to the debug serial connector at the edge of the Banana Pi M2 Zero, connected it to my hardware and it works just fine. Unfortunately, that does not solve my issue. I need to be able to access the login shell via the UART located on the standard 40 pin connector. I don’t understand why the UART 0 (pins 8 and 10) are not the same as the three separate pins on the serial debug connector, but if I have to use a different UART to access the login shell, that is acceptable - I’ve got to reengineer my board anyway, so that’s not a big deal. But I cannot add another connector between my board and the Pi, and adding a wiring harness is out of the question.

Looking forward to anyone’s thoughts!

Thanks, Marshall

You are struggling with a POC while there is far better Linux support and much more users that could help you - in case you will need help at all.

UART is enabled this way: armbian-config -> system -> hardware and it works unless hardware is broken.

Well, I understand your response now, but I’m not so sure it’s a good idea to go this direction. I did go ahead and install armbian, boot up, change the password and create an account. Now I’ve got the same problem (still don’t know how to move from the UART on those three separate pins over to a UART that is connected to the 40 pin connector), plus a number of other problems right around the corner. How do I turn on i2c? How is the camera accessed? Presumably raspistill won’t work, so I’ll need different software. I’m alright with a new hardware design if I have to move the UART from pins 8/10 to two different pins, but I cannot see rewriting existing code that has been running on Raspbian for several years now.

So the original problem remains - how do I access the Banana Pi M2 Zero shell over a serial connection that is available on the 40 pin connector, and not the three pin debug port? There must be a simple way to do this. I just can’t see solving a problem as elementary as this by changing the O/S.

Thanks, Marshall

Is a Debian for RPi. Hardware below is completely different which means location of functions might be elsewhere.

You can’t move that UART, but you can enable those (1,2,3,4) on the pins and reroute them in software.

Raspbian has nothing to do with this. It is here to mislead you. To think that its the same but you are changing to a hardware which is totally different. But it supports this and that function … I2C works, SPI works, UARTs works, …

Go down to I2C1 - I2C4 and enable them … check schematics to see how they are wired and if they are wired at all. This configuration is generic for all Allwinner SoCs and boards do not have all those functions wired to the header. Enable them, read schematics, attach a scope … no other way.

AFAIK camera doesn’t work yet in a modern kernel. At least not OOB, without some fiddling around the kernel.

It is the most critical part in your problem. Rather invest some time to understand that. Its better then going fundamentally the wrong way.

Good afternoon,

Igorpec, I still really don’t understand what you’re saying on so many of your points. All I needed to do was make the login shell available over pins 8 and 10 instead of that three pin debug port. To change operating systems to do nothing more than that is insanity. Furthermore, the specific function you mentioned was not available within armbian-config for the Banana Pi - when I ran armbian-config, there was indeed a “system” selection, but no “hardware” selection. I could not find the hardware configuration setup anywhere within armbian-config.

In any case, I received word back from the engineers at Sinovoip earlier today. The solution they offered not only makes sense and is simple to do, IT WORKS! Here’s the exact response I received;

About your issues, our engineers said that bananapi zero 40 pins are pin functions compatible with Rpi, not everything the same, pins 8,10 is uart3, /dev/ttyS3, pins11, 13 is uart2, /dev/ttyS2, uart0,/dev/ttyS0 is the three pins header near sd slot. Default “login shell” uart is uart0, If you want another uart to “login shell”, you must change the line “console=tty1 console=ttyS0,115200” in /boot/bananapi/bpi-m2z/linux4.4/720p/uEnv.txt

So, all I did was to edit that file /boot/bananapi/bpi-m2z/linux4.4/720p/uEnv.txt, and change part of the one line from

console=tty1 console=ttyS0,115200

to

console=tty1 console=ttyS3,115200

That’s it! Problem solved - after a restart, the shell communication was available on pins 8 and 10, which is all I ever needed. I don’t understand the first part of the statement “console=tty1”, but I don’t believe it matters. I have what I need in order to move forward.

Thanks to everyone who read the post and attempted to assist!

Thanks, Marshall

Good luck! :grinning:

For anyone else that encounters this issue.

You need an FTDI serial cable (like this one) and connect GROUND, RX and TX to the highlighted ports here.

When those ports are connected to the serial adapter and the serial adapter to your laptop, you can use this command in linux after /dev/ttyUSBx where x is the number that is given by the OS:

screen /dev/ttyUSB0 115200

And if you use Windows, install Putty and follow the Windows section here.

Good luck!

Hello friends, after almost 1 day of serial communication functioning test with my slave machine (I still use the old Armbian Minimal Focal image - 21.11.0-trunk for now) the UART3 serial port on the banana pi M2 Zero - UART3 /dev/ttyS3 port not there is more track (GPIO pin: 8,10).

Python Serial Exception Raised:

serial.serialutil.SerialException: Could not configure port: (5, ‘Input / output error’) Exception_ttyS3_PythonSerial_11

I restarted the banana pi Zero, tried all the commands:

  1. dmesg | grep tty
  2. lsof /dev/ttys3
  3. sudo ls -l /proc/[0-9]/fd/ |grep /dev/ttyS3 … ttyS3_not_found11

but no more traces of the ttyS3 UART3 port yet, the other serial ports have all suddenly broken as well. Working now only my UART0 port /dev/ttyS0 which is the programming port of the banana pi zero.

After formatting and rewriting the Armbian Focal Mininmal image on the microSD again the ttyS3 UART3 port has started working again but I’m afraid it will soon break again. Do you have any information on this? How to solve this problem?

Armbian Focal Trunk Realise image used:

Armbian 21.11.0-trunk Focal with Linux 5.15.25-sunxi

armbian-release: BOARD=bananapim2zero BOARD_NAME=“Banana Pi M2 Zero” BOARDFAMILY=sun8i BUILD_REPOSITORY_URL=https://github.com/armbian/build BUILD_REPOSITORY_COMMIT=14904824d DISTRIBUTION_CODENAME=focal DISTRIBUTION_STATUS=supported VERSION=21.11.0-trunk LINUXFAMILY=sunxi ARCH=arm IMAGE_TYPE=user-built BOARD_TYPE=csc INITRD_ARCH=arm KERNEL_IMAGE_TYPE=Image BRANCH=current

Hi, I’m using Armbian 21.08.1 Focal with Linux 5.15.48-sunxi and I cannot connect to my USB device either! Is it still working for you? I am thinking of downgrading to Ubuntu 20…

Do you have all USB ports enabled? armbian-config -> hardware

It turned out that I can actually connect over UART3. I just thought I couldn’t because it just showed as ttyS3 and no further information about the decive. Thanks anyway.