Unexpected zeros on UART3 in BPI-M2 Zero

Hi, I use BPI-M2-zero with Armbian (latest from download section, archive folder). There is my CLI tool that uses libmodbus over UART3 (RTU mode) for communication with some modbus device. I enabled debug mode in libmodbus and I often observe errornous reception of 5 zeros on that uart instead of correct message:

Opening /dev/ttyS3 at 115200 bauds (N, 8, 1)
[01][11][C0][2C]
Sending request using RTS signal
Waiting for a confirmation...
<00><00><00><00><00>
ERROR CRC received 0x0 != CRC calculated 0x71C0

I checked the input on UART3_Rx with logic analyser and the contents is correct. In the digital signal domain there is no differences in codes or timings comparing to the correct reception.

I also performed the same test on Raspberry-Pi Zero W and there is no such problems.

I browsed libmodbus source code and there is nothing special, just writing to file, here /dev/ttyS3 device, so probably the problem comes from kernel module that is responsible for serial devices.

Before I dig into kernel I would like to ask:

  1. does anyone experience similar issues?
  2. are there any reports of hardware issues with UARTs in Allwinner H2+ that is a base of Banana Pi M2 zero?

Kind regards,

Piotr Romaniuk

Today I found that sometimes output data has different baudrate (9600) and changed contents to “^\r” (5E 0D). It looks like something else is using this uart too [?]

I am surprised by the solution (or something that removes unwanted behavior):

just added to /boot/armbianEnv.txt:

param_uart3_rtscts=1

It is the configruation line that enables usage RTS and CTS in uart driver.

No extra zeros, or 5E0D. I observed that problem does not apper when I execute commands from serial console (ttyS0) but when I use ssh (i.e. virtual console) or start commands from PHP it was present.

Regards, Piotr Romaniuk

PS Please don’t forget to connect uart3cts line to uart3rts! Otherwise no characters will be transmitted.

I’m using raspbian but the uart3 not working at all… Any suggestion?

Hi,

is it enabled in /boot/config.txt?

Regards,

Piotr Romaniuk

Thanks for reply, It works now. Another question, how can I make a overlay-fs on m2z? On Raspiberry zero there is a overlay fs option in the raspi-config tool, I tried many third-party scripts but none of them works…

Please create another thread about overlay-fs in this forum with your question, it is not related to uart3 discussion issue.

Another programmers would read it then, and maybe help.

OK, thank you very much.

hello friend romaniuk, could you tell me the image Armbian Ubuntu Minimal stable without bug on the UART3 serial port?

Here is what happened on my Modbus UART3 Slave after 1 day of operation using an Armbian Ubuntu image.

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 bass99,

I found some archive image, please see:

ttyS3 works fine.

Regards, Piotr Romaniuk

OK romaniuk thank you, you can tell which Armbian image to choose, the best minimal (no server)

Please try Armbian-21.08.1

Regards,

Piotr Romaniuk