• TI thinks resolved

Linux/INA223: Linux kernel driver & application for INA223

Part Number: INA223

Tool/software: Linux

Hi Sir,

We are using the INA223 for voltage/current monitoring on one of our arm boards.

It is interfaced on I2C BUS and the board is up with linux kernel v4.1.15

I am wondering whether there is any linux driver and user space application available to spped up our development on using this device ?

your help is greatly appreciated. Looking forward for your response.

Please do let me know if you need more information.



  • In reply to siva prasad15:

    Hey Siva,

    The configuration register address is 0x00. This is because this is the only register in the device. You will write to this register (0x00) in order to set gains for shunt and bus voltage measurements and to set the output mode settings (Table 1 in datasheet). Since there is only one register in the device, once the pointer is set a 0x00, then you can obtain measurements with 3-byte read commands as shown with Figure 40.

    The i2c-tools library in Linux provides a basic library to communicate with devices over the command line. The Linux driver is there to provide device-specific functions in the memory of whatever your system may be. This will make the writing firmware easier.

    Peter Iliya
    Current Sensing Applications
  • In reply to siva prasad15:

    Hi Peter,

    Now I am able to see the ina223 device under

    # cat /sys/class/hwmon/hwmon0/name

    # cat /sys/class/hwmon/hwmon0/curr1_input
    # cat /sys/class/hwmon/hwmon0/in0_input
    # cat /sys/class/hwmon/hwmon0/name
    ~# cat /sys/class/hwmon/hwmon0/power1_input

    in the dmesg, I can see the 

    ~# dmesg | grep ina223
    [ 0.246615] i2c i2c-3: of_i2c: register /soc/aips-bus@30800000/i2c@30a50000/ina223@41
    [ 0.246772] i2c i2c-3: client [ina223] registered with bus id 3-0041
    [ 1.871869] ina223 3-0041: probe
    [ 1.872693] ina223 3-0041: power monitor ina223 (Rshunt = 10000 uOhm)
    [ 1.877880] i2c-core: driver [ina223] registered
    [ 4.551582] ina223 3-0041: uevent
    [ 4.635567] ina223 3-0041: uevent
    [ 4.635820] ina223 3-0041: uevent
    [ 4.636053] ina223 3-0041: uevent

    Now at this stage, I am not sure how to read the current & voltage readings from the driver populated sys filesystem. Could you please assist.

    How can i change the configuration register value from the sysfs using the ina223 driver.

    Please provide me your inputs on this topic. Looking forward for your response

    Best Regards,


  • In reply to siva prasad15:

    You cannot read the current or voltage from the INA223 over I2C, it is an analog output only device, not I2C. The I2C interface is only used to select which signal is sent out of the analog output pin, you have to then sample that signal yourself.

    If you are wanting to read these values over I2C then please select one of the devices in this series that does have an internal ADC. If you would also like Linux support I would recommend one of the devices listed in the Linux driver, as these are already supported.