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.

CCS/ADS1293: MSP430 and ADS1293 SPI reading problem

Part Number: ADS1293
Other Parts Discussed in Thread: MSP430G2553,

Tool/software: Code Composer Studio

Hi everyone.

I am using the MSP430G2553 to interface ADS1293 by SPI communication. MSP430 is running at 16MHz.

I am using USCI_B0 as master (P1.5 = CLK, P1.6 = SOMI and P1.7 = SIMO)  and P2.2 as output for CS. Based on MSP430/ADS1293 Interface Code Library v1.0 I writed the code for

writing and reading registers.

void ADS1293_SPI_WriteRegister(uint8_t address, uint8_t value)
{
    uint8_t inst;

    P2OUT &= ~CS;                       // CS enable

    inst = ADS1293_WRITE_BIT & address; // Register address for writing

    while(!(IFG2 & UCB0TXIFG));         // Wait for TXBUF
    UCB0TXBUF = inst;                   // Send address

    while(!(IFG2 & UCB0TXIFG));         // Wait for TXBUF
    UCB0TXBUF = value;                  // Send data

    while(UCB0STAT & UCBUSY);           // Wait for TX complete
    P2OUT |= CS;                        // CS disable
}

uint8_t ADS1293_SPI_ReadRegister(uint8_t address)
{
    uint8_t x, inst;

    P2OUT &= ~CS;                       // CS enable

    inst = ADS1293_READ_BIT | address;  // Register address for reading

    while(!(IFG2 & UCB0TXIFG));         // Wait for TXBUF
    UCB0TXBUF = inst;                   // Send address

    while(!(IFG2 & UCB0TXIFG));         // Wait for TXBUF
    UCB0TXBUF = 0;                      // Send dummy data

    while(UCB0STAT & UCBUSY);         // Wait for TX complete
    x = UCB0RXBUF;                      // Read data

    P2OUT |= CS;                        // CS disable

    return x;                           // Return byte
}

This is the code that configures SPI also based on MSP430/ADS1293 Interface Code Library v1.0

void SPIInit()
{
    UCB0CTL1 |= UCSWRST;                    // Reset UCB0 peripheral
    UCB0CTL0 = UCCKPH + UCMSB + UCMST + UCSYNC;
    /*
     * UCCKPH = 1, UCCKPL = 0;
     * MSB First
     * 8-bit data
     * Master mode
     * 3-pin SPI
     * Synchronous mode
     */
    UCB0CTL1 |= UCSSEL_2;                   // Select SMCLK
    UCB0BR0 |= 0xA0;
    UCB0BR1 = 0x00;                         // 16MHz / 160
    P1SEL |= CLK | SOMI | SIMO;
    P1SEL2 |= CLK | SOMI | SIMO;            // Set P1.5 P1.6 P1.7 modes to SPI
    P1DIR |= CLK | SIMO;                    // Set CLK and SIMO pins as outputs
    P1DIR &= ~SOMI;                         // Set SOMI as input
    P2DIR |= CS;                            // Configure CS pin
    P2OUT |= CS;                            // Disable CS
    UCB0CTL1 &= ~UCSWRST;                   // Initialize USCI state machine
}

After set up ADS1293  I read ONE register to make sure I set up the device correctly. For example, I read the register 0x02, and it´s supposed to get 0x19, but always get 0x00 even in other registers

I think I write properly the registers because the DRDYB pin is asserted (Port interrupt).

Could you help me with this issue? or what am I doing wrong?

Thank you.

Luis