Hi,
I'm using the PCA1040 with the SDK11.0.0. For now I'm trying to communicate with the TWI as the example twi_sensor indicates. The problem comes when I try to do two nrf_drv_twi_tx in a row. The second APP_ERROR_CHECK makes a reset on the chip:
void initial_configuration(void)
{
ret_code_t err_code;
err_code = register_write((uint8_t)(0x02), (uint8_t)(0x00));
APP_ERROR_CHECK(err_code);
err_code = register_write((uint8_t)(0x08), (uint8_t)(0x04));
APP_ERROR_CHECK(err_code);
err_code = register_write((uint8_t)(0x09), (uint8_t)(0x00));
APP_ERROR_CHECK(err_code);
The write function is as follows:
ret_code_t register_write(uint8_t register_address, uint8_t value)
{
uint8_t device_address=0x47;
uint8_t w2_data[2];
w2_data[0] = register_address;
w2_data[1] = value;
return nrf_drv_twi_tx(&m_twi, device_address, (const uint8_t* )(w2_data), sizeof(w2_data), false);
}
I've read here that is not possible to do following calls to nrf_drv_twi_tx on this SDK version devzone.nordicsemi.com/.../
Could you explain a little more how to merge the data when I have to do multiple nrf_drv_twi_tx in the same section as the previous answer outlines?
Thanks, JosePastor23