Hi,
I'm trying to connect the Arduino 2 board with the AD7718 using SPI interface.
I have followed the configuration instructions of the AD7718 datasheet but the ADC does not response. The data in ADC input (DIN) is correct (I have checked with the oscilloscope), but the DRDY signal is ever high and so the DOUT signal.
Please provide a wiring diagram of how you wired the chip to the Due. Do you use a breakout board for the AD7718? If so, please provide a link to it.
According to the timing diagram on page 11 of the datasheet the chip is using SPI mode 2 or 3 but not mode 0 which is the default if you don't set another mode.
What purpose have the "delay(1000);" calls in the AD7718Init() routine?
I attach the schematic of wiring connection. The AD7718 is mounted in a board with other components.
That explains how the chips is put into the circuitry but how did you connect it to the Due? From the code I guess you connected D24 to RESET, D26 to DRDY and D10 to CS. Which pins did you use for the SPI bus lines?
Your code doesn't use the SPI library correctly. Remove the SPI.beginTransaction() from the setup routine. But surround every SPI transaction with a corresponding call to this pair, p.e.:
SPISettings ad7718_settings(115200, MSBFIRST, SPI_MODE2);
void AD7718WriteRegister(uint8_t reg, uint8_t value) {
uint8_t cmd = 0x00; // write command
cmd = cmd | reg; // keep the analog mux what it was previously configured as.
SPI.beginTransaction(CS_ADC, ad7718_settings);
SPI.transfer(CS_ADC, cmd); // actually send the cmd and read the current status
if (IsLong[reg])
{
SPI.transfer(value >> 8);
}
SPI.transfer(CS_ADC, value);
SPI.endTransaction();
}
You should change AD7718ReadRegister() the same way too. This isn't relevant in your case because you don't have any other device on the SPI bus (do you?) but it's how the library should be used.
The connection is how you said:
RESET -> D24
DRDY -> D26
CS_ADC -> D10
The DIN, DOUT, SCK pins are connected to the SPI bus of Due (MOSI, MISO, SCK).
I have tried your solution but does not change, the AD7718 does not answer.
The DRDY is ever high.
Two devices are connected to the SPI bus, ADC to pin 10 and EEPROM memory to pin 52.
In this moment, I am only trying to interface the DUE with AD7718.
Two devices are connected to the SPI bus, ADC to pin 10 and EEPROM memory to pin 52.
Please check if D10 is pulled down during SPI transfers and that D52 is constantly on a HIGH level.
The DIN, DOUT, SCK pins are connected to the SPI bus of Due (MOSI, MISO, SCK).
The Due has two connectors looking the same, one connected to the SAM main MCU while the other one is the programming port for the internal USB2serial converter (ATmega16U2). You must use the one that's between D0 and A5.
Please check if D10 is pulled down during SPI transfers and that D52 is constantly on a HIGH level.
ADC Chip Select (D10) is pulled down correctly in transfer operations and D52 is ever high.
The Due has two connectors looking the same, one connected to the SAM main MCU while the other one is the programming port for the internal USB2serial converter (ATmega16U2). You must use the one that's between D0 and A5.
I use the one that is between D0 and A5.
The problem is the signal on the MISO bus. It does not pulled to GND (yellow signal in the attached figure, CH1). Is it necessary to use a pull-up resistor?
The problem is the signal on the MISO bus. It does not pulled to GND (yellow signal in the attached figure, CH1).
I guess the blue signal is the CS. In this case that looks like a floating pin. Check all connections with a multimeter. Do they really get from the Due to the chip?
I use ad7718 TSSOP mounted on a pcb board.
That means you've created a custom PCB for the chip? Please post the schematics of it.
I guess the blue signal is the CS. In this case that looks like a floating pin. Check all connections with a multimeter. Do they really get from the Due to the chip?
Yes, blue signal is the CS. The connections are good.
That means you've created a custom PCB for the chip? Please post the schematics of it.
I have created a custom PCB for the ADC chip. Attach the schematic.
Are both signals (blue and yellow) displayed using the same zoom factor, so the yellow signal has an amplitude of ~0.6 - 0.8V?
The schematics are missing a power connection to the DVcc pin. Is that just missing in the schematics or did you forget that on the board? That would make sense because in this case the SPI interface is not powered.
Are both signals (blue and yellow) displayed using the same zoom factor, so the yellow signal has an amplitude of ~0.6 - 0.8V?
Y
Yes, this is the problem. The signal is not correct.
The schematics are missing a power connection to the DVcc pin. Is that just missing in the schematics or did you forget that on the board? That would make sense because in this case the SPI interface is not powered.
It is an error in the schematic. In the circuit is connected correctly.