Servers by jDrones

Enabling i2c tool in the PX4 NuttX nsh shell


(rrr6399) #1

Hi,

I would like to enable the i2c tool in the nsh shell to quickly see which i2c devices are connected on the i2c buses and to interactively interact with those devices from the shell. This is the i2c module:
https://github.com/PX4/NuttX/tree/master/apps/system/i2c

I’ve set
CONFIG_SYSTEM_I2CTOOL=y
in the
ardupilot/modules/PX4Firmware/nuttx-configs/px4fmu-v3/nsh/defconfig file.
and verified that it gets copied to
ardupilot/build/px4-v3/modules/PX4Firmware/px4fmu-v3/NuttX/nuttx/.config
using the waf build.

But, the i2c command does not appear in the nsh when I connect to the console using my FTDI cable to the console port.

Has anybody been able to enable the i2c command in nsh?

I saw this blurb, do you know if we compile it in protected, supervisor kernel mode:

“NOTE 2: This I2C tool uses direct I2C device interfaces. As such, it
relies on internal OS interfaces that are not normally available to a
user-space program. As a result, the I2C tool cannot be used if a
NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL).”

Thanks,

Rob