reading multiple i2c devices using da14531

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
7 posts / 0 new
Last post
sripathi
Offline
Last seen:6 months 4 days ago
加入:2020-03-18 12:45
reading multiple i2c devices using da14531

We are using da14531 dev kit and trying to communicate with two i2c sensors , azotec trackpad module and mcp23017 gpio expander.We have written drivers for the modules and are able to communicate with the modules independently , however when we are simultaneously trying to communicate with both the modules we are facing an issue. In our code we have declared the i2c config structure as

// Configuration struct for I2C static const i2c_cfg_t i2c_cfg = { .clock_cfg.ss_hcnt = I2C_SS_SCL_HCNT_REG_RESET, .clock_cfg.ss_lcnt = I2C_SS_SCL_LCNT_REG_RESET, .clock_cfg.fs_hcnt = I2C_FS_SCL_HCNT_REG_RESET, .clock_cfg.fs_lcnt = I2C_FS_SCL_LCNT_REG_RESET, .restart_en = I2C_RESTART_ENABLE, .speed = I2C_SPEED_FAST, .mode = I2C_MODE_MASTER, .addr_mode = I2C_ADDRESSING_7B, .address = MCP23017_ADDRESS, .tx_fifo_level = 1, .rx_fifo_level = 1, };

and everytime we are communicating with an i2c device we are setting up the function

i2c_set_target_address(I2cdevice_ADDRESS);

and trying to communicate with the device.

could you kindly point us to some examples about how to communicate simultaneously with multiple i2c devices. we went through the eeprom example but things are not yet clear. many thanks for the help.

PM_Dialog
Offline
Last seen:14 hours 6 min ago
Staff
加入:2018-02-08 11:03
Hi sripathi,

Hi sripathi,

Thanks for your question. So, if I can understand correctly, your requirement is to connect 2 x I2C slaves to same bus. Is my understanding correct?

Thanks, PM_Dialog

sripathi
Offline
Last seen:6 months 4 days ago
加入:2020-03-18 12:45
Hi, Yes

Hi,

Yes

sripathi
Offline
Last seen:6 months 4 days ago
加入:2020-03-18 12:45
Could you please let us know

你能让我们知道任何工作的吗g example with two i2c slaves . Thanks

PM_Dialog
Offline
Last seen:14 hours 6 min ago
Staff
加入:2018-02-08 11:03
Hi sripathi,

Hi sripathi,

Thanks for the clarification. There is not such an example and it is not possible to interact with 2 I2C slave simultaneously and at the same bus. You should interact with only one slave at the same time.

Thanks, PM_Dialog

jsageder
Offline
Last seen:3 months 2 weeks ago
加入:2018-08-22 13:18
Hi,

Hi,
not sure if it still relevant, I solved it by createing an i2c_target_select function, which re-initializes the i2c peripheral with a new set of parameters (eg. different target address). Communication does not happen strictly at the same time but sequentially, as soon as one transfer finished, the other one starts.

The i2c_set_target_address function can unfortunately only be called when the i2c peripheral is diabled and is used by i2c_init to set up the peripheral.

Br, J

PM_Dialog
Offline
Last seen:14 hours 6 min ago
Staff
加入:2018-02-08 11:03
Hi jsageder,

Hi jsageder,

Thanks for your comment and the feedback!

Thanks, PM_Dialog