Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Why does TWIM driver execute SUSPEND when NO_SPURIOUS_STOP is specified?

Dear

I'm working on controlling an I2C device.

I want to achieve TX->TX using the nrfx_twim driver.
I specified NRFX_TWIM_XFER_TXTX.
When I looked at the nrfx_twim source code, I saw that it sets NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK.
Why would I use this?

Parents
  • Hi,

    NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK is like a shortcut which connects the LASTTX to the SUSPEND task in the hardware. So what basically happens is that, after the LASTTX event, instead of a STOP condition (which forces the TX to release the bus), a SUSPEND is instead given, so that the bus need not be released yet, as there will be a new TX that's going to happen. You could say that it's like the repeated START condition in a usual TWI scenario.

    So when you use the NRFX_TWIM_XFER_TXTX, the NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK is also enabled so that there is no interruption between the first TX and the next, i.e. a STOP condition is not enabled for smoother transactions.

    -Priyanka

  • Thanks.

    What happens if all shortcuts are not specified?
    Wouldn't that also result in a STOP condition?
    I'd like to know why it is necessary to set it to SUSPEND instead of not specifying all shortcuts.

  • If no shortcuts are specified, obviously a STOP condition will be initiated. And hence we prefer setting a SUSPEND, because this prevents an immediate STOP condition.

    If a STOP is initiated, then after the first transmission, the master will have to give up the bus and START again, and in the meantime if some other device gains bus control, then we will have to wait until we get control again, in order to START the next TX.

    -Priyanka

  • Thanks.

    How is that different from specifying the LASTTX_STOP shortcut?

Reply Children
Related