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.

ADS1298RECGFE-PDK: Converted data Reading

Part Number: ADS1298RECGFE-PDK
Other Parts Discussed in Thread: ADS1298R

Hi, 

I am trying to obtain converted data by writing to the config registers and a single channel of the ADS1298R. I have interfaced the PDK with an STM32F4 MCU. I am attaching the logic of my code below. 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

//definitions//

uint8_t START = 0x08;   // START OPCODE
uint8_t RX_RDATA[3];    //ARRAY TO STORE RECEIVED DATA

uint8_t RDATA=0x12;    //RDATA OPCODE

uint8_t TXBUFFER1[3]={0x41, 0x00, 0xC6};    //VALUES TO BE WRITTEN TO CONFIG1 REG
uint8_t TXBUFFER2[3]={0x42, 0x00, 0x10};     //VALUES TO BE WRITTEN TO CONFIG2 REG
uint8_t TXBUFFER3[3]={0x43, 0x00, 0xFC};    //VALUES TO BE WRITTEN TO CONFIG3 REG
uint8_t TXBUFFER4[3]={0x44, 0x00, 0x03};     //VALUES TO BE WRITTEN TO LOFF REG
uint8_t TXBUFFER5[3]= {0x45, 0x00, 0x03};    //VALUES TO BE WRITTEN TO CH1 REG 

//MAIN//

HAL_GPIO_WritePin(GPIOD, GPIO_PIN_9, GPIO_PIN_RESET);        //START PIN PULLING LOW

HAL_Delay(1);
HAL_SPI_Transmit(&hspi2, TXBUFFER1, 3, 50);      //TX CONFIG1 WRITE VALUE
HAL_SPI_Transmit(&hspi2, TXBUFFER2,3, 50);       //TX CONFIG2 WRITE VALUE
HAL_SPI_Transmit(&hspi2, TXBUFFER3,3, 50);        //TX CONFIG3 WRITE VALUE
HAL_SPI_Transmit(&hspi2, TXBUFFER4,3, 50);        //TX  LOFF REGISTER WRITE VALUE

HAL_SPI_Transmit(&hspi2, TXBUFFER5,3, 50);       //TX CH1REG WRITE VALUE

HAL_Delay(1);
HAL_SPI_Transmit(&hspi2,&START,1, 50);               //TX START OPCODE

//ISR DETECTING DRDY FALLING EDGE//

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{

HAL_SPI_Transmit(&hspi2,&RDATA, 1, 50); //TX RDATA OPCODE
HAL_SPI_Receive(&hspi2,RX_RDATA, 3, 50);   //RECEIVE DATA USING SPI

}

------------------------------------------------------------------------------------------------------------------------------------------------------------

I am getting a value of 0x71 on my receive buffer array (RX_RDATA). However since SPI size is 8-bit per receive, I am getting only 0x71 on all 3 bits of the array. How do I fix this? Will appreciate any help. 

  • Hi Sudarshan,

    Writing the code is ultimately up to the customer. I recommend consulting the C code, and SPI debug posts that can be found in the BIOFAQ in my signature. Additionally, don't worry about lead off for now and it looks like you're using Ch1 to measure the supply voltage, try just using it as a normal input.