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.

ADS1291: Can't write registers with CC2640R2f sensor controller

Part Number: ADS1291
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);

  • Hi,

    May I ask some clarification first?

    Do you use the CC2640R2F as the only host/master/MCU to control the ADS1291?

    When you say "Main CPU" are you referring "Main CPU" to CC2640R2F?  Or something else?

    May I ask what are Sensor Controller Engine and Sensor Controller Studio?

    And what are the differences between when you say "Main CPU" and "Sensor Controller Engine"?

    Is you connection topology ADS1291 <==SPI===>  CC2640R2F? or something else?

    What is the working setup? Is it ADS1291 <==SPI===>  CC2640R2F? or something else?

    What is the non-working setup?   

    --------------------------------------------------------------------

    Are there or What might be the fundamental difference in terms of the SPI timing signals and diagram between the two(working setup vs non-working setup)?

    Did you try to compare the SPI signals timing side by side, i.e. working vs non-working to check&compare any significant difference?

    --------------------------------------------------------

    When you say "higher sample rate", what data rate is that?

    Were you able to achieve the same data rate in the working setup? 

    Did you try the low data rate on both working and non-working setups?

    ---------------------------------------------

    Please make sure to follow the power up and RESET sequence properly.

    And, NOTE: SPI settings are CPOL = 0 and CPHA = 1.

    ---------------------------------------------------

    When you say no response, what does that mean? Is the SCLK still sending from the host/master?

    Thanks

  • Thank you for your reply. CC2640R2F is the only MCU in this design. And CC2640R2F connect to ADS1291 through SPI. Sensor Controller Engine is like a small CPU in CC2640R2F to control the sensors instead of using the main MCU. You can check the datasheet of CC2640R2F for more details.

    The working and non-working setups sharing the same IO pins, have the same SPI working mode.

    I can send the SPI commands correctly. After sending START, and RDATAC, I can get regular DRDY and read the data correctly. 

    It’s nothing to do with the sample rate, I can’t write the registers of ADS1291, it can only working with 125sps. But in working setup, all the functions are normal. 

    I’ve checked the power up and RESET timing. But I can’t check the SPI signal, because after I tested the working setup, I removed all the debug pins in the design.

  • I figured out the issue - there was only a 300ns delay between CS low and the rising edge of the first SCLK, and between the falling edge of the last SCLK and CS high. Adding 10us delays before the first and after the last SCLK resolved the problem and allowed communication to work properly.