I am wondering if anyone here has experience with the 14-bit Analog Devices AD7940 SPI ADC.
I am trying to get on to work here to no avail. I have it connected to a ATmega16M1 which also has a 16MHz crystal connected.
I am initialising my spi as below, with the SS and SCLK set as outputs and MISO as input.
// Enable SPI, Master Mode 2, set the clock rate fck/16, SPCR |= (1<<SPE)|(1<<MSTR)|(1<<CPOL)|(1<<SPR0);
I am using the SCLK provided by the avr at the moment and request the two bytes as follows:
// Activate the CS pin clear_bit(AD7940_CS_PORT,AD7940_CS_PIN); // Send data SPDR = 0xFF; // Wait for transmission complete while(!(SPSR & (1<<SPIF))); // Send data SPDR = 0xFF; // Wait for transmission complete while(!(SPSR & (1<<SPIF))); // De-activate the CS pin set_bit(AD7940_CS_PORT,AD7940_CS_PIN);
At the minute i am monitoring the SDATA pin with my scope which has a SPI serial bus monitor built in.
There is no data coming back from the ADC.
Could this be due to the gap between the two SPI sends and hence I am not getting 16 consecutive clock pulses going to the AD7940?
Would i be better using a PWM output as my SCLK, or is there away to send 16 consecutive pulses using the onboard SPI SCLK?
Any input or advice would be gratefully appreciated
The datasheet for the part can be found here: