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.

ADS1298: Not able to write registers of ADS1298 with MSP430F67751

Part Number: ADS1298
Other Parts Discussed in Thread: MSP430F67751,

Hello,

I am Not able to write registers of ADS1298 with MSP430F67751,I have followed initial flow at power up from datasheet.

but i can read registers at the same time.Below is the sequence i write for reading the one of registers and it is working fine.

Please help and suggest me to write the registers so that i can capture data from channels.

while(1)
{
if (cFrame_Received_Flag==1)
{

fSend_Char('p');

__delay_cycles(8196721);                        //1 sec delay, 18 tclk
P4OUT ^= BIT6;                                       // set P4.6, ADC_RST
__delay_cycles(50);                               //4uS delay (7.2 uS = delay (50)), 2 tclk
P4OUT ^= BIT6;
__delay_cycles(110);                                //16tclk
send_spi(0x11);                                        // Device Wakes up in RDATAC mode, so send SDATAC command so Registers can be written
__delay_cycles(8196);                               //1ms


//unsigned char dataArray[4]={0x41,0x02,0x86,0x00};
//SPISend(dataArray, 4);

RREG(0x21,0x01);
__delay_cycles(81967);


P4OUT |= BIT5;                                                          //START=1


send_spi(0x10);                                                         //Put the Device Back in RDATAC Mode

__delay_cycles(1);


cFrame_Received_Flag=0;
}
}

  • Hi Ashish,

    Welcome to our e2e forum! You are not giving us much to go on here with your ADS1298 query. Let's start with the hardware - how do you have the ADS1298 mounted and powered? Can you provide a schematic? How is the MSP430F67751 connected to your ADS1298 setup? Is this all on one PCB or are you fly-wiring the control signals to the ADS1298? Can you provide a scope capture of the communication lines to the ADS1298?
  • Hello,

    here are the info required:

    Can you provide a schematic? How is the MSP430F67751 connected to your ADS1298 setup? Is this all on one PCB or are you fly-wiring the control signals to the ADS1298?

    Yes please find above, Please note that MSP430 mounted on different PCB and i am using it's one of SPI channel for ADS1298. the signals are travelling on 5 c.m. wires from uc to ADS1298.

    Can you provide a scope capture of the communication lines to the ADS1298?

    Yes Please find below reading sequence

    and writing sequence

    Hope i have provided all information required.

    Thanks,

    Ashish Jain

  • Hi Ashish!

    Thanks for the added detail!  That's really helpful!  Please take a look at Figure 1 in the ADS1298 datasheet, and look at the note just below it.  The SPI clock should dwell low and the data should be valid with the falling SCLK edge (change on rising).  Next, take a look at the screen shots you provided - especially the one where you are trying to read Register 03h and notice the difference in the phase relationship between MISO and MOSI.  Try changing your SPI clock and phase parameters and see if that clears up the issues you are having.

  • Dear TOM,

    I have set CPOL = 0 and CPHA = 1. In this Mode I could not read the registers,

    I could read the registers  with CPOL = 1 and CPHA = 0. and with CPOL = 0 and CPHA = 0.

    I think regarding CLK polarity, as i am able to read the registers with existing setting,the same should work to write the registers. Please suggest.

    Also please share if there is any code example for initialization of ADS1298 is available with you. I am stuck.

    Also from my screenshots, i have SPI clock of 2 MHz, just for your consideration as if any of delay in my sequence is wrong.

    I think i am making some sequencing error.please help

    Regards,

    Ashish jain

  • Dear TOM,

    I have set CPOL = 0 and CPHA = 1. In this Mode I could not read the registers,

    I could read the registers with CPOL = 1 and CPHA = 0. and with CPOL = 0 and CPHA = 0.

    I think regarding CLK polarity, as i am able to read the registers with existing setting,the same should work to write the registers. Please suggest.

    Also please share if there is any code example for initialization of ADS1298 is available with you. I am stuck.

    Also from my screenshots, i have SPI clock of 2 MHz, just for your consideration as if any of delay in my sequence is wrong.

    I think i am making some sequencing error.please help

    Regards,

    Ashish jain
  • Hi Ashish,

    Some of the MSP430 documentation does not follow the same conventions as the 'typical' SPI peripherals, so lets not get caught up in that just yet - as long as you are writing to the device as shown in Figure 1 of the datasheet, you should be fine. What are you doing with the /CS pin?
  • Hello,

    thanks for reply,

    i have tied the CS Pin to low as of now to get initialize and to fist communication done.

    Also, I want to let you know that i my DRDY pin is not going high to low after giving START signal high.Here is my sequence according to datasheet DRDY signal should go high to low after RDATAC command.

     

    while(1)
    {
    if (cFrame_Received_Flag==1)

    {


    fSend_Char('p');

    P4OUT |= BIT5;                                                              //START=1
     //__delay_cycles(8196721);                                               //1 sec delay, 18 tclk
    __delay_cycles(12295081);
    P4OUT ^= BIT6;                                                               // set P4.6, ADC_RST
    __delay_cycles(8);                                                           //4uS delay (7.2 uS = delay (50)), 2 tclk
    P4OUT ^= BIT6;

    __delay_cycles(60);                                                        //16tclk
    send_spi(0x11);                                                              // Device Wakes up in RDATAC mode, so send SDATAC command so Registers can be written
    __delay_cycles(8197);                                                    //1ms

    unsigned char dataArray[14]={0x41,0x0C,0x86,0x00,0xC0,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01};
    SPISend(dataArray, 14);
    __delay_cycles(819672);                                                //100ms

    // RREG(0x21,0x01);

    __delay_cycles(81967);

    P4OUT |= BIT5;                                                             //START=1

    send_spi(0x10);                                                            //Put the Device Back in RDATAC Mode

    __delay_cycles(819672);

    cFrame_Received_Flag=0;

    }

    }
    }

    Regards,

    Ashish Jain

  • Hi Ashish,

    No DRDY may be a clue here - how are you controlling the PWDN and RESET pins?
  • Hi Tom,

    As you can see in my circuit image provided earlier, RESET has a pull up and controlled by MSP430 I/O and PWDN tied to high.

    hey i have got the DRDY PIN Pulse every 2ms ,now according to datasheet it says issue '24+n*24 SCLKs'

    Please suggest how to do this.

    Thanks,

    Ashish jain

  • Hi Ashish,

    Progress! That's good! Use the DRDY as an interrupt to the MSP430. When DRDY goes active, you have to send clocks to the ADS1298 - 24 to read out the status register and the 24*n (where 'n' is the number of enabled channels). Since the MSP430 is the SPI master, the only way to get clocks out is to move something to the transmit buffer - if all you are doing is reading data, you can send 0x000000 (three bytes of zero) to get 24 clocks to get the status word - continue sending zeros until you read out all channel data. This has to be finished within the 2ms time period between the DRDY output pulses.
  • Hi Tom,

    Yes now it is replying data for 27 bytes (216 bits) and it is matching datasheet as C00 and 8 times 800.

    thanks a lot for this help.

    now i will start to test on real values to measure.

    Regards,

    Ashish jain