This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NR52832 I2C problem

Hi ,

I evaluate the I2c communication of your chip nrf52832. I have few problem.

  1. Write fonction

Is use your Tx fonction,

uint8_t reg[2] = {CCS811_REG_MODE, NORMAL_MODE};
err_code = nrf_drv_twi_tx(&m_twi, CCS811_ADDR, reg, sizeof(reg), false);

Whatever the configuration I can not manage the stop at the end of frameI2cNoStop.png.

  1. Write, restart and Read fonction.

Is use your Tx fonction and your RX fonction,

uint8_t reg[1] = {CCS811_REG_MODE};
err_code = nrf_drv_twi_tx(&m_twi, CCS811_ADDR, reg, sizeof(reg), false);
err_code = nrf_drv_twi_rx(&m_twi, CCS811_ADDR, &sample_data, sizeof(sample_data));

RestartAndReadI2c.png

I join my main.main.c

Can you help me to customize the i2c frames. Do you have other examples?

Thanks by advance Best Regards Guillaume

Parents
  • Hi, I don't know about your first question, but I recently developed something that sounds like your second question. Here's my code to do a write/restart/read. regNum is a uint8_t.:

    // Address and sub-address IMU; no I2C stop 
    ret_code_t err_code = nrf_drv_twi_tx(&SensorTWI, SENSOR_IMU_ADDR, &regNum, 1, true);
    
    // Read nBytes from the specified offset.  This is a "repeated start" from 
    // the transaction started by twi_tx */
    err_code = nrf_drv_twi_rx(&SensorTWI, SENSOR_IMU_ADDR, buf, nBytes);
    

    Hope that helps.

Reply
  • Hi, I don't know about your first question, but I recently developed something that sounds like your second question. Here's my code to do a write/restart/read. regNum is a uint8_t.:

    // Address and sub-address IMU; no I2C stop 
    ret_code_t err_code = nrf_drv_twi_tx(&SensorTWI, SENSOR_IMU_ADDR, &regNum, 1, true);
    
    // Read nBytes from the specified offset.  This is a "repeated start" from 
    // the transaction started by twi_tx */
    err_code = nrf_drv_twi_rx(&SensorTWI, SENSOR_IMU_ADDR, buf, nBytes);
    

    Hope that helps.

Children
No Data
Related