大家好、
在我的项目中、我使用 Nucleo-STM32F446RE 和 STMCUBE IDE 来处理 ADS1256、为了连接这些库、我在 GitHub 链接 https://github.com/majialou/STM32F1-ADS1256-Data-Collect 中找到了库 、但我无法从 读取 DRDY 引脚时从该库获取任何输出、 因为我已经将 DRDY 引脚声明为外部中断、并且当我尝试初始化 ads1256时、它被吸入到 drdy 引脚环路中、比如它不会变为低电平、它始终处于高电平。 所以我进行了这样的连接
MCU ADS1256
(PA5) SCLK --> SCLK
(PA6) MISO --> MISO
(PA7) MOSI --> MOSI
(Pb6) CS --> PA4.
(PA12) DRDY --> PA2.
(PA10)复位 --> PA3.
5V --> 5V
3.3V --> 3.3V
GND --> GND
(PA11) PDWN --> 未连接到任何设备
--> ANCOM --> AGND //用于单端//
这是用于 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>
我已经将我的 drdy 引脚连接到示波器、引脚始终处于高电平、因此我应该做什么来帮助我解决这个问题
谢谢你。




