Enable I2C, I2s, SPI in boot-config file?

I wonder if someone can help me with this one: in the past I used a Raspberry Pi to run via the GPIOs a stepper motor. That required updating of the /boot/config.txt file (on the RPi) as follows:

Enable i2c, i2s and spi (only if not already enabled)

$ echo "dtparam=i2c_arm=on" >> /boot/config.txt

$ echo "dtparam=i2s=on" >> /boot/config.txt

$ echo "dtparam=spi=on" >> /boot/config.txt

$ echo "dtoverlay=pps-gpio,gpiopin=24" >> /boot/config.txt

I have not found in the boot directory of the Rock64 anything similar, and do not know whether required.

In this Forum I came across this thread on 

https://forum.pine64.org/showthread.php?tid=5331 which refers to a package RPi.GPIO-PineA64 package to configure the GPIOs. Is this something I should do to enable I2C, I2s and SPI?

Would really appreciate your help.

Thanks in advance, 

Helge, I have a similar problem. Have you figured out what you were hoping to achieve?
It seems that the way things are, the devices are not enablet right away. However, they can be enabled via "dts overlays", essentially additional changes to the internal "device tree" structure.

See https://github.com/ayufan-rock64/linux-b...al-devices

There is an example there of enabling a network interface. I found that I could enable the i2c-0 bus (the one on pins P3 and P5) by the following command, run as root:

enable_dtoverlay i2c0 i2c@ff150000 okay

where the names such as "i2c@ff150000" are found in the device-tree-source file on the github repository:


Now, note that a number of GPIOs are already in use for various other purposes (the SPI for exampe is used for an on-board memory chip) and might not be readily available.

To have this happen on startup, put it into /etc/rc.local

starting with the info given in the post KnReLe, i write a little app in C++ that uses i2c0 bus. This works but requires the app to be executed as root. As i'm not a linux expert, i were looking for a solution and find the following so that this i2c bus could be used all the time outside root:

  1. create a user group (for instance i2cuser) and add rock64 (my user account) to the group 
       $sudo addgroup i2cuser   $sudo usermod -a -G i2cuser rock64
  2. create a script /usr/local/sbin/i2c0add.sh :
    #script to add i2c-0 to the devices
    echo Create /dev/i2c-0
    enable_dtoverlay i2c0 i2c@ff150000 okay
    #change owner:group of /dev/i2c-0
    chown root:i2cuser /dev/i2c-0

  3. create a systemd service file /etc/systemd/system/i2c0add.service :
    Description=Service to create i2c0 device



  4. enable the execution of the service at startup:
      $sudo systemctl enable /etc/systemd/system/i2c0add.service
I hope that i did not forget something. I not sure that this is the best solution but this works.
In addition, linux version is 18.04 LTS (Bionic Beaver)
I am also looking for a solution for using the gpio lines as non root, but until now without success. 
If someone has a solution....


Possibly Related Threads…
Thread Author Replies Views Last Post
  Rock64 enable 1-wire to read DS18B20 or Dallas temperature sensor Perry 0 396 11-09-2020, 07:38 PM
Last Post: Perry
  Libreelec Rock64 - 4GB no boot spiker15 3 585 11-02-2020, 12:36 AM
Last Post: wilsonYan
  Rock64 - boot helpmerock 2 662 10-08-2020, 01:29 PM
Last Post: helpmerock
  No boot up after power on Whoopsadaisy 4 1,422 09-26-2020, 05:14 PM
Last Post: simonsouth
Bug u-boot (forks) status mcerveny 14 5,165 08-27-2020, 01:44 PM
Last Post: globaltree
Sad No boot, garbage console text and blinking red light ... jean_bruder 2 939 07-19-2020, 08:37 AM
Last Post: jean_bruder
  Graphical boot manager john3voltas 0 456 03-25-2020, 02:27 PM
Last Post: john3voltas
  doesn't boot, no video cjyar 7 1,726 11-15-2019, 03:45 PM
Last Post: ab1jx
  Hoe to Update Buildroot Package config from SDK build.sh file shivarj89 0 423 09-09-2019, 09:39 AM
Last Post: shivarj89
  Unable to boot from SPI stevefan1999 4 1,805 05-01-2019, 04:47 PM
Last Post: rhens1

Forum Jump:

Users browsing this thread: 1 Guest(s)