AnsweredAssumed Answered

Reading buffers in Adis16228

Question asked by tarohn on Aug 3, 2015
Latest reply on Aug 10, 2015 by NevadaMark

Hi, I'm using a tms570 to control the adis16228. I'm using MIBSPI and transfer groups, I can't seem to get accurate data. How should I try to read the buffers? My code is below.

 

 

 

  /* --- Update Data For Transfer Groups --- */

  /* Transfer Group 0 - One-time transfers

  * Transfer Group 1 - X Buffer

  * Transfer Group 2 - Y Buffer

  * Transfer Group 3 - Z Buffer

  * Transfer Group 4 - Extra write cycle to read data*/

  spiSetData(spiREG1, 1, &X_buffer[0]);

  spiSetData(spiREG1, 2, &Y_buffer[0]);

  spiSetData(spiREG1, 3, &Z_buffer[0]);

  spiSetData(spiREG1, 4, &test_out[0]);

 

 

/* --- Process X Buffer Data --- */

  X_counter = 0;

  spiTransfer(spiREG1, 1); //Initiates a transfer for specified transfer group

  while (X_counter < data_max); //Wait until all samples have been recorded

 

 

  //system_clock_temp = system_msec_clock + 1; //Wait 50 us      **WAITING 1 MS**

  // while(system_msec_clock < system_clock_temp);

 

 

  /* --- Process Y Buffer Data --- */

  Y_counter = 0;

  spiTransfer(spiREG1, 2); //Initiates a transfer for specified transfer group

  while (Y_counter < data_max); //Wait until all samples have been recorded

 

 

  //system_clock_temp = system_msec_clock + 1; //Wait 50 us      **WAITING 1 MS**

  // while(system_msec_clock < system_clock_temp);

 

 

  /* --- Process Z Buffer Data --- */

  Z_counter = 0;

  spiTransfer(spiREG1, 3); //Initiates a transfer for specified transfer group

  while (Z_counter < data_max); //Wait until all samples have been recorded

 

 

case 1: //X Buffer

 

clock = 0;

  while (clock < clock_max) {++clock;}

  spiTransfer(spiREG1, 4); //Sends extra write command to read data

 

clock = 0;

  while (clock < clock_max) {++clock;} //Counts to clock_max

++X_counter;

 

break;

 

 

  //Transfer Group 2 Interrupt

  case 2: //Y Buffer

 

 

 

  clock = 0;

  while (clock < clock_max) {++clock;}

spiTransfer(spiREG1, 4); //Sends extra write command to read data

 

 

  clock = 0;

  while (clock < clock_max) {++clock;} //Counts to clock_max

 

++Y_counter;

break;

 

 

  //Transfer Group 3 Interrupt

  case 3: //Z Buffer


clock = 0;

  while (clock < clock_max) {++clock;}

spiTransfer(spiREG1, 4); //Sends extra write command to read data

 

 

  clock = 0;

  while (clock < clock_max) {++clock;} //Counts to clock_max

 

  ++Z_counter;

 

 

  break;

 

 

  //Transfer Group 4 Interrupt

  case 4:

 

if(X_counter != 0  && X_counter  < 256 ){

  spiGetData(spiREG1, 1, &x_out_array[X_counter-1]); //Get data from X_BUF

  if (X_counter < data_max) {

  spiTransfer(spiREG1, 1); //Initiates a transfer for specified transfer group

 

 

  clock = 0;

  while (clock < clock_max) {++clock;} //Counts to clock_max

  }

 

 

  }

  else if (X_counter == 256 && Y_counter != 0 && Y_counter < 256){

  spiGetData(spiREG1, 2, &y_out_array[Y_counter-1]); //Get data from Y_BUF

  if (Y_counter < data_max) {

 

  spiTransfer(spiREG1, 2); //Initiates a transfer for specified transfer group

 

 

  clock = 0;

  while (clock < clock_max) {++clock;} //Counts to clock_max

 

  }

  }

  else if(Z_counter != 0 && Z_counter < 256){

  spiGetData(spiREG1, 3, &z_out_array[Z_counter-1]); //Get data from Z_BUF

  if (Z_counter < data_max) {

 

 

  spiTransfer(spiREG1, 3); //Initiates a transfer for specified transfer group

 

 

  clock = 0;

  while (clock < clock_max) {++clock;} //Counts to clock_max

 

  break;

Outcomes