I am trying to Access the AD7998 using the FT260 USB to I2C module. I am trying to access one channel at a time. I am able to read channel 1 just fine, but can't read the rest of the channels.
I tried using Mode 2 and sending repeated starts, but kept getting channel 1 on every Chanel. So I switched to trying each channel one by one.
My SPI port first sends three bytes after the device address 0x21
I send 0x02,0x00,0x10 as seen below
WriteByteBuf[0] = 0x02; //Register pointer to Configuration Register
WriteByteBuf[1] = 0x00; // Config Reg High byte--If 1 Convert CH8,C7,CH6,CH5
WriteByteBuf[2] = 0x10; // Config Reg Low byte--Convert CH4,CH3,CH2,CH1, Filer on
numBytesToWrite = 3;
Marshal.Copy(WriteByteBuf, 0, pnt, WriteByteBuf.Length);
Status = FT260_I2CMaster_Write(ft260handle, 0x21, FT260_I2C_FLAG.FT260_I2C_START_AND_STOP, pnt, numBytesToWrite, ref writeLength);
I then send one byte 0x80 setting the pointer to the result register for channel 1
WriteByteBuf[0] = 0x80; //Register pointer to Conversion Result register, T
numBytesToWrite = 1;
Marshal.Copy(WriteByteBuf, 0, pnt, WriteByteBuf.Length);
Status = FT260_I2CMaster_Write(ft260handle, 0x21, FT260_I2C_FLAG.FT260_I2C_START_AND_STOP, pnt, numBytesToWrite, ref writeLength);
I then read the two bytes and I get good results for Channel 1
numBytesToRead = 2;
Status = FT260_I2CMaster_Read(ft260handle, 0x21, FT260_I2C_FLAG.FT260_I2C_START_AND_STOP, pnt, numBytesToRead, ref readLength, 5000);
I then try the same for channel two
WriteByteBuf[0] = 0x02; //Register pointer to Configuration Register
WriteByteBuf[1] = 0x00; // Config Reg High byte--Convert CH8,C7,CH6,CH5
WriteByteBuf[2] = 0x20; // Config Reg Low byte--Convert CH4,CH3,CH2,CH1, Filer on
numBytesToWrite = 3;
Marshal.Copy(WriteByteBuf, 0, pnt, WriteByteBuf.Length);
Status = FT260_I2CMaster_Write(ft260handle, 0x21, FT260_I2C_FLAG.FT260_I2C_START_AND_STOP, pnt, numBytesToWrite, ref writeLength);
WriteByteBuf[0] = 0x90; //Register pointer to Conversion Result register, Turn on Mode 2 for all channels
numBytesToWrite = 1;
Marshal.Copy(WriteByteBuf, 0, pnt, WriteByteBuf.Length);
Status = FT260_I2CMaster_Write(ft260handle, 0x21, FT260_I2C_FLAG.FT260_I2C_START_AND_STOP, pnt, numBytesToWrite, ref writeLength);
numBytesToRead = 2;
Status = FT260_I2CMaster_Read(ft260handle, 0x21, FT260_I2C_FLAG.FT260_I2C_START_AND_STOP, pnt, numBytesToRead, ref readLength, 5000);
I get bad results 0x1000 or 4096 decimal as a result
Then read Cannel 3
WriteByteBuf[0] = 0x02; //Register pointer to Configuration Register
WriteByteBuf[1] = 0x00; // Config Reg High byte--If 1 > Convert DC,DC,DC,DC,CH8,C7,CH6,CH5
WriteByteBuf[2] = 0x40; // Config Reg Low byte--If 1 > Convert CH4,CH3,CH2,CH1, Filer on, Alert, Busy/Alert, A/B Polarity
numBytesToWrite = 3;
Marshal.Copy(WriteByteBuf, 0, pnt, WriteByteBuf.Length);
Status = FT260_I2CMaster_Write(ft260handle, 0x21, FT260_I2C_FLAG.FT260_I2C_START_AND_STOP, pnt, numBytesToWrite, ref writeLength);
WriteByteBuf[0] = 0xA0; //Register pointer to Conversion Result register, Only convert one channel at a time.
numBytesToWrite = 1;
Marshal.Copy(WriteByteBuf, 0, pnt, WriteByteBuf.Length);
Status = FT260_I2CMaster_Write(ft260handle, 0x21, FT260_I2C_FLAG.FT260_I2C_START_AND_STOP, pnt, numBytesToWrite, ref writeLength);
numBytesToRead = 2;
Status = FT260_I2CMaster_Read(ft260handle, 0x21, FT260_I2C_FLAG.FT260_I2C_START_AND_STOP, pnt, numBytesToRead, ref readLength, 5000);
I get 0x2000 or 8192 decimal for Channel 3
And so on for the the other channels.
Is there any other registers needed I need to write to or commands to make the other channels work properly.
My I2C signals looks good but it seems the result register is not correct or the ADC is not converting properly




