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

Is nrf_drv_twi and NRF_DRV_TWI_XFER_DESC_TXTX working properly?

SDK: nRF5_SDK_11.0.0-2.alpha_bc3f6a0 Chip: NRF52

If I perform a TXTX transfer using the twi driver, it sends a repeated start/stop bit in between the two transmits. Is this the correct behavior? I typically use a TXTX transfer to write to a register, but since theres a start bit in between it doesn't work with the i2c slave device im using.

Thanks

  • Hi

    Just to be clear I assume you want to do something like this:

    "DEVICE ADDRESS+W" + "ADDRESS TO REGISTER IN DEVICE", + "RANDOM NUMBER OF DATA BYTES"?

    but now, with TXTX, it looks like this:

    "DEVICE ADDRESS+W" + "ADDRESS TO REGISTER IN DEVICE", + "REPEATED START" +"DEVICE ADDRESS+W" + "RANDOM NUMBER OF DATA BYTES"?

    I'm familiar with your problem and so is the SDK team. However, they had some troubles integrating a seamless TXTX functionality before the release of the new SDK 11. Anyway, I believe that the repeated start is what the SDK team initially intended with TXTX. The objective was to allow a master to send data to several slaves consecutively without having to give up control over the TWI bus.

    As you may know though, it is possible to achieve what you want with the drivers from SDK 10 and earlier. It requires some work to merge the old drivers into an SDK 11 project, but it is possible. If you are unable to do this my only suggestion is to write some code that merges your two buffers before you transmit everything in one go.

    I'll report your case to the SDK team and hopefully we will get a fix in a future SDK release.

  • Thats exactly what I was looking to do. I was able to accomplish it by adding a no_start argument to the twi_tx_start_transfer function and setting it to true on the second transmit in a TXTX. If its set to true then NRF_TWI_TASK_STARTTX task is not triggered.

Related