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.

ADS1294: DRDY pin stop toggling when i read data.

Part Number: ADS1294

Hi

i am trying to use ads1294 to capture data in continuous and i use the flowchart in datasheet.

for test signal :

CONFIG1 --> 0x86

CONFIG2 --> 0x10

CONFIG3 --> 0xC0

CHnSET -->  0x05

i use stm32f407 for programing and capturing data and i connect  DRDY to EXIT3(pullup and trigger in falling edge).

DRDY toggle at fclk/4096.DRDY pin stop toggling when i read data!!!

#include "main.h"
/*
        DRDY      ---> PC3(EXIT3-pullup-falling edge)
        CS           ---> PB0(pullup-High level)
        START     ---> PB1(Nopull)
        RSSET/PWD ---> PB32(pulldown-Low level)
        
        SPI1 :
               PA5(SCK)  --->  SCK
               PA6(MISO) --->  DOUT
               PA7(MOSI) --->  DIN
*/
__STATIC_INLINE void DelayMicro(__IO uint32_t micros){
micros *= (SystemCoreClock / 1000000) / 9;
while (micros--) ;
}
SPI_HandleTypeDef hspi1;
uint8_t spi_buffer;
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_SPI1_Init(void);
uint32_t s=0,ss=0;
//ADS_OpCodes:-------------------------------------------------------------------------------------//
#define WAKEUP      0x02
#define STANDBY     0x04
#define RESEEET     0x06
#define START       0x08
#define STOP        0x0A
#define RDATAC      0x10
#define SDATAC      0x11
#define RDATA       0x12
//ADS_address:-------------------------------------------------------------------------------------//
#define adr_ID       0x00
#define adr_CONFIG1  0x01
#define adr_CONFIG2  0x02
#define adr_CONFIG3  0x03
#define adr_CH1SET   0x05
#define adr_CH2SET   0x06
#define adr_CH3SET   0x07
#define adr_CH4SET   0x08
//ADS_Functions:-----------------------------------------------------------------------------------//
uint8_t ADS_ReadReg(uint8_t address);
void ADS_WriteReg(uint8_t address,uint8_t data);
void ADS_SetTestSignal(void);
void ADS_setup(void);
//ADS_Variables:-----------------------------------------------------------------------------------//
uint8_t id=0;
uint8_t STAT[3]={0,0,0},CH1[3]={0,0,0},CH2[3]={0,0,0},CH3[3]={0,0,0},CH4[3]={0,0,0};
//-------------------------------------------------------------------------------------------------//
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){
    s++;
    if(s>=488){
        s=0;
        ss++;
    }
    HAL_SPI_Receive(&hspi1,STAT,3,100);
    HAL_SPI_Receive(&hspi1,CH1,3,100);
    HAL_SPI_Receive(&hspi1,CH2,3,100);
    HAL_SPI_Receive(&hspi1,CH3,3,100);
    HAL_SPI_Receive(&hspi1,CH4,3,100);
}
//-------------------------------------------------------------------------------------------------//
int main(void){

  HAL_Init();
  SystemClock_Config();
  MX_GPIO_Init();
  MX_SPI1_Init();
  HAL_Delay(500);
    //------------------------------------------------
    ADS_setup();
    
    ADS_SetTestSignal();
    
    id=ADS_ReadReg(adr_CONFIG1);
    
    HAL_GPIO_WritePin(START_GPIO_Port,START_Pin,GPIO_PIN_SET);
    
    spi_buffer=RDATAC;
    HAL_SPI_Transmit(&hspi1,&spi_buffer,1,100);
    
  while (1) {
  }

}
//------------------------------------------------------------------------------------------------//
uint8_t ADS_ReadReg(uint8_t address){
    //HAL_GPIO_WritePin(CS_GPIO_Port,CS_Pin,GPIO_PIN_RESET);
    spi_buffer = address + 0x20;
    HAL_SPI_Transmit(&hspi1,&spi_buffer,1,100);
    spi_buffer = 0;             
    HAL_SPI_Transmit(&hspi1,&spi_buffer,1,100);
  HAL_SPI_Receive(&hspi1,&spi_buffer,1,100);
  return spi_buffer;
    //HAL_GPIO_WritePin(CS_GPIO_Port,CS_Pin,GPIO_PIN_SET);
}
//------------------------------------------------------------------------------------------------//
void ADS_WriteReg(uint8_t address,uint8_t data){
    //HAL_GPIO_WritePin(CS_GPIO_Port,CS_Pin,GPIO_PIN_RESET);
    spi_buffer = address + 0x40;
    HAL_SPI_Transmit(&hspi1,&spi_buffer,1,100);
    spi_buffer = 0;             
    HAL_SPI_Transmit(&hspi1,&spi_buffer,1,100);
    spi_buffer = data;             
    HAL_SPI_Transmit(&hspi1,&spi_buffer,1,100);
    //HAL_GPIO_WritePin(CS_GPIO_Port,CS_Pin,GPIO_PIN_SET);
}
//------------------------------------------------------------------------------------------------//
void ADS_setup(void){
    HAL_GPIO_WritePin(RESET_GPIO_Port,RESET_Pin,GPIO_PIN_SET);
    HAL_Delay(200);
    HAL_GPIO_WritePin(CS_GPIO_Port,CS_Pin,GPIO_PIN_RESET);
    DelayMicro(10);
    spi_buffer = SDATAC;
    HAL_SPI_Transmit(&hspi1,&spi_buffer,1,100);
    DelayMicro(5);
    //HAL_GPIO_WritePin(CS_GPIO_Port,CS_Pin,GPIO_PIN_SET);
}
//------------------------------------------------------------------------------------------------//
void ADS_SetTestSignal(void){
    ADS_WriteReg(adr_CONFIG3,0xC0);
    ADS_WriteReg(adr_CONFIG1,0x86);
    ADS_WriteReg(adr_CONFIG2,0x10);
    ADS_WriteReg(adr_CH1SET,0x05);
    ADS_WriteReg(adr_CH2SET,0x05);
    ADS_WriteReg(adr_CH3SET,0x05);
    ADS_WriteReg(adr_CH4SET,0x05);
}