Post Go back to editing

Reading data from FIFO

Hi Analog Team,

We are interfacing ADPD4100 with nRF52840 MCU.

We have set dcfg Register Basic Configuration as:-

  {0x00B4, 0x0010},
// {0x0009, 0x0094}, // 72 frequency adj
// {0x000B, 0x02EA}, //02CA 1mhz freq adj
{0x0100, 0x0100}, // 40DA
{0x000D, 0x03EB}, // setting the sampling rate // 2710 C350 20HZ C8=5khz ,
{0x000f, 0x0006}, // (1Mhz internal low freq osc)
//{0x0020, 0x0002}, // INP sleep in1 is connected to vc1
{0x0022, 0x0003}, // gpio config pin output invert
{0x0023, 0x0002}, // gpio 0 is int x
{0x0014, 0x8000}, // interrupt enable th_fifi
{0x0021, 0x0000}, // in1 connected to the single ended
{0x0006, 0x003B}, // setting the size of fifo thrshoul
{0x0101, 0x40DA}, // setting the analog path
{0x0102, 0x0001}, // IN1 connected to channel1
{0x0103, 0x5002}, // precondition with TIAVref and vc1 sel tia +215mv
{0x0104, 0x03C0}, // 13C2// AFE trim Vref 1,265 &madulatevref1.265 ,channel1 200k
{0x0105, 0x0F0F}, //
//{0x0106, 0x1919}, //
{0x0107, 0x0108}, // number of 4 pulses
{0x0108, 0x0000}, // mode selection
{0x0109, 0x0210}, // led pulse 2micro width, offset 16microsec
{0x010A, 0x0003}, // integrator clock width 3 microsec
{0x010B, 0x0206}, // int offset 16us and led width 2us 0210
{0x010C, 0x0201},
{0x010D, 0x0099}, // CHOPE MODE 99
{0x010E, 0x0000},
{0x0110, 0x0004}, // 3 bytesom
{0x0010, 0x0000}, // time slot A enable * 

Note : We are following the Driver provided on this link : adpd-drivers/adpd40xx at master · analogdevicesinc/adpd-drivers (github.com)

After doing basic configuration the led's on the adpd4100 module are glowing. Now we are trying to extract Data from the FIFO. Some random data is coming and also not refreshing. We are not able to understand the main cause.

We followed this link main.cpp firmware for FIFO reading :- adpd-drivers/main.cpp at master · analogdevicesinc/adpd-drivers (github.com)

We tried reading status of fifo using FIFO_ STATUS register, we are receiving 2200(hex) value.

Questions :- 

1.) Please suggest what wrong i may be doing from the Firmware side ?

2.) Pls share something on how to read data from the FIFO ?

Thank You 



