This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nrf9160 I2C Master Mode Callbacks

Hello everyone,

I am trying to implement the OPTIGA Trust M from Infineon with the nrf9160. Unfortunately I encountered some problems regarding this topic.

I am trying to communicate with the Optiga Chip via I2C in Master Mode and I am trying to use the Optiga library acquired here: Library.

So far I successfully got the device binding for the I2C_1 with the following configurations:

prj.conf :

# Enable I2C/TWI
CONFIG_I2C=y
CONFIG_I2C_1=y

 i2c-init:

optiga_pal_i2c_context_0.p_i2c_hw_config = device_get_binding("I2C_1");

  optiga_pal_i2c_context_0.slave_address = 0x30;

  if (optiga_pal_i2c_context_0.p_i2c_hw_config == NULL)
  {
    printk("\nERROR: I2C device binding \n");
    return;
  }

  ret = i2c_configure(optiga_pal_i2c_context_0.p_i2c_hw_config, (I2C_SPEED_FAST<<1) | I2C_MODE_MASTER);
  if(ret != PAL_I2C_EVENT_SUCCESS)
  {
    printk("\nERROR: I2C Master and Speed set failed.\n");
    return;
  }

So far this seams to be working. Unfortunately the Optiga library needs certain callbacks, which are end_of_transmit and end_of_receive.

The drivers/i2c.h library only lists such callbacks for slave configuration, but not for the Master configuration.

So my question is if there are such callbacks for the I2C Master mode.

Best regards,

Andreas

Parents
  • Hi Andreas,

    The Zephyr I2C APIs does not provide callbacks/events when a master write operation has completed. You could perhaps consider using the nrfx driver directly, or ask Infineon how you can adapt their library to be used without such an event.

    Einar

Reply
  • Hi Andreas,

    The Zephyr I2C APIs does not provide callbacks/events when a master write operation has completed. You could perhaps consider using the nrfx driver directly, or ask Infineon how you can adapt their library to be used without such an event.

    Einar

Children
Related