Other Parts Discussed in Thread: CC2640R2F
Hi,
I've designed a board by myself to use CC2640R2F to read data from ADS1291. It works fine when I use the Main CPU to control it, I can read and write the registers and collect the ECG signal correctly.
However I wanted a higher sample rate, so I tried to use Sensor Controller Engine to communicate with ADS1291.
I followed the initial flow at power-up of ADS1291, I can send the SPI commands like START, STOP, RDATAC, SDATAC to control the ADS1291, but when I try to read or write the registers, ADS1291 gives no response.
Here's the Initialization Code in Sensor Controller Studio, please help.
macro spiWriteReg(addr, value) { spiBegin(SPI_POL0_PHA1,AUXIO_SPI_CSN_CS); spiTx16bit(SPI_POL0_PHA1,addr); spiTx8bit(SPI_POL0_PHA1,value); spiEnd(SPI_POL0_PHA1,AUXIO_SPI_CSN_CS); } macro spiReadReg(addr, value) { spiBegin(SPI_POL0_PHA1,AUXIO_SPI_CSN_CS); spiTx16bit(SPI_POL0_PHA1,addr); spiRx8bit(SPI_POL0_PHA1;value); spiEnd(SPI_POL0_PHA1,AUXIO_SPI_CSN_CS); } macro spiWriteCmd(value) { spiBegin(SPI_POL0_PHA1,AUXIO_SPI_CSN_CS); spiTx8bit(SPI_POL0_PHA1,value); spiEnd(SPI_POL0_PHA1,AUXIO_SPI_CSN_CS); } gpioSetOutput(AUXIO_O_RST); for(U16 n=0;n<10;n++) { fwDelayUs(100000,FW_DELAY_RANGE_100_MS); } gpioClearOutput(AUXIO_O_RST); fwDelayUs(10,FW_DELAY_RANGE_10_US); gpioSetOutput(AUXIO_O_RST); fwDelayUs(36,FW_DELAY_RANGE_100_US); // Set stop spiWriteCmd(0x0A); fwDelayUs(5000,FW_DELAY_RANGE_10_MS); spiWriteCmd(0x11); fwDelayUs(1000,FW_DELAY_RANGE_1_MS); spiReadReg(0x2000,output.reg); fwDelayUs(1000,FW_DELAY_RANGE_1_MS); //Configure the Config1 spiWriteReg(0x4100,0x03); fwDelayUs(1000,FW_DELAY_RANGE_1_MS); spiReadReg(0x2100,output.reg); fwDelayUs(1000,FW_DELAY_RANGE_1_MS);