Hello,
first of all please be patient, my english wasn't used for a long time.
I'm a little bit in trouble. I'm writing my bachelor thesis an one part of it is a pressure sensor whose data i will convert via the 1255 and then send the data to an Arduino Nano board (ATMega 328).
The problem is i always have zeros in my SPDR register (the place where the bytes should be transfered).
First i evaluated the adc with the evalboard and there it worked well but now i have an ADC1255 on a board, with the pressure sensor next to him and it doesn't!
So i belive i haven't set up the right configuration (of have set up the right configuration in a wrong way!?)
When i now try to configure the adc and collect data, i always get zeros. I really don'k know if i'm doing it right, so i hope you can help me with this.
My SPI configuration on the µC is:
- MSB first,
- SPI_Mode1 (low when idle, falling edge)
- clockspeed is 8MHz
here is the code for the configuration (the SPI.transfer function is from the arduino library):
SPI.transfer(0x00); //wakeup
SPI.transfer(0x0F); //stop reading continously if so
SPI.transfer(0xFE); //reset
SPI.transfer(0x510001); //Write(5) register(1),Number of Data(0) Number(0), Databyte (01) --> AIN0 & AIN 1
SPI.transfer(0x520004); //Write(5) register(2),Number of Data(0) Number(0), Databyte (04) --> PGA = 16
SPI.transfer(0x530003); //Write(5) register(1),Number of Data(0) Number(0), Databyte (03) --> 2.5 sps
SPI.transfer(0xFC); //synchronize
SPI.transfer(0xF1); //Offset self calibration
SPI.transfer(0xF2); //Gain self calibration
SPI.transfer(0xF3); //System offset self calibration
SPI.transfer(0xF4); //System gain self calibration
SPI.transfer(0xFC); //synchronize
SPI.transfer(0xFF); //wakeup
in the loop i try to read out the bytes
SPI.transfer(0x01);
// wait until data is shifted out
delayMicroseconds(1); //50x t_clk
//read from SPI Register
buffer[0] = SPDR;
buffer[1] = SPDR;
buffer[2] = SPDR;
Here is another question. How can i manage to read out 3 byte out of an one byte register? I hoped that it will be shifted in, after i read the byte, but how can i know?!
When i read the DOUT with the Osci i always get a flatline. Even if i send a commant to read a register i stays zero.
Can you pleasy help me with that problem? I'm running out of time.
Thanks
Dennis Zimmermann
PS: i attached my scematic. I don't belive it's a layout problem but maybe for you it's better to understand what i am doing