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

TWI, Always get ANACK error?

Hi, when trying to read a register from a chip using the IIC interface,blocking mode:

uint32_t ms5837_cmd_read(uint8_t *data, uint8_t length, uint8_t register_address)
{
uint32_t err_code;
err_code = nrf_drv_twi_tx(&m_twi_ms_5837, MS5837_TWI_ADDR, &register_address ,  1, true);



if (NRF_SUCCESS == err_code)
	
   err_code = nrf_drv_twi_rx(&m_twi_ms_5837, MS5837_TWI_ADDR, data, length, false);
		
	
APP_ERROR_CHECK(err_code);
	return err_code;	
}			

I always get the "enternal error", 0x03.

I looked up the register and found this:

image description

As you can see, there is an ANACK error, suggesting there isn't an ACK after address write.

What should I do to solve this???

Help!!!!

@endnode can you please provide a little insight?

Parents
  • Hi, that's what I initially thought at first, but I have sent some commands prior to it, and on the oscilliscope, it does appear that it is responding. How did I know? The 9th digits of the i2c format are low, which indicates that the slave device is responding - unless of course something else is pulling the data wire low, which is very unlikely because A. I'm positive other devices are offline; B. the "low" came right after I sent the correct address.

    The prior successful communication took place like this:

    Master sends target device address - slave responds by pulling down at 9th clock signal -> Master sends target register address (reset) - slave responds by pulling down at 9th clock signal.

    The above described is the resetting procedure, but when it comes to reading, everything seems to be in the dump. Based on your experience, what could be causing this unresponsiveness, after prior responsiveness?

Reply
  • Hi, that's what I initially thought at first, but I have sent some commands prior to it, and on the oscilliscope, it does appear that it is responding. How did I know? The 9th digits of the i2c format are low, which indicates that the slave device is responding - unless of course something else is pulling the data wire low, which is very unlikely because A. I'm positive other devices are offline; B. the "low" came right after I sent the correct address.

    The prior successful communication took place like this:

    Master sends target device address - slave responds by pulling down at 9th clock signal -> Master sends target register address (reset) - slave responds by pulling down at 9th clock signal.

    The above described is the resetting procedure, but when it comes to reading, everything seems to be in the dump. Based on your experience, what could be causing this unresponsiveness, after prior responsiveness?

Children
No Data
Related