I'm having trouble sending more than 256 bytes over TWI.
nRF52840
SDK17.0.2
Used Function :
ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * p_instance,
uint8_t address,
uint8_t const * p_data,
uint8_t length,
bool no_stop)
ret_code_t nrf_drv_twi_rx(nrf_drv_twi_t const * p_instance,
uint8_t address,
uint8_t * p_data,
uint8_t length)
I have to send 8,208 Bytes continuously through the TWI interface in the above environment.
There should be no STOP/START bits in the middle.
However, if I divide by 255 bytes and send, there is a STOP/START bit in the middle.
I set no_stop to true , but the STOP/START bit is present.
(no_stop = true)
I've searched Devzone and I have a similar issue. But I can't solve the above problem.
And I have one more question.
I do not know the SUSPEND function in the middle part of the twi_send_byte function as shown below.
Is this part used when transmitting more than 256 bytes of data without STOP/START bit?
Please provide a detailed explanation. Thank you in advance.
static bool twi_send_byte(NRF_TWI_Type * p_twi,
twi_control_block_t * p_cb)
{
if (p_cb->bytes_transferred < p_cb->curr_length)
{
nrf_twi_txd_set(p_twi, p_cb->p_curr_buf[p_cb->bytes_transferred]);
}
else
{
if (p_cb->curr_tx_no_stop)
{
nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_SUSPEND);
return false;
}
else if(TWI_FLAG_SUSPEND(p_cb->flags))
{
nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_SUSPEND);
p_cb->prev_suspend = TWI_SUSPEND_TX;
return false;
}
else
{
nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP);
}
}
return true;
}