2014-01-15 01:19 AM
Hi,
I'm trying to communicate between the
http://www.ti.com/product/ADS7870
and the ST microcontroller STM32F4 Discovery evaluation board. I'm using IAR and at the moment I'm just trying to read register 31 from the ADC (which should return a 1) but with no luck.I'm setting the SPI on the microcontrontroller as follows: data transmitted as MSB first, clock low in idle state, data is captured on rising edge, data size is 8 bits, and full duplex transmission.
In main.c I do:
http://e2e.ti.com/support/data_converters/precision_data_converters/f/73/t/3147aspx#
1
2
3
4
5
6
debug = ads7870Init();
if
(debug==1)printf
( ''adc is alive \n'' );else
printf
( ''adc is DEAD \n'' );And in
http://www.ti.com/product/ads7870
_driver.c I have:http://e2e.ti.com/support/data_converters/precision_data_converters/f/73/t/3147aspx#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//initialize ADC
uint8_t ads7870Init( void ) {//// check ID register
if
(ads7870ReadReg(ADS7870_ID) != ADS7870_ID_VALUE)return
0;else
{
//// setup reference and buffer
ads7870WriteReg(ADS7870_REFOSC, ADS7870_REFOSC_OSCE | ADS7870_REFOSC_REFE | ADS7870_REFOSC_BUFE);
//// return success
return
1;}
}
I'm attaching a screenshot of what I see on the scope. (yellow: sclk, blue: read command register 31, purple: output from ADC).
MOSI transmits properly to the
http://www.ti.com/product/ADS7870
(the din pin receives read command), but there is no response coming from the ADC dout pin.I would really appreciate any help on this.
Thank you.
2014-01-16 05:09 AM
Hi dor.c
As mentioned above, how do you manage the NSS pad?2014-01-16 05:10 AM
Hi dor.c
How do you manage the NSS signal?2014-01-17 01:22 AM
Sung,
Later on I can add a delay to wait for the ADC to be ready as well.CS on the ADC is currently tied to ground. The RESET is tied to Vdd and OSCENABLE is also tied to Vdd.I have read the datasheet for the ADC and as I have shown in my last post the same ADS7870 with the same connections works perfectly with the ATMEGA8. That's why I suppose everything is correct on the ADC side.2014-01-17 02:00 AM
''I have read the datasheet for the ADC''
Have you? Why have you connected ''OSCENABLE is also tied to Vdd.'' ? The datasheet shows this should be connected to 0V. (Though I am not sure this will stop it from communicating over SPI, I think the OSC is really for doing converting, SPI provides it's own clocking).2014-01-17 02:13 AM
Actually I just realised something.
The Atmel is a 5V device. The STM32 is a 3/3.3V device. (your diagrams show there is a difference in logic high) What supply are you giving the ADC? For the ADC to work with 3.3V logic ip - it must be supplied with 3.3V Check the datasheet!2014-01-17 02:25 AM
The ADC is connected to Vdd on STM32, so it's 3.3V.
2014-01-17 02:30 AM
JW,
RISE/FALL is tied to 1, so it's rising edge. The only difference I see with the ATMEGA8 is that on STM32 MOSI is low during don't care conditions, while on ATMEGA8 MOSI is high. Though I don't think this should make a difference.2014-01-17 02:31 AM
I will check this on Monday, this might be a problem.
Thank you.2014-01-17 02:35 AM
NSS on the ADC is grounded. I'm not using the NSS signal coming from the STM32 at the moment.
2014-01-17 02:38 AM
> NSS on the ADC is grounded. I'm not using the NSS signal coming from the STM32 at the moment.
Have you tried the expicit SPI sync sequence (at least 39 zeros then exactly 1 one)? JW