Jump to content

how to connect 2 mrfc522 on orangepi 3b


Go to solution Solved by Илья Бовсунов,

Recommended Posts

Posted

hello guys, i hawe question, 
my device: orangepi 3b 8gb OS: 1.0.6 Jammy with Linux 5.10.160-rockchip-rk356x

 

3.3V → 3.3V → PIN 1

GND → GND → PIN 6

SCK → SPI SCK → PIN 23

MOSI → SPI MOSI → PIN 19

MISO → SPI MISO → PIN 21

SDA →  CS → SPI CE0 → PIN 24
 

===========================

 

/boot/orangepiEnv.txt

```
verbosity=1
bootlogo=true
extraargs=cma=128M
overlay_prefix=rk356x
rootdev=UUID=4b3309b6-9bbe-431d-8609-82360b5b6154
rootfstype=ext4
overlays=spi3-m0-cs0-spidev spi3-m0-cs1-spidev

```

orangepi@orangepi3b:~$ ls /dev/spidev*
/dev/spidev3.0                                                                                <================= only one...

cant add new spidev 3.1 and more.. for connect another mrfc522

 

how to fix?

  • Solution
Posted

ok how i fix it?

 

go next: 

sudo find /boot -type f -name '*cs0*dtbo'

 

i see on  next: 

 

rk356x-spi<BUS>-m<MUX>-cs<CS>-spidev.dtbo
│  │      │           │
│  │      │           └─ номер Chip-Select (0 или 1)
│  │      └─ «mux» — какие именно ноги вывели наружу (m0, m1…)
│  └─ номер аппаратного SPI-контроллера (spi0…spi5)
└─ серия SoC (rk3566 / rk3568 = rk356x, rk3588 …)

 

next setup instruction:

 

| Шаг                                                     | Команды (копируйте строка-в-строку)                                                    | Что должно получиться                            |                                          |
| ------------------------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------ | ---------------------------------------- |
| 1. Перейти в домашний каталог                           | `cd ~`                                                                                 |                                                  |                                          |
| 2. Создать исходник DTS                                 | `nano rk356x-spi3-m0-cs1-spidev.dts`                                                   | вставьте текст снизу → **Ctrl-O, Enter, Ctrl-X** |                                          |
| 3. Скомпилировать в DTBO                                | `dtc -@ -I dts -O dtb -o rk356x-spi3-m0-cs1-spidev.dtbo rk356x-spi3-m0-cs1-spidev.dts` | файл *.dtbo* рядом                               |                                          |
| 4. Узнать каталог оверлеев                              | `export OVR=/boot/dtb/rockchip/overlay`                                                | (у вас именно такой путь)                        |                                          |
| 5. Скопировать файл                                     | `sudo cp rk356x-spi3-m0-cs1-spidev.dtbo $OVR/`                                         |                                                  |                                          |
| 6. Проверить                                            | \`ls \$OVR                                                                             | grep cs1\`                                       | увидите *rk356x-spi3-m0-cs1-spidev.dtbo* |
| 7. Убедиться, что в `/boot/orangepiEnv.txt` есть строка | `overlays=spi3-m0-cs0-spidev spi3-m0-cs1-spidev`                                       | если всё ок — дальше                             |                                          |
| 8. Перезагрузить                                        | `sudo reboot`                                                                          |                                                  |                                          |
| 9. После ребута                                         | `ls /dev/spidev3.*`                                                                    | **/dev/spidev3.0  /dev/spidev3.1**               |                                          |

 

#6  can be ignored.

 

at #2 next: rk356x-spi3-m0-cs1-spidev.dts  <=== name

code:

/dts-v1/;
/plugin/;

/ {
    compatible = "rockchip,rk3566";

    fragment@0 {
        target = <&spi3>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;
            status = "okay";

            spidev@1 {          /* CS1 = регистр 1 */
                compatible = "spidev";
                reg = <1>;
                spi-max-frequency = <10000000>;
            };
        };
    };
};

 

sudo reboot

 

after this: ls /dev/spidev3.*

 

orangepi@orangepi3b:~$ ls /dev/spidev3.*
/dev/spidev3.0  /dev/spidev3.1

 

make like ;)

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