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.

ADS1248 read and write code : Problem

Other Parts Discussed in Thread: MSP430F169, ADS1248, MSP430F449, ADS1248EVM-PDK

Hallo

i am Florian and am working with a ADS1248 and MSP430f169.

I have a problem because i make the same timing from figure 80 (ASD1248 Datasheet).

Can i have some help?

Start is High

CS is High

Reset is High

Did you have some code for reading and writing.

i'll like some help.

Thanks

  • Hello Florian,

    Is it possible to get timing oscilloscope plots showing the pins of interest? CS,DIN,SCLK, DRDY, DOUT. This may help us determine the issue.

    Thank you and Kind Regards,

    Luis

  • Florian,

    As Luis has mentioned, it would be helpful if we can see scope shots to verify your timing.  It would also be helpful to know just what you are trying to do.  Are you trying to read the data results?  Are you trying to read from the registers?  Are you trying to write?  How have you determined that you are not communicating properly?

    I've attached a file of code that contains some reading and writing routines used with the ADS1248EVM-PDK.  This is written for the MSP430F449 and may be a bit hard to follow as we also use freeRTOS.  Basically we read data results with an interrupt routine, and when we read and write the registers we do a SDATAC command first so that the conversion results on not inadvertently updating while we are reading/writing the registers.  To again start conversions we give a RDATAC command.

    Best regards,

    Bob B

     

  • Bob B,

    Thanks for helping me. The   timing on the  oscilloscope plots showing the pins of  CS,SCLK, DOUT.

    The Embedded Program i wrote to this picture : At the Beginning Start, Reset, CS  =  High  (as draw in page 55 figure 80)

            Yellow = CS          Red = SCLK        Blue = DOUT

     

    I wrote first :

    NOP                   SDATAC             WREG                RREG               RDATAC   (DOUT on Figure 80)

    A Code.c files .

    WDTCTL = WDTPW + WDTHOLD; // Watchdog stoppen 			//  main.c
          
         
         spi_disenable() ;  // CS High 
         chip_set()    ; // Reset High 
         start_conv() ; 
          
          system_init()  ; 
        _BIS_SR(GIE)   ; 
         
      
    
       while(1)
       {  
        ;  
        
       }
        
       
     
           
    }// End main 
    
    /*#pragma vector = USART0RX_VECTOR
    __interrupt void usart0_rx(void)
    { 
      
      TXBUF0 = RXBUF0 ;
      
    }*/
    
    #pragma vector=PORT2_VECTOR
    __interrupt void Port_2(void)
    {  
        
       unsigned char i ; 
      
    
      P2IE &= ~  0x01; 
     //send_comand(SDATAC) ;
     
      //send_comand(SDATAC) ; 
      write_register(mux0) ; 
     write_register(mux0) ; // We want to write in Register Mux 
      
     read_register(mux0) ; // We Register to 
     
     //send_comand(RDATAC) ; 
     
     *(mux0 + 1 ) = 0x7f  ; 
    
     P2IE |= 0x01;   
     P2IFG &= ~0x01; 
     
    }
    								//   	NETZTEIL.c
    
    
    void read_register (unsigned char* ptr)
    {
      
     unsigned char i ;
     
     spi_enable() ; 
     TXBUF1 = RREG + *ptr; // Command + regeister waehlen 
        
     while( (UTCTL1 & TXEPT) == 0 ) ;
     delay(50) ;
     
     TXBUF1 = 0x00 ; 
     
     while( (UTCTL1 & TXEPT) == 0 ) ;
     delay(50) ; 
     TXBUF1 = 0xff ;
      
      while( (UTCTL1 & TXEPT) == 0 ) ; 
       delay(5) ; 
       
     *(ptr + 1 )= RXBUF1 ; 
         
     spi_disenable() ;
     //start_conv()  ; 
     
    } // Ende Funktion Read, register 
    
    
    void write_register ( unsigned char* ptr) 
    { 
      unsigned char i ; 
     
      spi_enable() ; 
      TXBUF1 =    WREG + *ptr  ; // Send write Command + Registeradresse 
      while( (UTCTL1 & TXEPT) == 0 ) ;
       delay(5) ; 
      
      TXBUF1 = 0x00 ; // The number of Register - 1 
      while( (UTCTL1 & TXEPT) == 0 ) ;
       delay(5) ; 
        
      TXBUF1 = *(ptr + 1) ;  // Send the writeByte
       while( (UTCTL1 & TXEPT) == 0 ) ;
       delay(5) ; 
       
      spi_disenable() ; 
      //start_conv()  ; 
      
    } // Ende Funktion write_register
    
    void read_byte(unsigned char  *data) 
    {
      unsigned char i ; 
      spi_enable() ; 
      TXBUF1 = 0x13 ; 
      while( (UTCTL1 & TXEPT) == 0 ) ;
      delay(4) ; 
      for( i = 0 ; i<3; i++) 
      {
        TXBUF1 = 0xFF ; 
         while( (UTCTL1 & TXEPT) == 0 ) ;
        *(data +i) = RXBUF1 ; 
      }
      spi_disenable() ; 
       
    }
    
    
    void wake_up(void) 
    {
      spi_enable() ; 
      TXBUF1= 0x01 ; 
       while( (UTCTL1 & TXEPT) == 0 ) ;
       spi_disenable() ; 
      
    }
    
    void send_comand( unsigned char cmd) 
     
     
    {
      unsigned char i ;
    
    /*for ( i = 0; i < 40 ; i++) 
    delay(5000) ; */ 
      spi_enable() ;  //at the beginning CS will low
      delay(50) ; 
     TXBUF1 = cmd ;   // Send command 
      while( (UTCTL1 & TXEPT) == 0 ) ; // wait until the Buffer is empty
     delay(50) ;          // Wait for few �S
     spi_disenable() ;   // CS wil take High
      
    }
    

     

    I need some solution.

    Thanks

  • Baho Florian,

    The first thing I notice is that something is loading DOUT.  This may affect the noise margin of the digital signal.  The second thing I notice is that there is no DIN signal shown.  What would be really helpful is to be able to see when the actual signal transitions take place.  I realize you wanted to show me the whole sequence, and that is somewhat helpful, but I really need to see the DIN/DOUT/SCLK transitions.  In particular, I would like to see a larger image of the write sequence.

    What you need to see is that the data is stable at the clock transistions.  For the write condition the data needs to be stable from your processor on the on the falling edge of SCLK.

    One thing to keep in mind is that when you run your sequence you do not know exactly when SDATAC takes effect.  SDATAC will not stop updating the output register until after the next DRDY transitions low.  I'm not sure how you are driving your interrupt that starts this sequence, but looking at the data it would almost appear that the conversion data is being output instead of the register data.  You may want to probe DRDY and see when that pin transitions to see when SDATAC really takes effect.

    It would also be helpful to see a schematic as to how you have the ADS1248 connected to your processor, the data rate you are running the conversons and the timebase for the scope shots.

    Best regards,

    Bob B

  • now i can send you CS/DOUT/SCLK & Codes   

    http://e2e.ti.com/cfs-file.ashx/__key/CommunityServer-Discussions-Components-Files/73/710[View:http://e2e.ti.com/cfs-file.ashx/__key/CommunityServer-Discussions-Components-Files/73/8463.ads1.txt3.ADC-Initial-Setup.pdf]

     

     

     

    With regards,

     

    Baho Florian

  • Baho Florian,

    According to the scope shots you sent DIN is always low, which means data is never being sent to the part.  Verify that the data you sent me is actually DIN and not CS for the last few scope shots in the PDF you sent.  If you were monitoring the correct pin, you will need to see why the data is always low.

    Best regards,

    Bob B