Other Parts Discussed in Thread: TMS320C5515, ADS1298R
Hi,
I am using TMS320C5515 EVM to communicate with ADS1298R (SPI communication).
I can read data, but I cant seem to read any register, so I cant tell if they are set properly.
Before reading registers I set START pin to low, also I have set JP21 jumper on ADS1298R to (1-2) because standard chip select on CS pin cant give a 4 tclk delay between last falling edge of SPI_OUT and rising edge of chip select (If I use GPIO pin as chip select signal I can make this happen). I am trying to read the content of CONFIG1 register. I wrote this code:
//Start=0
SYS_GPIO_DATAOUT0=0x0802;
for (delay3=0;delay3<300;delay3++);
do{
//RREG CONFIG1
//set CS to low (CS is a GPIO pin)
SYS_GPIO_DATAOUT0 &= 0xFFEF;
for (delay3=0;delay3<10;delay3++);
SPI_SPIDAT1=0x0000;
SPI_SPIDAT2=0x2100;
SPI_SPICMD1=0x4000;
SPI_SPICMD2=0x003A;
for (delay3=0;delay3<30;delay3++);
//set CS to high (CS is a GPIO pin)
SYS_GPIO_DATAOUT0 |= 0x0010;
//Checking BUSY bit
//--------------------------------
busy_value1=0;
do{
busy_value=SPI_STAT1;
busy_value1=(busy_value & 0x0001);
}while(busy_value1!=0);
for (delay3=0;delay3<50;delay3++);
//-------------------------------
//set CS to low (CS is a GPIO pin)
for (delay3=0;delay3<200;delay3++);
SYS_GPIO_DATAOUT0 &= 0xFFEF;
for (delay3=0;delay3<10;delay3++);
SPI_SPIDAT1=0x0000;
SPI_SPIDAT2=0x0000;
SPI_SPICMD1=0x4000;
SPI_SPICMD2=0x003A;
//set CS to high (CS is a GPIO pin)
for (delay3=0;delay3<30;delay3++);
SYS_GPIO_DATAOUT0 |= 0x0010;
//Checking BUSY bit
//--------------------------------
busy_value1=0;
do{
busy_value=SPI_STAT1;
busy_value1=(busy_value & 0x0001);
}while(busy_value1!=0);
for (delay3=0;delay3<50;delay3++);
//-------------------------------
for (delay3=0;delay3<200;delay3++);
//set CS to low (CS is a GPIO pin)
SYS_GPIO_DATAOUT0 &= 0xFFEF;
for (delay3=0;delay3<10;delay3++);
SPI_SPIDAT1=0x0000;
SPI_SPIDAT2=0x0000;
SPI_SPICMD1=0x4000;
SPI_SPICMD2=0x0039;
for (delay3=0;delay3<30;delay3++);
//set CS to high (CS is a GPIO pin)
SYS_GPIO_DATAOUT0 |= 0x0010;
for (delay3=0;delay3<30;delay3++);
//Checking BUSY bit
//--------------------------------
busy_value1=0;
do{
busy_value=SPI_STAT1;
busy_value1=(busy_value & 0x0001);
}while(busy_value1!=0);
for (delay3=0;delay3<50;delay3++);
}while(1);
Basically, my code consists of:
-SET GPIO TO LOW
-WAIT
-SEND OPCODE1 (0x21) ON SPI_OUT
-CHECK IF SPI DATA SENDING IS OVER
-WAIT
-SET GPIO TO HIGH
-WAIT
-SET GPIO TO LOW
-WAIT
-SEND OPCODE2 (0x00) ON SPI_OUT
-CHECK IF SPI DATA SENDING IS OVER
-WAIT
-SET GPIO TO HIGH
-WAIT
-SET GPIO TO LOW
-WAIT
-RECEIVE DATA ON SPI_IN
-CHECK IF SPI DATA READING IS OVER
-WAIT
-SET GPIO TO HIGH
-WAIT
The problem here seems to be that I am getting nothing back. I have 3 pictures of SPI communication between C5515 and ADS1298R.
In these pictures signals are set in this order : 0-SCLK; 1-CS (GPIO pin); 2-SPI_IN; 3-SPI_OUT. SPI_OUT sends data from C5515 to ADS1298R, while SPI_IN receives data from ADS1298R.
If you look at the code you can see that I have placed the reading of CONFIG1 register in infinite loop so the first picture shows sending both opcodes to ADS1298R and waiting to receive the response. Second picture zooms in the sending of the first opcode (0x21- I want to read from address 0x01). Third picture zooms in the sending of the second opcode (0x00- I want to read only one register). On the first picture you can see I am not receiving anything from ADS1298R. However on the first and third pictures you can see that besides signals I am sending there are some other signals. Third picture shows sending 0x00, but something is being sent on SPI_OUT pin (I KNOW THIS IS A QUESTION FOR TMS320C5515 forum, and I have posted the question - e2e.ti.com/support/dsp/c5000/f/109/t/542760). My question here is, are these extra signals (even though they are sent without SCLK) somehow preventing me from reading ADS1298R registers?
If these extra signals are not the problem, why cant I read registers?
Picture 1.
Picture 2
Picture 3
Thank you for replying!
Darko

