suspend i2c does NOT reduce current?

Hi,

The custom board is 52832 with st lsm6dsr sensor.

I tried to suspend i2c by this code: 

Fullscreen
1
2
3
4
5
6
#define I2C_INST DT_NODELABEL(i2c0)
const struct device *const i2c = DEVICE_DT_GET(I2C_INST);
int rc = pm_device_action_run(i2c, PM_DEVICE_ACTION_SUSPEND);
if (rc < 0) {
LOG_ERR("Could not suspend i2c (%d)\n", rc);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

It worked with no errors. 

But when I measure the current, its the same whether the i2c is suspended or resumed. There is NO power saving at all. I checked the config, it has following:
CONFIG_I2C_NRFX=y
CONFIG_I2C_NRFX_TRANSFER_TIMEOUT=500
CONFIG_I2C_0_NRF_TWI=y
CONFIG_I2C_INIT_PRIORITY=50 

Questions:
1. How to reduce current by suspend i2c/twi? Is there any configuration I should do?  When with SDK, disable twi can reduce significant current. 

2. For 52832, how to make it into low power mode?

Thanks,

Parents
  • Hi,

    You could start by reading about recommendations for power optimization. Specifically, you could look at the example of putting external flash into sleep mode in inactivity periods

    You could try to disable I2C interface in the sensor driver and see if this helps in current reduction.

    Please let me know if you have any further questions.

    Best regards,
    Dejan

  • Dejan,

    Thanks for your reply. Yes I do want to know why there is no current reduction after i2c device suspended. I measured it keeps the high current even after disconnect. 

    After flash, when the board start advertising, the current is 0.13mA.

    With i2c active, the current is 1.6mA.

    With sensor data notification, the current is 1.6mA.

    Then stop data notification and disconnect, the current keeps 1.6mA.

    How to put i2c off? 

    Thanks,

  • Hi,

    dejans said:
    You could start by reading about recommendations for power optimization. Specifically, you could look at the example of putting external flash into sleep mode in inactivity periods

    Did you find these links useful?

    kfcube said:
    How to put i2c off? 

    I2C driver can be disabled by specifying CONFIG_I2C=n.  

    Best regards,
    Dejan

  • DeJan,

    Thanks for your reply. I did read the links you shared but I didn't find anything useful. I didn't enable uart/serial, and I didn't use any external flash. 

    I have suspended i2c the way as your links about external flash, but the current not change at all. The help I need is how to lower current when I stop using i2c.

    As I have stated very clearly, that before the i2c used, the current is LOW so there is no need to fine tuning pins/ peripherals/etc. After i2c used, it becomes HIGH and I can't lower it. So the problem is i2c, not others.

    I can't config disable i2c because I need it. All I need to know is how to lower current when I don't need it. 

    So would you mind give me solid help rather than just sharing some links I have read?

    Thanks,

  • Hi,

    Which NCS version do you use? Which NCS sample is your project based on?

    Could you provide detailed information on how you measure current on your end?

    Could you please also show your measurement setup?

    Best regards,
    Dejan

Reply
  • Hi,

    Which NCS version do you use? Which NCS sample is your project based on?

    Could you provide detailed information on how you measure current on your end?

    Could you please also show your measurement setup?

    Best regards,
    Dejan

Children
  • NCS2.4.2   

    Other questions not really matters to the case.

  • Hi,

    Could you try to add configuration options shown below to your configuration file?

    Fullscreen
    1
    2
    CONFIG_PM_DEVICE=y
    CONFIG_PM_DEVICE_RUNTIME=y
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Best regards,
    Dejan


  • Dejans, Thanks for your suggestion. I added those two conf items. The current down to 1.44mA after i2c suspended. So its working. However, I still can't make the current down to 0.13mA which is before i2c active. 

    Any other configuration should i set?

    Thanks,

  • Hi,

    Could you provide your full project configuration?

    Best regards,
    Dejan

  • Hi,

    Here is my full project conf:

    CONFIG_BT=y
    CONFIG_BT_SMP=n
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DIS_PNP=n
    CONFIG_BT_BAS=y
    CONFIG_BT_ATT_ENFORCE_FLOW=n
    CONFIG_CBPRINTF_FP_SUPPORT=y
    CONFIG_ADC=y

    CONFIG_SENSOR=y
    CONFIG_I2C=y
    CONFIG_PINCTRL=y
    CONFIG_GPIO=y

    #power mgmt
    CONFIG_PM_DEVICE=y
    CONFIG_PM=y
    CONFIG_PM_DEVICE_RUNTIME=y

    #throughput
    CONFIG_BT_PERIPHERAL_PREF_MIN_INT=6
    CONFIG_BT_PERIPHERAL_PREF_MAX_INT=6
    CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400


    CONFIG_BT_BUF_ACL_RX_SIZE=502
    CONFIG_BT_ATT_PREPARE_COUNT=2
    CONFIG_BT_L2CAP_TX_BUF_COUNT=10
    CONFIG_BT_L2CAP_TX_MTU=498
    CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
    CONFIG_BT_CONN_TX_MAX=10
    CONFIG_BT_BUF_ACL_TX_COUNT=10
    CONFIG_BT_BUF_ACL_TX_SIZE=502

    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251

    Other than the power management documents, I also read source code of twi related and found the twi is disabled after each single transfer. So the issue is 52832 doesn't lower down current after i2c operation,  I tested and just one single read/write through i2c the current rised and not back.

    I am using twi, not twim, so it shouldn't be erratum 89 issue.

    So anything wrong with my configuration?

    Thanks,