PX4 Arduino I2C Setup Help Required (devid 0)

Hello everyone,

I’ve been trying to work on a driver to send some data over the external I2C bus to the Arduino.

The end goal is to be able to use the Arduino for Actuation and measurement of sensor values. I have seen other posts on here dealing with Arduino and logging the sensor values using PX4.

The problem I am facing is with the connection establishment.
I based my driver on the example setup given at the developer documentation for integrating I2C devices.
When I call start the driver manually from the nsh, and the debug print shows that the devid is shown as 0.
If I try to use the transfer() function, Pixhawk reboots.

The device ID documentation here talks about encoding and decoding of DevId. I was not able to find any information on where I could go on to add the devId

I understand that these would be the details I would have to set for the devid, but am unclear on where to set it.

struct DeviceStructure {
  enum DeviceBusType bus_type : 1; // I2C bus
  uint8_t bus: 1;    // External I2C bus 1
  uint8_t address;   //  0x5C - I2C device address
  uint8_t devtype;   // DRV_I2C_DEVTYPE_ARD

Let me know if anything else is required.

TL;DR: Px4-Arduino connection over I2C. Init failing (guessing because of devid 0). Help needed with setting devid in firmware.

Thanks in advance!