SPI port for VOXL2 SLPI DSP
-
@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?
-
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?
-
@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.
-
@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.
-
@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. -
@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?
-
@Aaky Have you reviewed this documentation from PX4: https://docs.px4.io/main/en/sensor/pmw3901.html?
-
@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.
-
@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.
-
@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.