Jump to content

i2s, spi and i2c on orangepi 5 plus


Seb042
Go to solution Solved by Seb042,

Recommended Posts

Hi,

I'm pretty new to this forum may be I will ask some already answered questions, but here they are:

 

I just had a new orangepi 5 plus card and I failed to use the "buses":

- I2s: didn't find anywhere how to activate it (i'm trying a dac as a soundcard). Didn't find the hifiberry-dac overlay neither (ok maybe this one is just for raspberry).

- spi: I plugged a simple mcp3008 to the spi pins but can't read anything on it (i have the /dev/spidev0.0/1 and /dev/spiddev4.0/1 devices). I think I respected the rights pins.

- i2c: when I activate the overlays in armbianEnv.txt, I can see a lot of messages every seconds with dmesg about rk-hdmi. Maybe I put too much overlays in the list ?

 

Any help or leads would be appreciated.

 

 

Edited by Seb042
Link to comment
Share on other sites

On this one, I have also activated all the ic2 overlays:

https://paste.armbian.com/ivuyayuzub

 

You can see the recurring message:

  151.145487] rk3x-i2c fec80000.i2c: timeout, ipd: 0x80, state: 3
[  151.150943] rk_hdmirx fdee0000.hdmirx-controller: hdmirx_cancel_cpu_limit_freq freq qos nod add
[  151.158929] rk_hdmirx fdee0000.hdmirx-controller: hdmirx_set_cpu_limit_freq: cpu4 policy NULL
[  151.213756] rk_hdmirx fdee0000.hdmirx-controller: hdmirx_cancel_cpu_limit_freq freq qos nod add
[  151.221833] rk_hdmirx fdee0000.hdmirx-controller: hdmirx_set_cpu_limit_freq: cpu4 policy NULL
[  151.248815] rk3x-i2c fec80000.i2c: timeout, ipd: 0x80, state: 3
[  151.276408] rk_hdmirx fdee0000.hdmirx-controller: hdmirx_cancel_cpu_limit_freq freq qos nod add
[  151.284401] rk_hdmirx fdee0000.hdmirx-controller: hdmirx_set_cpu_limit_freq: cpu4 policy NULL

 

If I disable the overlays finishing by m1 and m4 I don't have the messages anymore.

Edited by Seb042
more information
Link to comment
Share on other sites

@Seb042 For the DAC you would need to port the RPI overlay so the correct pin names are used and the you would need to check if that kernel module is installed.

It might be that you're activating conflicting overlays, in the manual you could find the SPI pin names and just activate that one.  Some pins do have something like the same function on m0 as on m1, activating both won't work. Other pins has different functions on the same pin like spi and i2c, activating both won't work either.

 

Link to comment
Share on other sites

Yes I have the file:

root@orangepi5-plus:/boot/dtb/rockchip/overlay# ls -l rk3588-spi4-m0-cs1-spidev.dtbo
-rwxr-xr-x 1 root root 598 Dec  1 14:04 rk3588-spi4-m0-cs1-spidev.dtbo

 

After reboot, I have the device:

root@orangepi5-plus:~# ls -l /dev/spidev4.1
crw------- 1 root root 153, 0 Dec  4 22:39 /dev/spidev4.1

 

So I'm using this code

` ` `

import spidev
import time

spi = spidev.SpiDev(4,1)
spi.max_speed_hz= 120000


while True:
    print(spi.readbytes(1))
    time.sleep(0.1)

` ` `

 

And the only thing I have is 255, like nothing is read from the chip.

 

more info:

errors in the dmesg:

[    5.219022] rockchip-pinctrl pinctrl: pin gpio1-17 already requested by fecb0000.spi; cannot claim for feab0000.i2c
[    5.219027] rockchip-pinctrl pinctrl: pin-49 (feab0000.i2c) status -22
[    5.219031] rockchip-pinctrl pinctrl: could not request pin 49 (gpio1-17) from group i2c3m0-xfer  on device rockchip-pinctrl
[    5.219034] rk3x-i2c feab0000.i2c: Error applying setting, reverse things back

[    5.466121] arm-scmi firmware:scmi: Failed. SCMI protocol 17 not active.

[    5.480350] rockchip-pinctrl pinctrl: pin gpio1-18 already requested by fecb0000.spi; cannot claim for 7-0011
[    5.480358] rockchip-pinctrl pinctrl: pin-50 (7-0011) status -22
[    5.480365] rockchip-pinctrl pinctrl: could not request pin 50 (gpio1-18) from group i2s0-mclk  on device rockchip-pinctrl
[    5.480371] ES8323 7-0011: Error applying setting, reverse things back

