SPI communication
Posted: Mon Sep 14, 2009 11:11 am
Hi,
I use a MCU (18f4685) and ADC (AD7738). I've connected SDO (MCU) to DIN (ADC), SDI (MCU) to DOUT (ADC), SCK (MCU) to SCK (ADC) and connected the #CS (ADC) to the ground. In my attached flowcode programme first I init the SPI hardware and reset the ADC by sending 0,1,1,1 over SPI. After that I setup the various configuration registers. Then i start a while loop thats gives the ADC a command for single conversion, followed by a delay and a command to read the data register for channel 0. I send back the result over rs232.
When i measure with a oscilloscope, I see the four SPI clock pulse trains (4 x 8 pulses) and the pulse train from the MCU's SDO pin (bytes 72, 0, 0, 0). When i measure the MCU's sdi pin (ADC's SDO) I see no activity. We did some experiments with SPI speed and polarity but the result is always the same, nothing.
Can somebody please look at my programme and give some suggestions.
Thanks in advance,
Bjorn Stevens
I use a MCU (18f4685) and ADC (AD7738). I've connected SDO (MCU) to DIN (ADC), SDI (MCU) to DOUT (ADC), SCK (MCU) to SCK (ADC) and connected the #CS (ADC) to the ground. In my attached flowcode programme first I init the SPI hardware and reset the ADC by sending 0,1,1,1 over SPI. After that I setup the various configuration registers. Then i start a while loop thats gives the ADC a command for single conversion, followed by a delay and a command to read the data register for channel 0. I send back the result over rs232.
When i measure with a oscilloscope, I see the four SPI clock pulse trains (4 x 8 pulses) and the pulse train from the MCU's SDO pin (bytes 72, 0, 0, 0). When i measure the MCU's sdi pin (ADC's SDO) I see no activity. We did some experiments with SPI speed and polarity but the result is always the same, nothing.
Can somebody please look at my programme and give some suggestions.
Thanks in advance,
Bjorn Stevens