I2C reading of 12S battery
-
@Nikos-Mavr Which pins are you using?
i2cdetectis only looking at i2c ports on the Linux (applications) processor. For PX4, the standard i2c ports are mapped to the DSP (aka SLPI) so you wouldn't see them. -
@Eric-Katzfey thank you for the reply. I have tried the j4 with a level shifter and j19 ports. What would be the proper command to see them?
-
@Nikos-Mavr I'm not a hardware guy so not sure on the specifics of proper level shifting, etc. But have you made sure the unit works with some other board first like an Arduino? What is the sen228 module? Is a data sheet publicly available for that? What is the i2c address? J4 / J19 i2c ports should work with PX4 running the correct driver for that module.
-
@Eric-Katzfey the level shifter works properly with arduino right. The power module is holybro PM02D. Both pins are stuck to high which means communication is not successful.
-
Hi @Nikos-Mavr
Please provide a drawing or sketch of your setup in question for the I2C interface, include as many details as possible so I can help you.
Thanks!
Vinny -
@Nikos-Mavr Once you get the signals figured out I added i2cdetect to px4 so you can scan the buses and see if your device is detected. Some rudimentary instructions are here: https://docs.modalai.com/voxl-px4-dev-build-guide/#i2c-debugging. You will need the latest voxl-px4 which is here: http://voxl-packages.modalai.com/dists/qrb5165/dev/binary-arm64/voxl-px4_1.14.0-2.0.135-202603171827_arm64.deb
-
@Eric-Katzfey Yes, that worked, identified bus 4 channel 41. No while INA228 is enabled, I am not sure whether I should change the power_manager in voxl-px4.conf to NONE or EXTERNAL.
-
@Vinny !

-
Thanks @Nikos-Mavr for the drawing, that helped.
The thing to be careful about is the I2C voltage levels.
https://docs.modalai.com/voxl2-connectors/

J19 port I2C's are set to 3.3V with on-board pullups. So, I'm not sure what the 12S module I2C levels are, but be sure they are either (3.3V) or (set by host, i.e.: no pulls on the battery side)
I'm not sure what voltage is feeding into this portion... make sure it is limited to 6S:

Now that Eric has given you a bunch of guidance, let us know if there are still problems overall.
Thanks!
-
@Nikos-Mavr Okay, great, so the I2C is working then. But address 0x41 is an INA226, not an INA228. The PX4 driver indicates that an INA228 has an address of 0x45. And the Holybro data sheet for the PM02D indicates that the lower voltage one for up to 6S battery uses the INA226 while the higher voltage one for up to 12S. Am I reading that correctly? Regardless, it doesn't matter how you set POWER_MANAGER in voxl-px4.conf because that just determines whether it will start the voxlpm driver. But, probably best to set it to EXTERNAL for now. The bigger issue is that the drivers for INA226 and INA228 are not in the image. So they need to be added to the image and then started in the voxl-px4-start startup script located in /usr/bin.
-
@Nikos-Mavr I added the ina226 and ina228 drivers into the build. Updated build can be found here: http://voxl-packages.modalai.com/dists/qrb5165/dev/binary-arm64/voxl-px4_1.14.0-2.0.136-202603180951_arm64.deb
To try it out use the command
qshell ina226 start -X -b 4orqshell ina228 start -X -b 4from the px4 command line to see if the driver sees your device.