lis3mdl magnetometer
-
Hi, I'm trying to connect a LIS3MDL compass to the voxl 2 mini through the i2c ports on j19, I have it connected to pins 1,4,5,6 for power scl sda ground. Specifically https://www.amazon.com/gp/product/B084HL3R1Y/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1
Is this magnetometer supported on the voxl 2 mini px4? I tried px4-listener sensor_mag and it gives never published.
I see in the px4-firmware on git it has stuff for the lis3mdl so is there something I need to do to enable it?
https://gitlab.com/voxl-public/flight-core-px4/px4-firmware-ci/-/tree/master/src/drivers/magnetometer/lis3mdl?ref_type=heads -
@mkriesel In order to add new sensors you need to add them into the build and enable them in the startup script. This, obviously, requires that you are able to build px4. Once you can do that you can add new drivers / modules into https://github.com/modalai/px4-firmware/blob/voxl-dev/boards/modalai/voxl2-slpi/default.px4board. The startup script is, on target,
/usr/bin/voxl-px4-start
. It's here in the repo: https://github.com/modalai/px4-firmware/blob/b5c45bb232afc6a936b8349f4fa0be1efeb17707/boards/modalai/voxl2/target/voxl-px4-start#L89 -
@mkriesel Can you use qmc5883l or ist8310 instead? Those two are already supported directly.
-
@Eric-Katzfey understood, I wanted to use px4 to do some testing and confirm it works but I plan on interfacing with it directly outside of px4, thanks for the help.
-
@Eric-Katzfey Hello again, question on accessing things plugged into the j19 i2c port, how would I access them outside of px4? I saw this https://forum.modalai.com/post/13604 so I'm guessing I can't use /dev/i2c-0 to acccess that port, however looking through the px4 for referenec it seems like it does use the app proc https://github.com/modalai/px4-firmware/blob/7fbbdc31e8a61525777d8edcf8f339a738abf138/src/lib/drivers/device/posix/I2C.cpp#L87 So is this the correct way to do it or is there something else I have to do?
-
@mkriesel That is the i2c driver code for the "posix" px4 platform, or apps side. That won't help with J19 which is only available to the dsp. We don't currently provide a way to access those i2c outside of px4.
-
@Eric-Katzfey is it possible for you to provide me the code that interfaces with the j19 i2c in px4 so I can look at if I wanted to write my own interface with that port?
-
@mkriesel At a high level it is a driver like: https://github.com/PX4/PX4-Autopilot/tree/main/src/drivers/magnetometer/isentek/ist8310. This, on the Qurt platform, will end up using this low level driver: https://github.com/PX4/PX4-Autopilot/blob/main/src/lib/drivers/device/qurt/I2C.cpp
-
@Eric-Katzfey Hello
I've looked through px4 and I'm alittle lost on how exactly this all works maybe you can give alittle more detail. I understand the the ports are configured to the spli proc to be used on the dsp but where extacly does this interface, In I2C.cpp you showed above it sets all the functions to null and then they get decalred on init but I can't find where they actually interface with the i2c registers.After that would I need to compile my program with Hexagon SDK or is it possible at all to interface with this i2c port in the normal Ubuntu environment at all?My understanding is that the uart on the same J19 is configured in the same way but I can access those through the libqrb5165-io and voxl-io.h so is there something similar available for i2c or could I implement my own in a similar way and if I could how would I go about doing this?
-
@mkriesel The low level driver is Qualcomm proprietary so we cannot share it. But you don't need to look at that code to use an i2c port. You just need to use the interface functions provided by px4.
-
@mkriesel Yes, you would need to compile the DSP code with the Hexagon SDK.
-
@mkriesel You cannot access the DSP i2c ports from the applications processor.
-
@mkriesel We don't have any immediate plans to add dsp i2c access to libqrb5165-io.
-
@Eric-Katzfey Hi again, sorry for all the questions but for an update, I was able to get the compass working for my application by using the mavlink pipe and for now this is sufficient, however if I wanted to reconfigure the port to have it on the application processor instead could I do that? Again, it doesn't matter if I lose functionality in px4 because I don't plan to use it if I don't have to but if those GPIO pins are available I would like to explore that option.
Thanks for all the help so far.
-
@mkriesel The VOXL 2 does not have any i2c brought out to connectors for the applications processor. However, there are some add-on boards that do include this. For example: https://docs.modalai.com/usb2-type-a-breakout-add-on/
-
@Eric-Katzfey I undertand you do not have any Voxl 2 mini schematics open to the public but is it possible for you to share with me the gpio pins that J19 are on for the QRB5165 board?
-
https://docs.modalai.com/voxl2-mini-connectors/#j19---external-sensors-2x-uart-2x-i2c
here is a link for voxl2 (not mini) : https://docs.modalai.com/voxl2-connectors/
does this help?
-
@Alex-Kushleyev @mkriesel , I just updated that table to include the raw GPIO numbers.
However, I'm certain that they are unusable as GPIOs due to Trust Zone settings we have applied using them as I2C/UART etc. -
Hi @mkriesel
Have you seen this product we offer? This may be something that interests you:
https://docs.modalai.com/voxl2-dev-test-board/Our purchase link is buried in our beta section due to the risk of such product:
https://www.modalai.com/pages/beta-voxl-2-b2b-breakout-board
It includes a lot of extras not posted such as a tray to hold everything together, an SD Card, many cables, and several jumpers to get you going.
Hope this helps! -
@Vinny Thanks for the help on this I really appreciate it. I'll take a look.