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.

ADS1158 Register Read Not working

Other Parts Discussed in Thread: MSP430F5438, ADS1158

I need to interface ADS1158 with MSP430F5438. ADC is working in unipolr supply (AVDD=5v, Dvdd=3.3v).

I have checked the ADC pins DIN, SCLK & seem to be getting the data correctly from msp. But, I am not observing any data on DOUT.

Please help me to get the adc to respond.

Here's my code snippet:

#include "msp430x54x.h"

unsigned char MST_Data,SLV_Data;

void main(void)
{
  WDTCTL = WDTPW+WDTHOLD;                   // Stop watchdog timer

  P1OUT |= 0x02;                            // Set P1.0 for LED
                                           
  P5DIR |= BIT1;// Set P5.1 for slave reset & P5.0 for cs
  P5DIR |= BIT2;
  P5OUT |= 0x03;
  __delay_cycles(4096);
  P5OUT |= 0x02;
 
  P1DIR |= 0x03;                            // Set P1.0-2 to output direction
  P3SEL |= BIT7;                            // P3.5,4,0 option select
  P5DIR |= BIT4;
  P5DIR |= BIT5;
  P5SEL |= BIT4;
  P5SEL |= BIT5;
 

  UCB1CTL1 |= UCSWRST;                      // **Put state machine in reset**
  UCB1CTL0 |= UCMST+UCMSB+UCSYNC+UCCKPL;    // 3-pin, 8-bit SPI master //UCCKPL,UCMSB - inactive state is high
    //UCB1CTL0 |= UCSYNC+UCMST;                                        // Clock polarity high, MSB
  UCB1CTL1 |= UCSSEL_1;                     // SMCLK
  UCB1BR0 = 0x01;                           // /1
  UCB1BR1 = 0;                              //
  //UCB1MCTL = 0;                             // No modulation
  UCB1CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
  UCB1IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt

  P5OUT &= ~0x02;                           // Now with SPI signals initialized,
  P5OUT |= 0x02;                            // reset slave

  __delay_cycles(100);                      // Wait for slave to initialize

  MST_Data = 0x49;                          // Initialize data values
  SLV_Data = 0x8B;                          //

  while (!(UCB1IFG&UCTXIFG));               // USCI_A0 TX buffer ready?
  UCB1TXBUF = MST_Data; 
  // Transmit first character
 
  while(1)
  {
    __delay_cycles(50000);
     while (!(UCB1IFG&UCTXIFG));               // USCI_A0 TX buffer ready?
        UCB1TXBUF = MST_Data;
  }
  //__bis_SR_register(LPM0_bits + GIE);       // CPU off, enable interrupts
}

#pragma vector=USCI_B1_VECTOR
__interrupt void USCI_B1_ISR(void)
{
  switch(__even_in_range(UCB1IV,4))
  {
    case 0: break;                          // Vector 0 - no interrupt
    case 2:                                 // Vector 2 - RXIFG
      while (!(UCB1IFG&UCTXIFG));           // USCI_A0 TX buffer ready?

      if (UCB1RXBUF==SLV_Data)              // Test for correct character RX'd
        P1OUT |= 0x01;                      // If correct, light LED
      else
        P1OUT &= ~0x01;                     // If incorrect, clear LED
      break;
    case 4: break;                          // Vector 4 - TXIFG
    default: break;
  }
}

  • Hi Barath,

    How are you controlling the /CS input to the ADS1158?  Can you possible post a schematic of the ADC connections? 

  • Tom, I am attaching a detailed diagram of the connections between MSP & ADC.

    Sequence of program:

    ->Take the CS pin high, then low.

    ->Do the configurations for SPI.

    ->Reset the ADC.

    ->Send the command 0x49(register read mode(010b), MUL bit reset, address bits is 0x09 to read contents of ID register)

    I dont get any response from the ADC for this command.

  • Hi Barath,

    Please double check your connections to the ADS1158.  SOMI from your controller should go to J6A.13, not 11 as shown above.  Likewise, SIMO would go to J6A.11, not 13.  Your SCLK needs to go to pin J6A.3, not pin 2.  The /CS and /RST signals look right.

  • Tom, Changes noted.

    It was a mistake on my part that I did not draw the connections properly and misplaced the pin names. Its actually connected like what you have described.

    My actual setup is :

    SIMO ( MSP Pin 3.7) - Din ( ADC Pin J6A.11)

    SOMI ( MSP Pin 5.4) - Dout ( ADC Pin J6A.13)

    CLK ( MSP Pin 5.5) - SCK ( ADC Pin J6A.3)

     

    I also checked by giving a START signal with all the registers in the ADC with its default value with an input signal between Ain0-Ain1 and still found no response at the Dout pin.

  • Hi Barath, 

    After you power up the ADS1158EVM and brought the START pin high, have you monitored the /DRDY signal to see if it is pulsing indicating ready data. I know this is different than reading back register contents as you state your original goal is. Testing the /DRDY signal is a quick way to see if you have the ADC powered up correctly and functioning. You should see something similar to the bottom timing diagram in Figure 39. 

    Also, I know you may know this but just to make sure, after you send 0x49, make sure you send additional clocks to read back the contents. Also, have you tried reading back any other register other than the ID register? 

    Finally, it would help if you could post a scope picture of your signals so we can verify that you have the correct command and clock polarity / phase. 

    Regards,

    Tony Calabria

  • Tony,

    I was not sending additional clocks to read back the data. I am able to get the response from ADC with the contents of the register. I achieved this by sending dummy 0x00 after sending the control command on the DIN pin. Here is the code snippet which helped to get a response from the ADC:

    while (!(UCB1IFG&UCTXIFG));               // USCI_B1 TX buffer ready?
      UCB1TXBUF = MST_Data;                 // Transmit first character
     
      int i=0;
      while ((!(UCB1IFG&UCTXIFG))&& (i<3) );               // USCI_B1 TX buffer ready?
      {
        UCB1TXBUF = 0x00;      // Transmit additional zeros for SCLK cycles
        i++;
      }

     

    As you can see, I am getting a response from the ADC but the MSP430 is not getting interrupted with the received byte as it is still transmitting 0's.

    Is there another way to successfully send additional clock cycles from MSP to the ADC ?

    Or is there a way by which I can keep the SCLK active all the time?