This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to read ADS1298 ID register, write other registers

Other Parts Discussed in Thread: ADS1298

Hi,

I have a SR open(SR#: 1-1893850773) in ti-china@ti.com, they recommend me to this forum.

I'm operating ADS1298 with STM32F4xx, but I always fail to run command RREG and WREG.

so that I always get DRDY signal with rate of SPS 250, which is the default value after reset.

Following is my code, which I wrote according to the user manual with the reference of a lot of web pages.

I hope I can get some help from you, pointing where I'm wrong,

or you can give a copy of sample code that I can successfully read out the ID register or write into other configuration registers(because they said e2e forum has source code).

My dev environment is: ADS1298,STM32F407VGTx,Keil uVision5,STM32Cube_FW_F4_V1.7.0

Also, I attached one snapshot of timming diagram I got out.

Thanks

Marcus

  uint8_t datarx[26];

  SetCSValue(0);                                //Set CS PIN LOW

 

  SetPWDNValue(1);                       //Set PWDN PIN HIGH

  SetRESETValue(1);                         //Set RESET PIN HIGH

  HAL_Delay(1000);                          //Sleep 1 Second

 

  SetRESETValue(0);                         //Set RESET PIN LOW

  HAL_Delay(100);                            //Sleep 100 mini second

 

  SetRESETValue(1);                         //Set RESET PIN HIGH

  HAL_Delay(100);                            //Sleep 100 mini second

  

  //SDATAC

  SDATAC_Command();                 //Send SDATAC Command

 

  //RREG

  memset(datarx,0,sizeof(datarx));         

  RREG_Command(0x20,0,datarx,1);        //RREG Command,  read only ID register, aways return 0x00,check the diagram for command sequence

void SDATAC_Command()

{

  uint8_t data = 0x11;

  SetCSValue(0);

  HAL_SPI_Transmit(&hspi2,&data,1,1);

  HAL_Delay(1);       //Sleep 1 mini second then set CS HIGH

  SetCSValue(1);

}

void RREG_Command(uint8_t opcode1, uint8_t opcode2, uint8_t* datarx, uint8_t len)

{

  uint8_t datatx[26];

  memset(datatx,0,sizeof(datatx));

  SetCSValue(0);

 

  HAL_SPI_Transmit(&hspi2,&opcode1,1,1);

  HAL_Delay(1);

  HAL_SPI_Transmit(&hspi2,&opcode2,1,1);

  HAL_Delay(1);

 

  for(int i=0;i<len;i++)

  {

    HAL_SPI_TransmitReceive(&hspi2,&datatx[i],&datarx[i],1,1);

  }

  HAL_Delay(1);

  SetCSValue(1);

}

With the following SPI configuration:

  hspi2.Instance = SPI2;

  hspi2.Init.Mode = SPI_MODE_MASTER;

  hspi2.Init.Direction = SPI_DIRECTION_2LINES;

  hspi2.Init.DataSize = SPI_DATASIZE_8BIT;

  hspi2.Init.CLKPolarity = SPI_POLARITY_LOW;

  hspi2.Init.CLKPhase = SPI_PHASE_1EDGE;

  hspi2.Init.NSS = SPI_NSS_SOFT;

  hspi2.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;

  hspi2.Init.FirstBit = SPI_FIRSTBIT_MSB;

  hspi2.Init.TIMode = SPI_TIMODE_DISABLED;

  hspi2.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED;

  hspi2.Init.CRCPolynomial = 10;

  HAL_SPI_Init(&hspi2);