[    5.535846] rockchip-pinctrl pinctrl: pin gpio1-17 already requested by fecb0000.spi; cannot claim for feab0000.i2c
[    5.535856] rockchip-pinctrl pinctrl: pin-49 (feab0000.i2c) status -22
[    5.535866] rockchip-pinctrl pinctrl: could not request pin 49 (gpio1-17) from group i2c3m0-xfer  on device rockchip-pinctrl
[    5.535873] rk3x-i2c feab0000.i2c: Error applying setting, reverse things back

 

I don't know if it's important but I'm booting from the MTD device.

 

I tried with the wiringOP librairy, I have the same result (it's reading value of 255).

The gpio readall command returns an error too:

wiringPiSetup: mmap (PWM) failed: Operation not permitted

 

root@orangepi5-plus:~/wiringOP/examples# ./spidev_test -v -D /dev/spidev4.1
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  |......@.........................|
RX | FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................................|

 

 

Edited by Seb042
Link to comment
Share on other sites

@royk

I tried with the ubuntu version from there: https://github.com/Joshua-Riek/ubuntu-rockchip

I still can't manage to make the spidev bus work but at least the gpio binary show me the map of pins. But I'm confused because there are not the same names that the ones on the documentation.

# gpio readall
 +------+-----+----------+--------+---+ PI5 PLUS +---+--------+----------+-----+------+
 | GPIO | wPi |   Name   |  Mode  | V | Physical | V |  Mode  | Name     | wPi | GPIO |
 +------+-----+----------+--------+---+----++----+---+--------+----------+-----+------+
 |      |     |     3.3V |        |   |  1 || 2  |   |        | 5V       |     |      |
 |   16 |   0 |    SDA.2 |     IN | 0 |  3 || 4  |   |        | 5V       |     |      |
 |   15 |   1 |    SCL.2 |     IN | 0 |  5 || 6  |   |        | GND      |     |      |
 |   62 |   2 |    PWM14 |     IN | 1 |  7 || 8  | 0 | IN     | GPIO1_A1 | 3   | 33   |
 |      |     |      GND |        |   |  9 || 10 | 0 | IN     | GPIO1_A0 | 4   | 32   |
 |   36 |   5 | GPIO1_A4 |     IN | 0 | 11 || 12 | 1 | IN     | GPIO3_A1 | 6   | 97   |
 |   39 |   7 | GPIO1_A7 |     IN | 1 | 13 || 14 |   |        | GND      |     |      |
 |   40 |   8 | GPIO1_B0 |     IN | 1 | 15 || 16 | 1 | IN     | GPIO3_B5 | 9   | 109  |
 |      |     |     3.3V |        |   | 17 || 18 | 0 | IN     | GPIO3_B6 | 10  | 110  |
 |   42 |  11 | SPI0_TXD |     IN | 0 | 19 || 20 |   |        | GND      |     |      |
 |   41 |  12 | SPI0_RXD |     IN | 0 | 21 || 22 | 0 | IN     | GPIO1_A2 | 13  | 34   |
 |   43 |  14 | SPI0_CLK |     IN | 0 | 23 || 24 | 1 | IN     | SPI0_CS0 | 15  | 44   |
 |      |     |      GND |        |   | 25 || 26 | 1 | IN     | SPI0_CS1 | 16  | 45   |
 |   47 |  17 | GPIO1_B7 |     IN | 1 | 27 || 28 | 1 | IN     | GPIO1_B6 | 18  | 46   |
 |   63 |  19 | GPIO1_D7 |     IN | 1 | 29 || 30 |   |        | GND      |     |      |
 |   96 |  20 | GPIO3_A0 |     IN | 1 | 31 || 32 | 0 | IN     | GPIO1_A3 | 21  | 35   |
 |  114 |  22 | GPIO3_C2 |     IN | 0 | 33 || 34 |   |        | GND      |     |      |
 |   98 |  23 | GPIO3_A2 |     IN | 1 | 35 || 36 | 0 | IN     | GPIO3_A5 | 24  | 101  |
 |  113 |  25 | GPIO3_C1 |     IN | 0 | 37 || 38 | 0 | IN     | GPIO3_A4 | 26  | 100  |
 |      |     |      GND |        |   | 39 || 40 | 1 | IN     | GPIO3_A3 | 27  | 99   |
 +------+-----+----------+--------+---+----++----+---+--------+----------+-----+------+
 | GPIO | wPi |   Name   |  Mode  | V | Physical | V |  Mode  | Name     | wPi | GPIO |
 +------+-----+----------+--------+---+ PI5 PLUS +---+--------+----------+-----+------+
 

 

so, according to the documentation, finally, I have to put this in Env file:

overlay_prefix=orangepi-5-plus
overlays=rk3588-spi0-m2-cs0-spidev
 

After compiling the spidev_test command, and connecting spi0_TXD and spi0_TXD, I can see that the data is transmitted between both.

 

root@seb-desktop:~/wiringOP/examples# ./spidev_test -vD /dev/spidev0.0 
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  |......@.........................|
RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  |......@.........................|
 

As soon I connect the mcp3008 the 255 value is back, as if nothing was connected... if I connect the same thing to a raspberry pi it works... really don't know where is the issue with this SPI bus on that board.

 

 

Edited by Seb042
adding more information
Link to comment
Share on other sites

@Seb042 In the manual on page 215/216 you can see a better picture, the colored one you'll only see the functions and pin names and beneath that picture you'll see more details with gpio numbers.

The prefix you need to use depends on the filename like I explained in my previous message.

ls -l /boot/dtb/rockchip/overlay/*spi*

 

The overlay files I've got there begins with rk3588 so that's what you need to use as prefix.

If you also need another overlay that begins with orangepi-5-plus then use that as prefix and rename the spi overlay you'd like to use from rk3588-.... to orangepi-5-plus-....

 

Or to prevent it from getting overwritten after a update, even better to download the dts from:

https://github.com/armbian/linux-rockchip/tree/rk-5.10-rkr6/arch/arm64/boot/dts/rockchip/overlay

 

and install it as useroverlay:

sudo armbian-add-overlay your-download-spi-overlay.dts

 

Can you post your armbianEnv.txt ?

Link to comment
Share on other sites

  • Solution

@royk

Finally working for the spi bus.

As I didn't know what I may did wrong, I reinstalled the system, read better the doc as you suggested (the first example they show it's not the standard configuration, confusing for me at first),  and finally I chose the right overlay. 

My armbianEnv.txt is like this to make it works:

 

verbosity=1
bootlogo=true
overlay_prefix=rockchip-rk3588
fdtfile=rockchip/rk3588-orangepi-5-plus.dtb
rootdev=UUID=2cc7a9a6-afc7-4cd4-b377-6f83f2e1bf50
rootfstype=ext4
overlays=rk3588-spi0-m2-cs0-cs1-spidev
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

 

I'm using the cs0-cs1 because I will need both later as I will use rotary encoders. 

I assume it will be the same for i2c bus, I will have to choose the right overlay.

I still don't know which one would be for the i2s, but I should find that somewhere in the documentation I hope.

 

Thanks for the answers and the tip for how to load user overlays.

 

Link to comment
Share on other sites

Today I installed Armbian_23.11.1_Orangepi5-plus_bookworm_edge_6.7.0-rc1.img

 

and from the begining some troubles :(

 

In comparison to last OS Armbian_23.8.2_Orangepi5-plus_bookworm_legacy_5.10.160_xfce_desktop.img what is not working for me:

 

a) WIFI AX210 is disabled by RFKILL

orangepi@orangepi5-plus:~/work/openplotter_opi5plus$ sudo rfkill list all
0: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: yes
1: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no

and by now no way to enabled it

 

b) armbian-config tool has no option HARDWARE (to enable some overlays)

c) armbian-config has no option WIFI in Network submenu

d) overlays are not starting at all (doing like before for kernel 5.10) and nothing :(

e) still the same issue with WiringPI software

orangepi@orangepi5-plus:~/work/openplotter_opi5plus$ sudo gpio readall
wiringPiSetup: mmap (PWM) failed: Operation not permitted

 

Ps.

I dont open separated topic and using this one :)

Edited by D roZDi
Link to comment
Share on other sites

I just realized that on the download page the 6.7 images were actually promoted instead of the 5.10.y legacy once....which isn't ideal. I give you that.

Suggesting to at least add one of the legacy images (Gnome variant) instead of having both 6.7 bleeding edge.  Also the 3d acceleration ppa only works with Gnome legacy anyways @Igor

Link to comment
Share on other sites

1 hour ago, Werner said:

Suggesting to at least add one of the legacy images (Gnome variant) instead of having both 6.7 bleeding edge.  Also the 3d acceleration ppa only works with Gnome legacy anyways

 

Yes, suggesting those images is our bug. I am aware that sorting doesn't work right but this is yet another problem we have to deal with. I have asked that this is fixed and since we don't have professional support It can take several weeks, perhaps a month. I can't fix it, I can just patch it, so I have removed those images for good and they will be gone from index within several hours. More then this its not possible to do.

 

2 hours ago, D roZDi said:

what is the purpose of providing an unusable image?

 

I am using this image for several months in production. Any many other people. We share this joy with you. 

 

Mainline based support functions rarely gets to full completion as its very expensive to brought things up and maintain with no budget. Adjust expectations, use old kernel, share findings with others, but don't expect anything, especially not answering questions. It can easily take hours, which is not at end users level.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines