Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. FAQs
  3. voxl_spi_init, failed to open /dev/spidev device: No such file or directory.

voxl_spi_init, failed to open /dev/spidev device: No such file or directory.

Scheduled Pinned Locked Moved FAQs
30 Posts 4 Posters 8.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Alex KushleyevA Alex Kushleyev

    Another quick tip for testing SPI stuff. I found this useful:

    Link Preview Image
    spidev-test/spidev_test.c at master · rm-hull/spidev-test

    Contribute to rm-hull/spidev-test development by creating an account on GitHub.

    favicon

    GitHub (github.com)

    You can download this file to VOXL2, build it using

    gcc -O2 spidev_test.c -o spidev_test
    

    and then you can actually query the IMU on spi 3:

    voxl2-mini:~$ ./spidev_test -D /dev/spidev3.0 -p "\x76\x00\xF5\x00"
    spi mode: 0x0
    bits per word: 8
    max speed: 500000 Hz (500 KHz)
    RX | 00 00 00 47 ...
    

    and from here we know that 0x47 is actually the value WHOAMI register of ICM42688 IMU 🙂

    The data i am sending to the device is 4 bytes used to query the imu, as done here . the value 0xF5 = 0x75 | 0x80 which tells the IMU to send back the value of register 0x75

    이광철이 Offline
    이광철이 Offline
    이광철
    Contributor
    wrote on last edited by
    #20

    @Alex-Kushleyev

    I tested according to your advice.
    This is the result of testing on my mini.

    voxl2-mini:~$ cd /usr/bin
    voxl2-mini:/usr/bin$ spidev_test -D /dev/spidev3.0 -p "\x76\x00\xF5\x00"
    spi mode: 0x0
    bits per word: 8
    max speed: 500000 Hz (500 KHz)
    can't send spi message: Invalid argument
    Aborted

    이광철이 1 Reply Last reply
    0
    • 이광철이 이광철

      @Alex-Kushleyev

      I tested according to your advice.
      This is the result of testing on my mini.

      voxl2-mini:~$ cd /usr/bin
      voxl2-mini:/usr/bin$ spidev_test -D /dev/spidev3.0 -p "\x76\x00\xF5\x00"
      spi mode: 0x0
      bits per word: 8
      max speed: 500000 Hz (500 KHz)
      can't send spi message: Invalid argument
      Aborted

      이광철이 Offline
      이광철이 Offline
      이광철
      Contributor
      wrote on last edited by
      #21

      @이광철

      Alex-Kushleyev sorry.

      voxl2-mini:~$ cd /usr/bin
      voxl2-mini:/usr/bin$ spidev_test -D /dev/spidev3.0 -p "\x76\x00\xF5\x00"
      spi mode: 0x0
      bits per word: 8
      max speed: 500000 Hz (500 KHz)
      can't send spi message: Invalid argument
      Aborted

      This test was my mistake.

      Below are the final test results.
      voxl2-mini:/usr/bin$ spidev_test -D /dev/spidev3.0 -p "\x76\x00\xF5\x00"
      spi mode: 0x0
      bits per word: 8
      max speed: 500000 Hz (500 KHz)
      RX | 00 00 00 47 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | ...G

      Alex KushleyevA 1 Reply Last reply
      0
      • 이광철이 이광철

        @이광철

        Alex-Kushleyev sorry.

        voxl2-mini:~$ cd /usr/bin
        voxl2-mini:/usr/bin$ spidev_test -D /dev/spidev3.0 -p "\x76\x00\xF5\x00"
        spi mode: 0x0
        bits per word: 8
        max speed: 500000 Hz (500 KHz)
        can't send spi message: Invalid argument
        Aborted

        This test was my mistake.

        Below are the final test results.
        voxl2-mini:/usr/bin$ spidev_test -D /dev/spidev3.0 -p "\x76\x00\xF5\x00"
        spi mode: 0x0
        bits per word: 8
        max speed: 500000 Hz (500 KHz)
        RX | 00 00 00 47 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | ...G

        Alex KushleyevA Offline
        Alex KushleyevA Offline
        Alex Kushleyev
        ModalAI Team
        wrote on last edited by
        #22

        @이광철 ,

        Please note that qrb5165io-spi-test -d 14 is a test app that just tries to detect a specific IMU on the SPI port. If the specific IMU is not connected, the test will not be successful.

        Are you able to read any data from your SPI sensor (using spidev_test -D /dev/spidev14.0 ... ? Can you share what your sensor is? You should look in the documentation of your sensor and it will tell you how to communicate with it. SPI protocol for reading / writing is specific to the device.

        Also, don't forget about the gpio setting that needs to be made before using SPI 14 (voxl-gpio -w 67 1). this needs to be run after each reboot.

        Alex

        이광철이 1 Reply Last reply
        0
        • Alex KushleyevA Alex Kushleyev

          @이광철 ,

          Please note that qrb5165io-spi-test -d 14 is a test app that just tries to detect a specific IMU on the SPI port. If the specific IMU is not connected, the test will not be successful.

          Are you able to read any data from your SPI sensor (using spidev_test -D /dev/spidev14.0 ... ? Can you share what your sensor is? You should look in the documentation of your sensor and it will tell you how to communicate with it. SPI protocol for reading / writing is specific to the device.

          Also, don't forget about the gpio setting that needs to be made before using SPI 14 (voxl-gpio -w 67 1). this needs to be run after each reboot.

          Alex

          이광철이 Offline
          이광철이 Offline
          이광철
          Contributor
          wrote on last edited by
          #23

          @Alex-Kushleyev

          Please note that qrb5165io-spi-test -d 14 is a test app that just tries to detect a specific IMU on the SPI port. If the specific IMU is not connected, the test will not be successful.
          Yes I know.

          My spi device and test program works fine on volx2's J10.
          Please refer to j10 in the url below.
          https://docs.px4.io/main/en/flight_controller/modalai_voxl_2.html

          Alex KushleyevA 1 Reply Last reply
          0
          • 이광철이 이광철

            @Alex-Kushleyev

            Please note that qrb5165io-spi-test -d 14 is a test app that just tries to detect a specific IMU on the SPI port. If the specific IMU is not connected, the test will not be successful.
            Yes I know.

            My spi device and test program works fine on volx2's J10.
            Please refer to j10 in the url below.
            https://docs.px4.io/main/en/flight_controller/modalai_voxl_2.html

            Alex KushleyevA Offline
            Alex KushleyevA Offline
            Alex Kushleyev
            ModalAI Team
            wrote on last edited by
            #24

            @이광철 , do you still have any issue? Does spidev_test work with spi 14?

            이광철이 1 Reply Last reply
            0
            • Alex KushleyevA Alex Kushleyev

              @이광철 , do you still have any issue? Does spidev_test work with spi 14?

              이광철이 Offline
              이광철이 Offline
              이광철
              Contributor
              wrote on last edited by
              #25

              @Alex-Kushleyev

              I tested it by connecting my spi device to j10.
              This spi device is working normally in voxl2.
              My program for testing also operates normally with this spi device in voxl2.

              voxl_spi_init(SPI_BUS, SPI_MODE_0, VOXL_SPI_MAX_SPEED) is OK
              but, there is no response to the voxl_spi_write function.

              Alex KushleyevA 1 Reply Last reply
              0
              • 이광철이 이광철

                @Alex-Kushleyev

                I tested it by connecting my spi device to j10.
                This spi device is working normally in voxl2.
                My program for testing also operates normally with this spi device in voxl2.

                voxl_spi_init(SPI_BUS, SPI_MODE_0, VOXL_SPI_MAX_SPEED) is OK
                but, there is no response to the voxl_spi_write function.

                Alex KushleyevA Offline
                Alex KushleyevA Offline
                Alex Kushleyev
                ModalAI Team
                wrote on last edited by Alex Kushleyev
                #26

                @이광철 , can you confirm that you are setting gpio 67 on voxl2 mini before testing spi 14?

                이광철이 1 Reply Last reply
                0
                • Alex KushleyevA Alex Kushleyev

                  @이광철 , can you confirm that you are setting gpio 67 on voxl2 mini before testing spi 14?

                  이광철이 Offline
                  이광철이 Offline
                  이광철
                  Contributor
                  wrote on last edited by
                  #27

                  @Alex-Kushleyev

                  Yes.
                  After executing voxl-gpio -w 67 1, run my test.

                  voxl-gpio -r 67
                  1

                  Alex KushleyevA 1 Reply Last reply
                  0
                  • 이광철이 이광철

                    @Alex-Kushleyev

                    Yes.
                    After executing voxl-gpio -w 67 1, run my test.

                    voxl-gpio -r 67
                    1

                    Alex KushleyevA Offline
                    Alex KushleyevA Offline
                    Alex Kushleyev
                    ModalAI Team
                    wrote on last edited by
                    #28

                    Hmm.. we will investigate.

                    1 Reply Last reply
                    0
                    • modaltbM Offline
                      modaltbM Offline
                      modaltb
                      ModalAI Team
                      wrote on last edited by
                      #29

                      Hi @이광철

                      Sorry for missing guidance, I do think an alias is also needed like this:
                      https://gitlab.com/voxl-public/system-image-build/meta-voxl2-bsp/-/commit/e97a22de6b4e5582fc276a963b958d01a478d56b#999b45d40c8aafd81669d788073c2ea1315dac66_66_62

                      Also for this to work, I believe you will want to use the older devcfg.mbn file as well from SDK 1.0.0 as that has trustzone setup for SPI, and the new devcfg.mbn is setup for UART.

                      If trustzone isn't configured correctly I do think the kernel halts on bootup.

                      Flashing devcfg.mbn is like this, which is likely needed once alias is setup, to convert back to SPI from UART.

                      fastboot flash devcfg_a devcfg.mbn
                      fastboot flash devcfg_b devcfg.mbn

                      이광철이 1 Reply Last reply
                      0
                      • modaltbM modaltb

                        Hi @이광철

                        Sorry for missing guidance, I do think an alias is also needed like this:
                        https://gitlab.com/voxl-public/system-image-build/meta-voxl2-bsp/-/commit/e97a22de6b4e5582fc276a963b958d01a478d56b#999b45d40c8aafd81669d788073c2ea1315dac66_66_62

                        Also for this to work, I believe you will want to use the older devcfg.mbn file as well from SDK 1.0.0 as that has trustzone setup for SPI, and the new devcfg.mbn is setup for UART.

                        If trustzone isn't configured correctly I do think the kernel halts on bootup.

                        Flashing devcfg.mbn is like this, which is likely needed once alias is setup, to convert back to SPI from UART.

                        fastboot flash devcfg_a devcfg.mbn
                        fastboot flash devcfg_b devcfg.mbn

                        이광철이 Offline
                        이광철이 Offline
                        이광철
                        Contributor
                        wrote on last edited by
                        #30

                        @modaltb

                        Hi.
                        I try a test on voxl-mini with your advice applied.
                        voxl-mini sdk version is 1.0.0
                        My program and spi device operates is normal.
                        Thanks for your advice.

                        1 Reply Last reply
                        1
                        • H Haxerus referenced this topic on

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        ModalAI
                        Categories Recent Tags ModalAI.com Docs
                        © 2026 ModalAI® · Accelerating autonomy for smaller, smarter, safer drones · Powered by NodeBB
                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups