Hello!
I need your help about my new Data Converter ADS1213.
I'm trying to start a communication with it through my SPI channel (I'm using an ATMega32).
/* Initialization Pin part */ DDRB = (1<<SCK)|(1<<MOSI); // define my cpu as the Master with SCK and MOSI as output PORTB = 0x00; /* SPI: Interrupt disable - SPI enable - MSB first - Master - fosc/16 */ SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1); /***************************************/ /* INITIALIZE MY ADS */ /* Clear SPCI */ SPSR; SPDR; ADS_ON; // write 0 to my SELADS pin //t24 not needed 33.8us without break SPDR = 0x04; loop_until_bit_is_set(SPSR,SPIF); // wait the end of the transmit _delay_us(100); //t19 for the debug SPDR = 0x43; // Use SDOUT for the output loop_until_bit_is_set(SPSR,SPIF); ADS_OFF; //t20 not needed 4.98us without break /***************************************/ /* TRY TO READ SOMTH */ /* Clear SPI */ SPSR; SPDR; ADS_ON; /* Read SPI */ SPDR = 0x84; // try to read the Command Register Byte 3 loop_until_bit_is_set(SPSR,SPIF); _delay_us(100); //t19 for the debug SPDR = 0xFF; // wrote 0xFF to get time to read into SDOUT loop_until_bit_is_set(SPSR,SPIF); test = SPDR; ADS_OFF; //t20 not needed 4.98us without break
And now my diagramm of the ADS:
From the TOP to the BOTTOM:
DRDY
CS
SCK
SDIO
SDOUT
The init sequence with the 2 bytes 0x04 and 0x43
My reading sequence:
Has you can see there is nothing transmit in SDOUT.
Thanks a lot for your futur help.
Do not hesitate if you need more details.
Best,
Bastien