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
  HBA Card working on Aufan's builds but not in debian, armbian or dietpi charsi 0 33 10-25-2021, 10:48 AM
Last Post: charsi
  Debian Bullseye & RockPro64: No tty consoles? Pete Tandy 5 319 10-09-2021, 02:02 PM
Last Post: TRS-80
  Vanilla mainline Debian 11 (Bullseye) on the RockPro64 Pete Tandy 18 841 10-07-2021, 05:08 PM
Last Post: t4_4t
  Two Questions About Debian on RockPro64 publiclewdness 0 125 09-30-2021, 11:54 AM
Last Post: publiclewdness
Question Booting official Debian on RP64 arteeh 6 1,721 07-06-2021, 10:16 AM
Last Post: TRS-80
Big Grin Feature Complete Debian Desktop Release Mrfixit2001 158 83,582 05-29-2021, 04:05 AM
Last Post: twilite
  Booting Linux/Debian from the eMMC linuxha 4 1,358 03-02-2021, 07:01 PM
Last Post: linuxha
Question Mainline Debian Buster on RockPro64 ? chrestomanci 36 16,237 02-14-2021, 02:37 PM
Last Post: foresto
  How To Lay Hands on a True 64-bit Debian Install? vandys 4 1,428 12-01-2020, 06:12 AM
Last Post: as365n4
  Accessing UART4 on RockPro64 (Armbian) antonlyap 1 1,486 10-04-2020, 12:51 PM
Last Post: antonlyap

Forum Jump:


Users browsing this thread: 1 Guest(s)