ADAS3022 Arduino example code for all channel reading we need

Hi,

we are  working ADAS3022EDZ Eval board to communicate SPI through Arduino board. please help me 

  • 0
    •  Analog Employees 
    on May 18, 2021 2:12 AM

    Hi, 

    I can't seem to find an example code specific for your MCU. Because of its maximum speed our boards are usually design in conjunction with FPGA. And we have an example project for FPGA that you can use as a starting point. 

    CED1Z FPGA Project for ADAS3022 with Nios driver [Analog Devices Wiki]

    We will contact the product owner and let you know if we have any other resources that you can use. 

    Thanks,

    Jellenie

  • Thanks for reply. how We will contact the product owner?

  • 0
    •  Analog Employees 
    •  Super User 
    on May 18, 2021 6:44 PM

    Bakyaraj,

    As Jellenie accurately summarized we don't have any prepared example code for reference for the Arduino IDE that you could use directly.  Depending on your sampling requirements we may be able to make suggestions as to how you might quickly prototype some code that will allow you to get started but which we can't guarantee will work over all conditions.  To that end can you let me know the following.

    1) How quickly do you intend to sample each channel?   Please note that depending on your chosen Arduino target you are going to be limited to a fraction of the full data throughput.

    2) Just to verify you are going to be using the multiplexed ADAS3022 and not the simultaneous sampling ADAS3023.

    3) Assuming you are using the ADAS3022 are you planning on:

    • Using either the simple or advanced sequencer functions?
    • Sampling temperature or the auxiliary channel input in sequencer mode?
    • Alternatively do you want to be able to update the configuration on every conversion?

    4) Which Arduino product are you using? Uno/Due other.

    To get you started while you get back to me with specifics to the questions above I would recommend familiarizing yourself with the following.

    1) The SPI Library and specifically using the Interrupt driven call 

    2) There are a number of Timer libraries available that would allow generation of the convert start signal which you could then also use to generate a spi transaction from within the same code for asynchronous operation or you could use the BUSY pin as an interrupt to synchronously trigger the spi transaction.

    Anyways if you can prepare some answers to the question and get back to me we can at least attempt to put together a prototype flow that allows you to get started on development from a concept perspective with respect to connectivity and a state flow diagram.   However, on the code side you'll need to rely a bit more on the Arduino users as the experts on how to implement the solution to optimize the conversion rate.


    Sean

  • thanks for reply..

    I beginner of the ADAS3022 .

    Forum referred Arduino code to implemented to TMS570ls3137

    https://ez.analog.com/data_converters/precision_adcs/f/q-a/110284/interfacing-configuring-adas3022/333461

    I was faced issue for IN0/IN1 only take output remaining Channel output we are not able to read.

    my code:

       ADAS3022_Clear_Power_Down();

        ADAS3022_Clear_Reset();

        ADAS3022_Set_Reset();

        ADAS3022_Clear_Reset();
        
        // Configure Device

        ADAS3022_Set_Conversion();
        ADAS3022_Clear_Conversion();

        gioSetBit(spiPORT300);
        
        spiTransmitAndReceiveData(spiREG3, &dataconfig1_t8HV_SPI_TX_Data_Master,&HV_SPI_RX_Data_Master[0]);
        
        gioSetBit(spiPORT301);

        //DUMMY CONVERSIONS
       /*0-1*/
        ADAS3022_Set_Conversion();
        ADAS3022_Clear_Conversion();

        ADAS3022_Set_Conversion();
        ADAS3022_Clear_Conversion();
     

        gioSetBit(spiPORT300);

        spiTransmitAndReceiveData(spiREG3, &dataconfig1_t1HV_SPI_TX_Data_Master_1,&HV_SPI_RX_Data_Master[1]);

        spiTransmitAndReceiveData(spiREG3, &dataconfig1_t1HV_SPI_TX_Data_Master_1,HV_SPI_CONFIG);


        HV_SPI_Voltage[0] = (float)  ((((float)HV_SPI_RX_Data_Master[1] / 32768.0)  * INPUT_VOLTAGE_RANGE));
        
        gioSetBit(spiPORT301);

        /*1-2*/
        ADAS3022_Set_Conversion();
        ADAS3022_Clear_Conversion();


        gioSetBit(spiPORT300);

        spiTransmitAndReceiveData(spiREG3, &dataconfig1_t1HV_SPI_TX_Data_Master_1,&HV_SPI_RX_Data_Master[2]);

        HV_SPI_Voltage[1] = (float)  ((((float)HV_SPI_RX_Data_Master[2] / 32768.0)  * INPUT_VOLTAGE_RANGE));
        
        gioSetBit(spiPORT301);

        /*2-3*/
         ADAS3022_Set_Conversion();
        ADAS3022_Clear_Conversion();

     
        gioSetBit(spiPORT300);

        spiTransmitAndReceiveData(spiREG3, &dataconfig1_t1HV_SPI_TX_Data_Master_1,&HV_SPI_RX_Data_Master[3]);

        HV_SPI_Voltage[2] = (float)  ((((float)HV_SPI_RX_Data_Master[3] / 32768.0)  * INPUT_VOLTAGE_RANGE));

        gioSetBit(spiPORT301);
        
        /*4-5*/
        ADAS3022_Set_Conversion();
        ADAS3022_Clear_Conversion();

      
        gioSetBit(spiPORT300);

        spiTransmitAndReceiveData(spiREG3, &dataconfig1_t1HV_SPI_TX_Data_Master_1,&HV_SPI_RX_Data_Master[4]);

        HV_SPI_Voltage[3] = (float)  ((((float)HV_SPI_RX_Data_Master[4] / 32768.0)  * INPUT_VOLTAGE_RANGE));

        gioSetBit(spiPORT301);
        
        /*6-7*/
        ADAS3022_Set_Conversion();
        ADAS3022_Clear_Conversion();

        gioSetBit(spiPORT300);

        spiTransmitAndReceiveData(spiREG3, &dataconfig1_t1HV_SPI_TX_Data_Master_1,&HV_SPI_RX_Data_Master[5]);

        HV_SPI_Voltage[4] = (float)  ((((float)HV_SPI_RX_Data_Master[5] / 32768.0)  * INPUT_VOLTAGE_RANGE));

        gioSetBit(spiPORT301);
    we are executing code is while one.
    please help me.
  • 1.SPI we are using Polling method  And 1Mhz frequency...

    We have attached outputs