Other Parts Discussed in Thread: ADS1258
i have use hareware spi1 in stm32 to drive the ads1259 chip, the speed of spi is 250KHz.
when i power on the system, i wait 200ms,then initial the ads1259, and do a reset like this:
//
Hard ware reset mode void ADS1259_reset(void) { ADS1259_Init_Delay(DELAY_TIME_RESET); ADS1259_RESET_L; ADS1259_Init_Delay(DELAY_TIME_RESET); ADS1259_RESET_H; ADS1259_Init_Delay(DELAY_TIME_RESET); }
and then send a sdatac command
void ADS1259_INIT(void) { ADS1259_Init_Delay(DELAY_TIME_RESET); ADS1259_reset(); ADS1259_Init_Delay(DELAY_TIME_RESET); ADS1259_WRITE(CMD_SDATAC);//Stop Read Data Continuous mode ADS1259_Init_Short_Delay(DELAY_SHORT); #if 0 ADS1259_WRITE(0X40);//write start from 00h ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X08);//write 9 reg 8+1=9 ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X05);//00000101 RBIAS + spi timeout ADS1259_Init_Short_Delay(DELAY_SHORT); //ADS1259_WRITE(0X01);//00000001 spi timeout ADS1259_WRITE(0X18);//00011000 SINC2 + EXTREF ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X03);//60sps , gate Convert mode ADS1259_Init_Short_Delay(DELAY_SHORT); //OFC[2:0] ADS1259_WRITE(0X00); ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X00); ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X00); ADS1259_Init_Short_Delay(DELAY_SHORT); //FSC[2:0] ADS1259_WRITE(0X00); ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X00); ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X40); #endif ADS1259_Init_Delay(DELAY_TIME_RESET); }
the while loop, i call function:
void ADS1259_Read_Reg_Enable(void) { ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(CMD_SDATAC);//Stop Read Data Continuous mode ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X20); //1st opcode, read from address 0x00 ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X08); //2dn opcode, read 9 regs value ADS1259_Init_Short_Delay(DELAY_SHORT); }
to read the regs value,
but after i flash the chip and run thr mcu,
i get the data below:
ADS1259_REG[0] = 0x25
ADS1259_REG[1] = 0x8
ADS1259_REG[2] = 0xc0
ADS1259_REG[3] = 0x0
ADS1259_REG[4] = 0x0
ADS1259_REG[5] = 0x0
ADS1259_REG[6] = 0x0
ADS1259_REG[7] = 0x0
ADS1259_REG[8] = 0x40
the first data is diff from datasheet(reset value is 10XX0101b), cause i do not write any regs at all.
then i write regs like below:
ADS1259_WRITE(0X40);//write start from 00h ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X08);//write 9 reg 8+1=9 ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X05);//00000101 RBIAS + spi timeout ADS1259_Init_Short_Delay(DELAY_SHORT); //ADS1259_WRITE(0X01);//00000001 spi timeout ADS1259_WRITE(0X18);//00011000 SINC2 + EXTREF ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X03);//60sps , gate Convert mode ADS1259_Init_Short_Delay(DELAY_SHORT); //OFC[2:0] ADS1259_WRITE(0X00); ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X00); ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X00); ADS1259_Init_Short_Delay(DELAY_SHORT); //FSC[2:0] ADS1259_WRITE(0X00); ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X00); ADS1259_Init_Short_Delay(DELAY_SHORT); ADS1259_WRITE(0X40);
the result is all the same ,nothing changed,
i get the data below again:
ADS1259_REG[0] = 0x25
ADS1259_REG[1] = 0x8
ADS1259_REG[2] = 0xc0
ADS1259_REG[3] = 0x0
ADS1259_REG[4] = 0x0
ADS1259_REG[5] = 0x0
ADS1259_REG[6] = 0x0
ADS1259_REG[7] = 0x0
ADS1259_REG[8] = 0x40
could anyone tell me why?
is something wrong in precedure of Read from Registers and Write to Register??
thank you verymuch