Hello guys,
In my project i am working on ADS1256 with nucleo-STM32F446RE with STMCUBE IDE and for interfacing these i found library in github link https://github.com/majialou/STM32F1-ADS1256-Data-Collect but i couldn't get any output from this i stucked in reading DRDY pin, because i havve declared DRDY pin as external interrupt and when i try to initialize the ads1256 its stucked in the drdy pin loop like its not go low its always high. so i have make connection like this
MCU ADS1256
(PA5)SCLK --> SCLK
(PA6)MISO --> MISO
(PA7)MOSI --> MOSI
(PB6)CS --> PA4
(PA12)DRDY --> PA2
(PA10)RESET --> PA3
5V --> 5V
3.3V --> 3.3V
GND --> GND
(PA11)PDWN --> Not connected to anything
--> ANCOM -->AGND // for single ended //
and this is the code for initialization of ads1256
<code> uint8_t ads1256_init(void) { uint8_t regs_buf[4]; HAL_GPIO_WritePin(GPIOB,GPIO_PIN_6, GPIO_PIN_RESET); HAL_NVIC_DisableIRQ(EXTI15_10_IRQn); for(;;){ HAL_GPIO_WritePin(GPIOA, REST_Pin|PDWN_Pin, GPIO_PIN_RESET); HAL_Delay(1); HAL_GPIO_WritePin(GPIOA, REST_Pin|PDWN_Pin, GPIO_PIN_SET); HAL_Delay(1); printf("hello sagar1\r\n"); printf("status1:%d\r\n",HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); while(HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); printf("hello sagar2\r\n"); ads1256_read_regs(0,regs_buf,sizeof(regs_buf)); printf("hello sagar3\r\n"); if( regs_buf[1]==0x01 && regs_buf[2]==0x20 && regs_buf[3]==0xF0 ) printf("break\r\n"); break; HAL_Delay(100); } while(HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); printf("hello sagar4\r\n"); printf("status2:%d\r\n",HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); regs_buf[REG_STATUS]=0xf4;//STATUS REGISTER:Auto-Calibration Enabled,Analog Input Buffer Disabled regs_buf[REG_ADCON]=CLKOUT_OFF+DETECT_OFF+ads125x_conf.gain; //ADCON=00h regs_buf[REG_DRATE]=ads125x_conf.sampling_rate; ads1256_write_regs(REG_STATUS,regs_buf,sizeof(regs_buf)); printf("status3:%d\r\n",HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); while(!HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); printf("status4:%d\r\n",HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); printf("hello sagar5\r\n"); while(HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); ads1256_read_regs(0,regs_buf,sizeof(regs_buf)); while(HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); ads1256_channel_init(); ads1256_write_cmd(CMD_SYNC); ads1256_write_cmd(CMD_WAKEUP); printf("hello sagar6\r\n"); while(HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); ads1256_write_cmd(CMD_SELFCAL); //self-calibration while(!HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); while(HAL_GPIO_ReadPin(DRDY_GPIO_Port,DRDY_Pin)); printf("hello sagar7\r\n"); HAL_NVIC_EnableIRQ(EXTI15_10_IRQn); return 1; } <code>
SO i have connected my drdy pin to oscilloscope and pin is always high so what should i do please help me to resolve this
thank you.