Hello,
I would like to implement an I²C communication between a nrf52840 and a MCP3221 (which is an ADC).
The first 7-bit of the MCP3121 are 0b1001101. I guess the slave address is 0x4D.
I developed the following function in order to communication with the MCP3221.
ret_code_t I2C_register_read(uint8_t slave_addr, uint8_t reg_addr, uint8_t * pdata, uint32_t bytes)
{
ret_code_t ret_code;
ret_code = nrf_drv_twi_tx(p_twi_master,slave_addr, ®_addr,1,false);
if(ret_code != NRF_SUCCESS)
{
return ret_code;
}
ret_code = nrf_drv_twi_rx(p_twi_master,slave_addr, pdata, bytes);
return ret_code;
}
I think that slave_addr=0x4D but I don't know what reg_addr to use.
When I read the MCP3121 datasheet, it appears that there is no register. So what register address (reg_addr) am I suppoed to use ? Shall I use other TWI function ?
Thank you for your help !