Jump to content

RK3288 Tinkerboard Rev2.1 – nrf24, spi register failure


ALIGMSTEN

Recommended Posts

Good day,

 

I am failing to get SPI working on Tinkerboard REV1.2 with a Nordic nrf24L01+ transceiver.

 

Software as follows:

gordon@tinkerboard:~/rf24libs/RF24/examples_linux/extra$ uname -a

Linux tinkerboard 5.10.21-rockchip #21.02.3 SMP PREEMPT Tue Mar 9 09:50:34 CET 2021 armv7l armv7l armv7l GNU/Linux

gordon@tinkerboard:~/rf24libs/RF24/examples_linux/extra$ cat /etc/lsb-release

DISTRIB_ID=Ubuntu

DISTRIB_RELEASE=20.04

DISTRIB_CODENAME=focal

DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"

 

Hardware is attached to spi2, CE for example as below.

nrf24 CE pin 3 → spi2-csl  gpio8-6 (251) = GPA3_SPI2CSN1 pin 26.

 

I have installed the library https://github.com/nRF24.

Initial try the library exited with a spidev bus selection exception.

I added the corresponding bus by editing armbianEnv.txt as follows

param_spidev_spi_bus=2

This solved the exception complained at by the library.

However the spi register error remains as before.

 

gordon@tinkerboard:~/rf24libs/RF24/examples_linux/extra$ dmesg|grep spi

[    5.221140] rockchip-spi ff130000.spi: cs1 >= max 1

[    5.226695] spi_master spi2: spi_device register error /spi@ff130000/spidev@1

[    5.234805] spi_master spi2: Failed to create SPI device for /spi@ff130000/spidev@1

 

I am assuming the error, cs1 >= max 1, is that the spidev controller and its driver are configured for a single chip select (max 1).

I am currently reading up on device tree overlays, is this the suggested way to implement, or am i missing something simple.

 

Thanks

Link to comment
Share on other sites

I apologies for typing error, the correct pimux-pins for 251 are (gpio8-3) and not the 8-6 that is for 254 spi2-clk.

 

I was able to move past the chip-select conflict by disabling spidev@1, which seemed like the simple solution all along, but the radio is unresponsive, will check hardware before proceeding.

 

armbian-add-overlay is unresponsive from the shell, yet from the configure utility there is an option to add overlays.

 

I've read elsewhere here that to add overlays as expected to work one has to use a repository such as legacy V4.4.213.

 

Be grateful for any advise

 

Thanks

Link to comment
Share on other sites

For the record this was an overlooked (read failing eyesight!) hardware configuration mistake, I hope any information contained might be of help to someone else.

 

I will continue fumbling along to familiarize myself with all here.

 

Thank you for a great resource!

Link to comment
Share on other sites

Hi Aligmsten,

 

Thanks for pointing into the right direction. Is it possible that you elaborate a little bit more on how to specifically disable spidev@1?

 

 

$ dmesg |grep spi
[    1.943067] rockchip-spi ff130000.spi: cs1 >= max 1
[    1.943091] spi_master spi2: spi_device register error /spi@ff130000/spidev@1
[    1.943133] spi_master spi2: Failed to create SPI device for /spi@ff130000/spidev@1


$ uname -a
Linux <hostname> 5.15.48-rockchip #22.05.3 SMP PREEMPT Wed Jun 22 07:34:52 UTC 2022 armv7l GNU/Linux


$ cat /boot/armbianEnv.txt
verbosity=1
bootlogo=false
overlay_prefix=rockchip
overlays=spi2 spidev2
rootdev=UUID=<something>
rootfstype=ext4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

 

I tried using armbian-config > System > Dtc, commenting out the spidev@1 parts:

 

       spi@ff130000 {
               compatible = "rockchip,rk3288-spi\0rockchip,rk3066-spi";
               clocks = <0x07 0x43 0x07 0x154>;
               clock-names = "spiclk\0apb_pclk";
               dmas = <0x1a 0x0f 0x1a 0x10>;
               dma-names = "tx\0rx";
               interrupts = <0x00 0x2e 0x04>;
               pinctrl-names = "default";
               pinctrl-0 = <0x23 0x24 0x25 0x26 0x27>;
               reg = <0x00 0xff130000 0x00 0x1000>;
               #address-cells = <0x01>;
               #size-cells = <0x00>;
               status = "okay";
               max-freq = <0x2faf080>;
               phandle = <0x92>;

               spidev@0 {
                       compatible = "rockchip,spi_tinker";
                       reg = <0x00 0x00>;
                       spi-max-frequency = <0x2faf080>;
                       spi-cpha = <0x01>;
               };

               #spidev@1 {
               #       compatible = "rockchip,spi_tinker";
               #       reg = <0x01>;
               #       spi-max-frequency = <0x2faf080>;
               #       spi-cpha = <0x01>;
               #};
       };


It told me the file was wrong. Then I deleted the spidev@1 part. Now I don't have the errors anymore, but no /dev/spi*.

 

For the record: all worked perfectly before for months, with the same configuration. After a reboot (and probably an update) it stopped working. I never had spidev2.1 though, but it just skipped it silently and I worked happily with spidev2.0.

Link to comment
Share on other sites

Hi Zeekoe,

 

luckily I've just popped into to have a look what's new and saw rk3288.

 

Sorry its a while back and has been running rf24 radio comm pretty much since when originally posted.

 

It was a bit of a battle initially but nothing difficult. I did quite a bit with the kernel for my specific use case and am not particularly happy with the spi bus, but had to move along as was doing the job for that moment.

 

I been working on other projects so will have to take a look back at the notes and see if I can help.

 

Best,

Alistair

Link to comment
Share on other sites

Thanks for your reply.

While thinking further, I can vaguely remember that this error/warning was not new. So it might as well not be related to my problem.

I found this:

That could be my real problem. Might be of help to others, too, that fail after upgrade.

I think I messed up the device tree thingy, if I get it restored, will post here again...

Link to comment
Share on other sites

Yay! For others with similar problems: downgraded kernel with armbian-config (System > Other) to 5.10.60

 

Restored device tree (which is probably only needed if you messed it up in the first place; armbian-config > System > Dtc) to

 

        spi@ff130000 {
                compatible = "rockchip,rk3288-spi\0rockchip,rk3066-spi";
                clocks = <0x07 0x43 0x07 0x154>;
                clock-names = "spiclk\0apb_pclk";
                dmas = <0x1f 0x0f 0x1f 0x10>;
                dma-names = "tx\0rx";
                interrupts = <0x00 0x2e 0x04>;
                pinctrl-names = "default";
                pinctrl-0 = <0x28 0x29 0x2a 0x2b 0x2c>;
                reg = <0x00 0xff130000 0x00 0x1000>;
                #address-cells = <0x01>;
                #size-cells = <0x00>;
                status = "okay";
                max-freq = <0x2faf080>;
                phandle = <0x95>;

                spidev@0 {
                        compatible = "rockchip,spi_tinker";
                        reg = <0x00 0x00>;
                        spi-max-frequency = <0x2faf080>;
                        spi-cpha = <0x01>;
                };

                spidev@1 {
                        compatible = "rockchip,spi_tinker";
                        reg = <0x01>;
                        spi-max-frequency = <0x2faf080>;
                        spi-cpha = <0x01>;
                };
        };

 

Note that phandle is different. I know not much about device tree, but this seems to be a sequence number.

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