I am using a PSoC 4200 to communicate with the AFE4404. When I try to read or write to it, I receive a NACK from the AFE4404. Below is my read and write code and the waveform that is sent over I2C when I am trying to write to registers.
Other Notes
- I have tested the code below on other sensors and it works just fine.
- The PCB I am using was designed by someone else and I cannot toggle the RESETZ pin
- I also cannot measure voltages from RESETZ, TX2, INM, and INP
int PulseOx_Read(uint8 reg) { uint8 Write_Buf[1] = {0}; Write_Buf[0] = reg; uint8 Read_Buf[3]={0}; int readVal; DataBus_I2CMasterWriteBuf(AFE_SLAVE_ADDRESS, (uint8 *)Write_Buf, 1, DataBus_I2C_MODE_NO_STOP); while((DataBus_I2CMasterStatus() & DataBus_I2C_MSTAT_WR_CMPLT)==0){} DataBus_I2CMasterReadBuf(AFE_SLAVE_ADDRESS, (uint8 *)Read_Buf, 3, DataBus_I2C_MODE_REPEAT_START); while((DataBus_I2CMasterStatus() & DataBus_I2C_MSTAT_RD_CMPLT)==0){} readVal = Read_Buf[0]; readVal = (readVal << 8) | Read_Buf[1]; readVal = (readVal << 8) | Read_Buf[2]; if (reg >= 0x2A && reg <= 0x2F) { if(readVal & 0x00200000) { readVal = ~readVal + 1; readVal &= 0x003FFFFF; readVal *= -1; } } return readVal; } void PulseOx_Write(uint8 reg, uint32 data) { uint8 Write_Buf[4]; Write_Buf[0] = reg; Write_Buf[1] = (data & 0x00FF0000) >> 16; Write_Buf[2] = (data & 0x0000FF00) >> 8; Write_Buf[3] = (data & 0x000000FF); DataBus_I2CMasterWriteBuf(AFE_SLAVE_ADDRESS, (uint8*)Write_Buf, 4, DataBus_I2C_MODE_COMPLETE_XFER); while((DataBus_I2CMasterStatus() & DataBus_I2C_MSTAT_WR_CMPLT) == 0){} }