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!
  Reply
#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.
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
Question Mainline Debian Buster on RockPro64 ? chrestomanci 12 647 04-27-2020, 09:53 AM
Last Post: kuleszdl
  New Pre-release 0.10.9 from Ayufan Bullet64 0 152 04-09-2020, 06:49 AM
Last Post: Bullet64
Big Grin Feature Complete Debian Desktop Release Mrfixit2001 154 23,397 03-31-2020, 08:22 AM
Last Post: pbut5
  Ayufan 5.4.0 rc1 release - cannot boot Mentaluproar 2 426 01-05-2020, 02:39 PM
Last Post: mmiigg
  Upgrade Debian kernel on a SD/SATA drive boot combo. linuxha 6 308 12-12-2019, 04:43 AM
Last Post: dukla2000
  Release 0.9.14 Ubuntu Mate desktop, LXDE, OMV, Docker CE (container) Luke 1 734 12-10-2019, 01:30 PM
Last Post: Helium75
  Debian, Kodi and the Spotify plugin. Pineapple 1 299 10-14-2019, 10:02 PM
Last Post: SBCraok
Information Update 22.02.2019 Feature-complete Debian build - SDIO WiFi/BT / PCIe / 3D / 2D Luke 100 17,954 10-04-2019, 08:57 PM
Last Post: tuxd3v
  New Stable release from Ayufan (0.8.3) Luke 13 2,498 08-06-2019, 05:19 PM
Last Post: andyburn
  Building a custom kernel on @mrfixit's Debian distro? Tim Jones 1 288 06-14-2019, 11:21 PM
Last Post: tllim

Forum Jump:


Users browsing this thread: 1 Guest(s)