UART4 in Debian Desktop Release of Mrfixit2001
#1
Hello,
  I would like to use UART on ROCKPro64 for bi-directional communication with Arduino Pro Mini.
According to documentation, UART4 TX, RX are connected to Pi-2 connector pins 19 and 21.
But there is no relevant device file - /dev/ttyS4. I can see only /dev/ttyS0 and /dev/ttyS2. I do not want to use these two, because they are already intended for Bluetooth and console.
How could I enable /dev/ttyS4 in my Linux system?
I am using rockpro64-debian-desktop-mrfixit-191226. ‘uname -a’ shows:
Linux Debian-Desktop 4.4.207 #1 SMP Fri Dec 27 11:35:59 EST 2019 aarch64 GNU/Linux  
Thanks in advance!
#2
Hi!
  Finally, I have figured out, how to obtain the device file /dev/ttyS4. Guys, you could have told me that it is so easy!
Here the instruction, for the case somebody is so new to this area, as I am.
  The Linux of Mrfixit2001 has already the necessary driver, because UART2 is active. It is just necessary to inform
it to activate this device. This is done in the Device Tree. Stored in the file /boot/rk3399-rockpro64.dtb.
UART4 uses the same pins as SPI1, so it is probably good idea to disable SPI1, while enabling UART4.
Step-by-step procedure (all executed as root):
1.      Make backup of the current definitions:
        cp /boot/rk3399-rockpro64.dtb /<somwhere>/rk3399-rockpro64.dtb.backup
2.      Install dtc, to create readable version of Device Tree definitions:
        apt-get install device-tree-compiler
3.      Convert .dtb file to .dts one:
        dtc -I dtb -O dts -f  /boot/rk3399-rockpro64.dtb -o /<somwhere>/rk3399-rockpro64.dts
4.      Disable SPI1 in the .dts file:
  a.      Search for line, which defines which section really deals with SPI1. The line is like this:
            spi1 = "/spi@ff1d0000"       by the way, ff1d0000 corresponds to SPI1 address in memory (can be found in the TRM document)
  b.      Search for the section spi@ff1d0000 { ... }
        In this section change line:
          status = "okay";
        to:
          status = "disabled";
5.      Enable UART4:
  a.      Similarly, like for SPI1, find which section defines UART4. It is serial@ff370000 { ... }
  b.      In the section serial@ff370000 { ... } change line:
          status = "disabled";
        to:
          status = "okay";
6.      Convert the edited .dts file to .dtb:
        dtc -I dts -O dtb -f /<somwhere>/rk3399-rockpro64.dts -o  /<somwhere>/rk3399-rockpro64.dtb.UART4
7.      Re-mount /boot to make it writable:
        mount | grep boot ->   /dev/mmcblk0p1 on /boot type vfat (ro, .......
        umount /boot
        mount /dev/mmcblk0p1 /boot
8.      Put the new .dtb file in place of the old one:
       cp /<somwhere>/rk3399-rockpro64.dtb.UART4 /boot/rk3399-rockpro64.dtb

  After next reboot, the file /dev/ttyS4 is there, and can be used to communicate through pins 19 and 20.

  Regarding /dev/ttyS2: I did a lot of testing and gymnastics to use it for two-way communication with Arduino.
Whatever I did, latest after few hours, the complete ROCPro64 was hanging. I think, using this UART requires
complete disabling console on it. Disabling of serial-getty is not enough.

  Best regards,
  Gienek.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Vanilla mainline Debian 11 (Bullseye) on the RockPro64 Pete Tandy 22 22,051 08-16-2023, 01:34 AM
Last Post: varac
  How do I enable Pine touchdisplay as display on Debian? Thisone 0 851 04-23-2023, 11:02 PM
Last Post: Thisone
  Is some u-boot required on the SPI for installing debian with the official installer? callegar 1 1,786 10-25-2022, 10:07 AM
Last Post: ratzzupaltuff
  Armbian 22.02 Release Announcement TRS-80 0 1,449 02-28-2022, 05:08 PM
Last Post: TRS-80
  Install Mali 400 Drivers for Debian 11 on RockPro64 MaverickPi 2 3,078 02-19-2022, 06:44 AM
Last Post: sigmaris
  Debian image configured for USB-C OTG? djonathan 2 3,263 01-06-2022, 03:09 AM
Last Post: susy1075
Bug Unreliable display in Armbian and Debian ksattic 3 3,844 11-17-2021, 05:42 AM
Last Post: PakoSt
  Debian Bullseye & RockPro64: No tty consoles? Pete Tandy 9 9,454 11-08-2021, 02:33 PM
Last Post: TRS-80
  HBA Card working on Aufan's builds but not in debian, armbian or dietpi charsi 1 2,315 10-29-2021, 11:15 AM
Last Post: TRS-80
  Two Questions About Debian on RockPro64 publiclewdness 0 1,565 09-30-2021, 11:54 AM
Last Post: publiclewdness

Forum Jump:


Users browsing this thread: 1 Guest(s)