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

nrf_drv_twi doesnt read multiple bytes in SDK 12.2

I am trying to use the function or any function with my BLE UART application. I have a timer that expires to kickoff reading of some sensors and then when I try to read my sensor it only writes the address and data register then reads the the device address and stops at one byte regardless of what argument I place in length to receive. The even wierder thing is in a stnadalone non softdevice application I test my I2C devices and it reads all 3 data bytes if I place a breakpoint before the read here is my code snippet.

static void read_sensor_data()

	ret_code_t err_code = 0;
	m_xfer_done = false;
	uint8_t m_txbuf = LM75B_REG_TEMP;
	uint8_t m_sample = 0;

	nrf_drv_twi_tx(&m_twi, LM75B_ADDR, &m_txbuf, 1, false);
	while (m_xfer_done == false);

	m_xfer_done = false;
/* Read 1 byte from the specified address - skip 3 bits dedicated for fractional part of temperature. */
ret_code_t err_code = nrf_drv_twi_rx(&m_twi, LM75B_ADDR, &m_sample, 3);
	while (!m_xfer_done);
Related