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

TWI restart condition after a rx operation (IQS263)

Hello,

I need to interface with a touch sensor from Azoteq (IQS263). This device allows a communication window during which you can read or write on I2C. The issue is that the sensors closes the communication window as soons as it detects a stop condition. As a result, i cannot read several registers from it during this communication window (only one, then i get NACK). From i can see, the SDK16 does not allow restart condition after a rx operation.

Is there a way to solve this issue ? If someone has already face it, feel free to share Slight smile

Best regards,

Aurélien

Parents Reply
  • Thank's for these informations. I tried to modify the legacy driver : nrfx_twi.c file in that way : 

    extern bool rx_no_stop;
    static bool twi_receive_byte(NRF_TWI_Type         * p_twi,
                                 twi_control_block_t  * p_cb)
    {
        if (p_cb->bytes_transferred < p_cb->curr_length)
        {
            p_cb->p_curr_buf[p_cb->bytes_transferred] = nrf_twi_rxd_get(p_twi);
            ++(p_cb->bytes_transferred);
    
            if ((p_cb->bytes_transferred == p_cb->curr_length - 1) && (!TWI_FLAG_SUSPEND(p_cb->flags)))
            {
                nrf_twi_shorts_set(p_twi, NRF_TWI_SHORT_BB_STOP_MASK);
            }
            else if (p_cb->bytes_transferred == p_cb->curr_length && (!TWI_FLAG_SUSPEND(p_cb->flags)))
            {
                if (rx_no_stop)
                {
                    nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_SUSPEND);
                    p_cb->prev_suspend = TWI_SUSPEND_RX;
                }
                return true;
            }
            else if (p_cb->bytes_transferred == p_cb->curr_length && TWI_FLAG_SUSPEND(p_cb->flags))
            {
                p_cb->prev_suspend = TWI_SUSPEND_RX;
                return false;
            }
            nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_RESUME);
        }
        return true;
    }

    but without success.

    I tried also to use the deprecated driver but unfortunatly it is still not working. Im still having  a stop sent at the end of my RX ...

Children
Related