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.

ADS131E04: SPI Interface Initialization Problem

Part Number: ADS131E04

Hello,

I'm using ADS131E04 connected with a PIC32MZ microcontroller, but I'm facing some problems to use the SPI Interface to initialize and control the device. I'm following the Startup Procedure described in Application Information section (Sec. 10.1.2) using as settings:

- CLKSEL = 1 to use the internal oscillator master clock;

- PWNDN and RESETN not controlled (and fixed to 3.3V so always = 1)

- SCLK = 1 Mhz

I initialized the device stopping conversion (driving START = 0) and waited tPOR for the fCLK = 2.048 Mhz used as master clock before to initialize the SPI Interface. After that I sent the RESET command but SPI Interface blocks and continue to send commands only if I power off the ADC (Micro and ADC are on two different boards, so two different power supplies). 

This is what I got with an analog discovery device:

This is my initialization code

void APP_Initialize ( void )
{
    /* Place the App state machine in its initial state. */
    appData.state = APP_STATE_INIT;
    
    /* Wait an initial time for power-up */
    /* F_clk = 2.048 Mhz */
    /* t_clk = 0.488 us */
    /* tPOR = 2^18 * t_clk = 127926 us */
    ADC_StaticDelay(130000);
ADC_START_LOW();
/* TODO: Initialize your application's state machine and other * parameters. */ }
void APP_Tasks ( void )
{

    /* Check the application's current state. */
    switch ( appData.state )
    {
        /* Application's initial state. */
        case APP_STATE_INIT:
        {          
            
            ADC_Init();
            
            /* Reset Device */
            ADC_SendCommand(RESET);
            
            /* Delay to wait reset ok */
            /* 18 t_CKL = 18* 0.488 = 8.784 us */
            ADC_StaticDelay(10);
            
            /* Read ID Register */
            ADC_ReadRegister(ID);
            
            bool appInitialized = true;
       
        
            if (appInitialized)
            {
            
                appData.state = APP_STATE_SERVICE_TASKS;
            }
            break;
        }

        case APP_STATE_SERVICE_TASKS:
        {
        
            break;
        }

        /* TODO: implement your application state machine.*/
        

        /* The default state should never be executed. */
        default:
        {
            /* TODO: Handle error in application's state machine. */
            break;
        }
    }
}

Someone could suggest to me what I'm doing wrong in the initialization of this ADC?

Thank you for the support.

Salvatore De Simone.

  • Hello Salvatore,

    Thanks for your post.

    Once the powers supplies are established, you should then wait tPOR before issuing the RESET command. It looks like you are doing this correctly in line 10. You should observe /DRDY going from low to high and remaining high until tSETTLE has passed. Do you see /DRDY toggle at all during your start-up sequence?

    Regards,
    Ryan
  • Hi Ryan,

    With the analog discovery device i see /DRDY toggle at 1/64 fCLK when the power supply is stable and START line is HIGH. So in my initialization code in line 10 after the tPOR is passed I stopped the toggling with ADC_START_LOW() that drive the START line down and infect the device stops toggling the /DRDY and DOUT line.

    Then I tried to activate the SPI Interface and send the RESET command to try to use the device, initially reading the ID register. Anyway like you see the SPI interface is stucked on the RESET command, DRDY go from low to high and remains in high state. Maybe RESET line is necessary to activate the ADC? 

    I setted CPOL = 0 and CPHA = 1 in my SPI master settings. Are these settings correct ?

    Thank you for the support.

    Salvatore.

  • Hi Salvatore,

    Yes - CPOL = 0 and CPHA = 1 are correct.

    I'm not sure what you mean by "activate the SPI." There is nothing special you need to do other than bring /CS low to begin comunication. Following the RESET command, it will take 18 tCLK cycles before you can begin communicating with the device again. Are you waiting long enough time following the RESET command?

    When sending the RESET command, it is not necessary to bring START low. As a matter of fact - that explains why /DRDY remains high following the RESET command. While START is low, the modulator is not running and the conversions are stopped. Leave START high throughout your initialization sequence.

    Let me know if that solves the issue. :)

    Best Regards,
  • Hi Ryan,

    yes I was meaning exactly what you said (drive /CS low and start sending commands). After reset, just because I'm using the internal oscillator to generate the master clock, I have 1/2048 s = 0.488 us as tCLK so this is the reason of a delay of 10 us (in line 18) after the RESET command. I will try to leave START high and test communication also if /DRDY start toggling. I will update you :)

    Thanks for the support,

    Salvatore.
  • Hi Ryan,

    sorry for the long response delay. I solved the problem as follow:

    - START signal LOW
    - Sending SDATAC command before to send RREG or WREG registers
    - Changed CPOL and CPHA settings for the PIC32 (master) in :
    - DRV_SPI_CLOCK_MODE_IDLE_LOW_EDGE_RISE
    - SPI_INPUT_SAMPLING_PHASE_IN_MIDDLE

    Thank you for all the support given to me.

    Salvatore.