求助关于ADS1292R的连续数据读取问题
最近在调试ADS1292R,但是数据一直没有出来。具体描述如:
单片机为cypress,采用中断方式读取连续的9个字节数据。SPI可以实现寄存器的读写,写入前和写入后都出来比对过,没有问题。初始化代码如下:
SPIM_Start();
ads1292_Reset();
delay(100);
ads1292_Disable_Start();
ads1292_Enable_Start();
ads1292_Hard_Stop();
ads1292_Start_Data_Conv_Command();
ads1292_Soft_Stop();
delay(50);
ads1292_Stop_Read_Data_Continuous(); // SDATAC command
delay(300);
uint8_t regArray[12] = { 0 };
uint8_t i = 0;
/******************************
printf("Before Config\r\n");
for (i = 0; i < 12; i++)
{
regArray[i] = ads1292_Reg_Read(i);
}
for (i = 0; i < 12; i++)
{
printf("%X\r\n",regArray[i]);
}
******************************/
delay(100);
ads1292_Init();//config registers
delay(100);
/******************************
printf("After Config\r\n");
for (i = 0; i < 12; i++)
{
regArray[i] = ads1292_Reg_Read(i);
}
for (i = 0; i < 12; i++)
{
printf("%X\r\n",regArray[i]);
}
******************************/
delay(100);
ads1292_Start_Data_Conv_Command();
delay(500);
ads1292_Disable_Start();
ads1292_Enable_Start();
delay(300);
DRDY_ISR_StartEx(ProcessData_ISR);
中间注释掉的两部分为配置前后读寄存器。现在中断能正常产生,读出的9个数据字节如下:
0 0 5E B1 7F FF FF C0 0
而且如果把上面读寄存器的代码注释取消掉,读出的9个字节全为0.
SPI波特率1M和100K都试过了,串口波特率为115200.
请各位调试过ADS1292r的大神们,帮忙看一下,在此拜谢了!
PS,寄存器的配置如下:
ads1292_Reg_Write(ADS1292_REG_CONFIG1, 0x00); //Set sampling rate to 250 SPS
delay(10);
ads1292_Reg_Write(ADS1292_REG_CONFIG2, 0b11100000); //Lead-off comp off, test signal disabled
delay(10);
ads1292_Reg_Write(ADS1292_REG_LOFF, 0b11110000); //Lead-off defaults
delay(10);
ads1292_Reg_Write(ADS1292_REG_CH1SET, 0b00010001); //Ch 1 enabled, gain 4, connected to electrode in
delay(10);
ads1292_Reg_Write(ADS1292_REG_CH2SET, 0b00010001); //Ch 2 enabled, gain 4, connected to electrode in
delay(10);
ads1292_Reg_Write(ADS1292_REG_RLDSENS, 0b00111100); //RLD settings: fmod/16, RLD enabled, RLD inputs from Ch2 only
delay(10);
ads1292_Reg_Write(ADS1292_REG_LOFFSENS, 0x0F); //LOFF settings: all disabled
delay(10);
//Skip register 8, LOFF Settings default
//ads1292_Reg_Write(ADS1292_REG_RESP1, 0b11110010); //Respiration: MOD/DEMOD turned only, phase 0
ads1292_Reg_Write(ADS1292_REG_RESP1, 0b11101010);
delay(10);
ads1292_Reg_Write(ADS1292_REG_RESP2, 0b00000011); //Respiration: Calib OFF, respiration freq defaults
delay(10);
但是数据一直没有出来。 可否先验证一下 ADS1292 有没有工作了, 比如供电, 连接正常吗