ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    SPI port for VOXL2 SLPI DSP

    VOXL 2
    3
    17
    534
    Loading More Posts
    • 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.
    • ?
      A Former User
      last edited by

      @Eric-Katzfey Thanks alot for your prompt response and all the links. I would go through the same and come back for further queries.

      1 Reply Last reply Reply Quote 0
      • ?
        A Former User
        last edited by

        @Eric-Katzfey I was going through the optical flow device driver on PX4 firmware side and had some thoughts which would need some validation.

        • I would have to write device driver for optical flow sensor similar to voxl-lepton-server on apps_proc side and then publish results over muorb topic as you said, but muorb topics publication and subscription would be part of PX4 process running on apps_proc side then how can my driver seamlessly interact with PX4?
        Eric KatzfeyE 1 Reply Last reply Reply Quote 0
        • Eric KatzfeyE
          Eric Katzfey ModalAI Team @Guest
          last edited by

          @Aks The first question would be which optical flow sensor are you using? Is there already a PX4 driver for it? If so, maybe you can just try to get that working on the applications processor. If you need to write a completely new driver for it then you can follow the example of one of the other PX4 optical flow sensor drivers. Does it also have an integrated distance sensor? The links I provided were just to show you how we use the SPI bus on the applications processor. But you wouldn't want to have it as an external process like that. You would want your device driver to be integrated as a PX4 device driver.

          1 Reply Last reply Reply Quote 0
          • ?
            A Former User
            last edited by

            @Eric-Katzfey Thank you for the response. I am using this optical flow sensor. It works on PWM3901 and already has optical flow driver for the same in PX4. This sensor also has distance sensor over I2C where I can use J19 I2C port for getting distance sensor data into PX4. Now I can get optical flow SPI driver working on application processor but my query is how can I publish optical flow data over muorb from application processor process which is not running inside PX4 application?

            1 Reply Last reply Reply Quote 0
            • ?
              A Former User
              last edited by

              EDIT :

              I would rephrase my question a bit since I would need to run optical flow device driver integrated inside PX4. How can I run optical flow device driver on PX4 application processor side of code by accessing J10 SPI port?

              Eric KatzfeyE 1 Reply Last reply Reply Quote 0
              • Eric KatzfeyE
                Eric Katzfey ModalAI Team @Guest
                last edited by

                @Aks I think you would add the vl53l1x driver to the DSP build and add the pmw3901 driver to the apps build. That way the distance sensor can use the i2c bus available on j19 and the optical flow sensor can use the spi on the applications processor.

                1 Reply Last reply Reply Quote 0
                • ?
                  A Former User
                  last edited by

                  @Eric-Katzfey Thank you for the inputs. I did the changes to build distance sensor on DSP build and assigned I2C port also to it. Now I have enabled optical flow on application processor side but I dont know how to link SPI port J10 to optical flow driver in the code. Please help.

                  Eric KatzfeyE 1 Reply Last reply Reply Quote 0
                  • Eric KatzfeyE
                    Eric Katzfey ModalAI Team @Guest
                    last edited by

                    @Aks Looks like /dev/spidev14.0 is the one mapped to J10. We haven't used that port in PX4, only in our own applications. That is why I sent those links above. They show you how we use the SPI port on the applications processor in a non-PX4 application. You would need to look at how the SPI port is used and compare that against the Posix platform implementation of the SPI driver in PX4 to see if you can use it as is or if you will need to make modifications to it.

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      Aaky @Eric Katzfey
                      last edited by

                      @Eric-Katzfey Hi Eric, I am working on same above integration and stuck at adding SPI section to posix device driver of PX4. Do you have any guidance on integrating PMW3901 over application processor SPI bus on J10?

                      Eric KatzfeyE 1 Reply Last reply Reply Quote 0
                      • Eric KatzfeyE
                        Eric Katzfey ModalAI Team @Aaky
                        last edited by

                        @Aaky Have you reviewed this documentation from PX4: https://docs.px4.io/main/en/sensor/pmw3901.html?

                        A 1 Reply Last reply Reply Quote 0
                        • A
                          Aaky @Eric Katzfey
                          last edited by

                          @Eric-Katzfey Yes I have reviwed this document in PX4 and also I got the driver compiled atleast on application processor side. Now I need to hookup the sensor to J10 with distance sensor on J19 I2C and check if its working.

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            Aaky @Aaky
                            last edited by Aaky

                            @Eric-Katzfey One last doubt I have is as attached in snapshot below I am setting first argument to initSPIBus function as 14 since J10 has SPI device file as /dev/spidev14.0. Also the second argument to initSPIDevice function is 0. I think this is chip select for SPI but I read somewhere for posix drivers, chip select isnt used by SPI peripherals. Is my understanding correct?

                            This is spi.cpp file which I have added in boards/modalai/voxl2/src folder in voxl-px4 repository.

                            Screenshot from 2024-04-09 21-31-25.png

                            Eric KatzfeyE 1 Reply Last reply Reply Quote 0
                            • Eric KatzfeyE
                              Eric Katzfey ModalAI Team @Aaky
                              last edited by

                              @Aaky Unfortunately, we have not done any integration between PX4 and SPI devices on the apps processor. I would get an oscilloscope and see what is happening on the bus.

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post
                              Powered by NodeBB | Contributors