I am implementing ADS1115 in my application controlling it by Atmel ARM Cortex M7 processor.
I haven't been able to get the conversion result out of the ADS1115 - it always returns 0x85 0x83 no matter what I do.
Here is my Atmel code which follows the ADS1115 datasheet example for continuous conversion:
uint8_t conf_command[4];
uint8_t data_received[2];
conf_command[0] = 0b10010000;
conf_command[1] = 0b00000001;
conf_command[2] = 0b10000100;
conf_command[3] = 0b10000011;
packet_conf.addr[0] = 0;
packet_conf.addr_length = 0;
packet_conf.buffer = (uint8_t *)conf_command;
packet_conf.length = 4;
packet_conf.chip = 0b1001000;
packet_read.addr[0] = 0;
packet_read.addr_length = 0;
packet_read.chip = 0b1001000;
packet_read.buffer = data_received;
packet_read.length = 2;
twihs_master_write(TWIHS0, &packet_conf); //write basic 4-byte configuration (chip address, point to config reg., conf. reg. MSB and LSB)
conf_command[0] = 0b10010000;
conf_command[1] = 0b00000000;
packet_conf.length = 2;
twihs_master_write(TWIHS0, &packet_conf); //set register pointer to conversion result register
conf_command[0] = 0b10010001;
packet_conf.length = 1;
twihs_master_write(TWIHS0, &packet_conf); //tell ADS1115 to prepare for sending data
twihs_master_read(TWIHS0, &packet_read); //read the conversion result
This is the screenshot from my scope with I2C analyzer:
What I can see is that after the first four bytes are sent (0x90 0x01 0x84 0x83), the last byte of this group (0x83) is NACKed and so is NACKed the second readout byte (0x83 again) at the end of the scope trace. The last two bytes 0x85 0x83 are the bytes I am reading out no matter what I do with the converter and it never changes.
Any ideas what I might be doing wrong? Thanks!