你好,我最近在调试ADS1259这款芯片,遇到读取寄存器返回随机码的问题,
逻辑分析仪抓的图如下:
参照官方的资料,返回的第三个字符应该是config0的默认值,即10xx0101b,但是现在返回的字符是随机的,我没有对芯片进行任何配置,只是复位后读取寄存器。请问这可能是什么问题呢?
谢谢!
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.
我解释一下波形:mosi的第一个字符代表读取地址0的寄存器,第二个字符0x00代表共读取1byte,第三个0x00是读取miso的返回值,没有意义。
初始化程序:
void ads1259_init(void)
{
ads1259_reset_h;
ads1259_start_h;
delay_us(100);
ads1259_reset_l;
delay_us(100);
ads1259_reset_h;
//delay_ms(10);
ads1259_start_l;
}
读取寄存器0:
void ads1259_read_config0(void)//default: 10XX 0101=0x 5
{
unsigned char temp1=0,temp2=0,temp3=0,temp4=0,temp5=0;
ads1259_cs_l;
spi_write(0x20);//OPCODE 1 = 0010 0000
spi_write(0x00);//OPCODE 2 = 0000 0000
temp1=spi_read();
ads1259_cs_h;
lcd_display_int(0,1,temp1);
}
参照的官方PDF33页内容:
请问如下代码可以读取寄存器的数值吗??
ADS1259_WRITE(0X11);//Stop Read Data Continuous mode
ADS1259_WRITE(0X20); //1st opcode, read from address 0x00
ADS1259_WRITE(0X08); //2dn opcode, read 9 regs value
for(i = 0; i < 9; i++)
{
ADS1259_REG[i] = ADS1259_READ_REG();
}
uint8_t ADS1259_READ_REG(void)
{
uint8_t REG = 0;
//ADS1259_WRITE(0X11);//Stop Read Data Continuous mode
HAL_SPI_Receive(&hspi1, ®, 1, 100);
return REG;
}