Added details
[edited by: SloneShrub at 1:26 PM (GMT -5) on 15 Dec 2021]
Parents
  • Hello Analog team,

    we are looking forward to your response, please respond as soon as possible.

    Thank you

  • Hi SloneShrub,

    The integration offset timing need to change.

    {0x000F,0x8000},
    {0x00B4,0x0010},
    {0x0100,0x0000}, // 40DA
    {0x000D,0x03EB}, // setting the sampling rate // 2710 C350 20HZ C8=5khz ,
    {0x000f,0x0006}, // (1Mhz internal low freq osc)
    {0x0022,0x0003}, // gpio config pin output invert
    {0x0023,0x0002}, // gpio 0 is int x
    {0x0014,0x8000}, // interrupt enable th_fifi
    {0x0021,0x0000}, // in1 connected to the single ended
    {0x0006,0x003B}, // setting the size of fifo thrshoul
    {0x0101,0x40DA}, // setting the analog path
    {0x0102,0x0001}, // IN1 connected to channel1
    {0x0103,0x5002}, // precondition with TIAVref and vc1 sel tia +215mv
    {0x0104,0x03C0}, // 13C2// AFE trim Vref 1,265 &madulatevref1.265 ,channel1 200k
    {0x0105,0x0F0F}, //
    {0x0107,0x0108}, // number of 4 pulses
    {0x0108,0x0000}, // mode selection
    {0x0109,0x0210}, // led pulse 2micro width, offset 16microsec
    {0x010A,0x0003}, // integrator clock width 3 microsec
    {0x010B,0x01F5}, // int offset 16us and led width 2us 0210
    {0x010C,0x0201},
    {0x010D,0x0099}, // CHOPE MODE 99
    {0x010E,0x0000},
    {0x0110,0x0004}, // 4 bytesom
    {0x0010,0x0000}, // time slot A enable *

    Can use the above configuration for your checking.

    Regards,

    Optical Support Team

  • Hi,

    Code looks fine. Loop variable incrementing alone missing on data printing section. That's why you are getting same value for each iteration.

    Regarding FIFO read method, you can refer the "adi_adpddrv_ReadFifoData" API in driver file.

    Regards,

    Optical Support Team.

  • Hi,

    Can use the "adi_adpdssm_setOperationMode" API to set the Sensor GO Mode. I think currently you are using own written code to set the Sensor Go Mode.

    If you are wish to use your own code please refer "adpd-drivers/adi_adpd_slotops_helper.c at master · analogdevicesinc/adpd-drivers · GitHub" file to create your code for Sensor Go Mode API. The code comments itself guide you through to make your own code.

    Regards,

    Optical Support Team.

  • Hi Sathishkumar,

    I tried using "adi_adpdssm_setOperationMode" API to set the Sensor GO Mode.

    Inside "adi_adpdssm_getMaxSamplSz" API the firmware is getting stuck in do{}While() Loop.

    Below is the Loop Firmware code :-

    do{
    /* Form a loop to run until it reaches LCM value, do the condition check with count and sample size flag */
    for (uint32_t nLcm = 1U; ((nLcm <= goAdiAdpdSSmInst->oAdpdSlotInst.nLcmValue) && (nMaximumSizeFlag == 0U)); nLcm++)
    {
    _adi_adpdssm_CalculateMaxSamplSz(nTotalSampleSize, nLcm, &nMaximumSizeFlag, &nSampleSize);
    }
    /* Check the calculated size and total sample size is not exceeding fifo buffer size */
    if((nTotalSampleSize + nSampleSize) < MAX_SAMPLES_IN_FIFO)
    {
    /* Add the calculated size to total sample size variable */
    nTotalSampleSize = nTotalSampleSize + nSampleSize;
    /* Set the sample size value to '0' to calculate sample size for next sequence */
    nSampleSize = 0U;
    /* Update the sample count variable with successful size calculation*/
    nSampleCount = nSampleCount + 1U;
    }
    else
    {
    /* Check the sample count variable to update last faliure routine */
    if(nSampleCount > 1U)
    {
    /* Decrement '1' total sample count value, because last run on sample
    count loop value need to be decrement to match successful calculation alone */
    nSampleCount = nSampleCount - 1U;
    }
    }
    }while(nMaximumSizeFlag == 0U);

    Note : nTotalSampleSize, nMaximumSizeFlag and nSampleSize all values are coming 0.

    and nLcm value is starting from 0 to 865 and then again resetting.

    Questions :-

    1.) Please suggest What might be the reason ?

    2.) How to resolve this ?

    Thankyou & regards

    Vinay 

  • Hi,

    Please do call the "adi_adpdssm_slotinit(&oAdiAppInst)" API as like in example code before calling "adi_adpdssm_setOperationMode" API.

    ADPD Instance is not initialized in above main code. Due to this do while{} will run continuously until reaching desired values based on device configuration.

    Regards,

    Optical Support Team.

  • Hi,

    The firmware is running perfectly, But we are not sure whether go mode is set or not properly. (I am using adi_adpdssm_setOperationMode Api only didn't made any changes.

    The Led's are not glowing now. Some random data came for a particular duration and stopped.

    I am not able to understand the problem, please suggest something to resolve this .

    Thank you

  • Hi,

    In the device configuration IR is selected that's why the LED glow is not able observe over sensor.

    Please change the "0x105" register value as "008F" to select the Green LED.

    Your current configuration is 1000Hz sampling rate. Can you reduce sample rate and check whether you are able to get the data continuously.

    To set 50Hz sample rate use the below register values.

    000B 02B2 # 1MHz trim - trim your own clock
    000C 0012 # 32kHz trim - trim your own clock
    000D 4E20 # 50 Hz
    000F 0006 # enable 1MHz osc

    Regards,

    Optical Support Team.

  • Hi,

    I did make the above settings, but no luck Led's still not glowing.

    Below the Log when we enter to Go Mode :-

    <info> app: Transfer completed .
    <info> app: receive data 0
    <info> app: receive data 0
    <info> app: Transfer completed .
    <info> app: receive data 40
    <info> app: receive data DA
    <info> app: Transfer completed .
    <info> app: receive data 1
    <info> app: receive data 8
    <info> app: Transfer completed .
    <info> app: receive data 0
    <info> app: receive data 8F
    <info> app: Transfer completed .
    <info> app: receive data 0
    <info> app: receive data 0
    <info> app: Transfer completed .
    <info> app: receive data 0
    <info> app: receive data 0
    <info> app: Transfer completed .
    <info> app: receive data 0
    <info> app: receive data 4
    <info> app: Transfer completed .
    <info> app: receive data 0
    <info> app: receive data 0
    <info> app: Transfer completed .
    <info> app: receive data 0
    <info> app: receive data 0
    <info> app: Transfer completed .
    <info> app: receive data 40
    <info> app: receive data DA
    <info> app: Transfer completed .
    <info> app: receive data 1
    <info> app: receive data 1
    <info> app: Transfer completed .
    <info> app: receive data 0
    <info> app: receive data 0
    <info> app: Transfer completed .
    <info> app: receive data 0
    <info> app: receive data 0
    <info> app: Transfer completed .

    Please tell if i can use adi_adpdssm_setOperationMode for interfacing with nRF52840 MCU ?

     

  • Hi,

    We can use the "adi_adpdssm_setOperationMode " API for "nRF52840" MCU. The example code is developed on nRF52840 MCU using MbedOS.

    Is it possible for you to import example project on Online Mbed complier and run the example application as it is.

    Regards,

    Optical Support Team.

  • mBed OS support is not for nRF52840.

    We have not worked on mbed compiler, please suggest what might be the reason ?

    I can share you the Driver files and main.c for your reference. Please share you emial-id.

    Thank You

  • Hi,

    You can send the driver and main file to "satishkumar.kandasamy@analog.com".

    I will check and get back to you.

    Regards,

    Optical Support Team.

Reply Children
  • Hi satishkumar,

    I have shared you files on mail.

    Thankyou & regards

    Vinay

  • Hi satishkumar,

    I am getting some random data on terminal

    app : (tick, adpd_ch1);

    Please review the attached text file log of the data on the terminal.

    Thank YouData_pattern.txt

  • Hi Analog team,

    Please respond to my query

    Thank You

  • Hi Analog team,

    After putting finger onto the sensor i am getting below data :-

    <info> app: 2837,309919744

    <info> app: 2838,309919744

    <info> app: 2839,310312960

    <info> app: 2840,295305216

    <info> app: 2841,306446336

    <info> app: 2842,302383104

    <info> app: 2843,289800192

    <info> app: 2844,299368448

    <info> app: 2845,297795584

    <info> app: 2846,296419328

    <info> app: 2847,294912000

    <info> app: 2848,294846464

    <info> app: 2849,291438592

    <info> app: 2850,286982144

    <info> app: 2851,283574272

    <info> app: 2852,277413888

    <info> app: 2853,271515648

    <info> app: 2854,264372224

    <info> app: 2855,257818624

    <info> app: 2856,252379136

    <info> app: 2857,244908032

    <info> app: 2858,238354432

    <info> app: 2859,231931904

    <info> app: 2860,221577216

    <info> app: 2861,220659712

    <info> app: 2862,214564864

    <info> app: 2863,208994304

    <info> app: 2864,203816960

    <info> app: 2865,199032832

    <info> app: 2866,194707456

    <info> app: 2867,185532416

    <info> app: 2868,183894016

    <info> app: 2869,174784512

    <info> app: 2870,165150720

    <info> app: 2871,163315712

    <info> app: 2872,155779072

    <info> app: 2873,149749760

    <info> app: 2874,142802944

    <info> app: 2875,137035776

    <info> app: 2876,183894016

    <info> app: 2877,242417664

    <info> app: 2878,265551872

    <info> app: 2879,262733824

    <info> app: 2880,148111360

    <info> app: 2881,137756672

    Please review it and suggest whether i am getting correct data or what is expected data ?

    Thankyou & Regards

    Vinay