How to prevent STOP bit after a TWI rx command?

I am working with an IQS572 capacitive touch IC, and when communicating with this IC, the communication window will shut down if it receives a STOP bit.

I am writing a lot of configs to the IC registers, and want to do a variety of register reads and writes. Using the NRF_DRV_TWI_FLAG_TX_NO_STOP flag for my TWI TX commands, I can avoid the issue of a premature communication termination just fine. However, there is no similar flag for TWI RX commands, such as when I want to read a register and learn its contents.

How can I set up my TWI RX commands so that they do not send a STOP bit at the end? I understand there is no easy flag for this situation, but I dont know what I need to edit under-the-hood in order to enable this functionality. Specifically, I am using the TXRX descriptor for these TWI read xfers.

Parents
  • Hi,

    I have tried to look at the driver, but I can't find that your use case is supported. It looks like all defined macros that show usage of twi transfer all ends with a stop condition and a stop interrrupt. 

    My suggestion would be to create a new macro, for instance based on the implementation of NRFX_TWIM_XFER_RX:

        case NRFX_TWIM_XFER_RX:
            nrf_twim_rx_buffer_set(p_twim, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length);
            nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTRX_STOP_MASK);
            p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK;
            start_task = NRF_TWIM_TASK_STARTRX;
            nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME);
            break;

    But instead you should not enable the STOPPED interrupt mask and not enable the lastrx to stop shortcut. Likely you should instead enable the LASTRX interrupt mask, and not have any shortcuts enabled. Then in the twim_irq_handler() you would want to add handling of the LASTRX interrupt, this should be similiar to handling the STOPPED interrupt (;check and clear event, disable interrupt, and possible call the callback handler).

    Best regards,
    Kenneth

  • a little bit late to the party 

      did the suggestion of  work for you? I have a similar problem to solve...

Reply Children
No Data
Related