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.

How to caculate distance through opt9221 frame data?

Other Parts Discussed in Thread: OPT9221, OPT8241

Hi TI
   I had problems on caculate distance using opt9221 outputdata,we designed our board reference to TI CDK.Now I can get PHY_TEST data normally,then I closed PHY_TEST and get real data out,after I cacluate distance from frame data,the following picture shows distance info.It looks like wrong,what should I do?

My board configured as following:
   
1.Reset TFC OPT9221

2.Set DE register
   0x39,0x00000100
   0x3c,0x00005000
   0x3d,0x00000100
   0x3e,0x00000100
   0x3f,0x0000010b

3.Set DE register 0x31 = 0x00001803,enable MAC_TEST row ramp pattern.

4.Get one frame data and caculate distance,the following picture shows result.
 I use the following formulas to caculate distance of one pixel.
  Phase = ((DATA & 0x0fff0000) >> 16); //DATA is 4 byte(4byte mode default)
  R = C/(2*MOD_FREQ); //C is light speed, MOD_FREQ is modulation frequency,now is 48MHZ
  distance = phase * R/4096;


5.Disable MAC_TEST,get one frame data from opt9221,and caculate distance,the following shows result



But I find most of real phase data are near to zero or 4095,what's wrong?

BR

  • If your phase data are near 0 or 4095, then it looks like the pixels are saturated. Do you have illumination circuitry on the PCB and are your light sources modulating correctly? Are the illumination polarities correct for your design?

    Do you have a lens assembly or is the sensor exposed directly to light?

    What values do you get for the other data fields (amplitude/ambient/flags)?
  • Dear Anand

    Thanks for your reply.Now there is one laser led on my board, ILLUM_P is used for modulation ,the default modulation frequency is 48MHZ,I mesured the signal of ILLUM_P and LED cathode,the waves like follows:

    Now there is a black mount on  the opt8241 , but no lens yet.

    I  copyed the first 20 datas as followed

    amplitude:1    2    1    2    4095    4095    4095    4095    1    1    1    1    4095    4095    4095    4095    2    1    1    1

    Flag            :15    15    15    15    0    0    0    0    15    15    15    15    0    0    0    0    15    15    15    15

    ambient:     15    15    15    15    0    0    0    0    15    15    15    15    0    0    0    0    15    15    15   15

    By the way, The DE register 0x36, the SATURATION_THRESHOLD and AMPLITUDE_THRESHOLD is not set yet, exactly, I am not sure what value should be set in here.

    BR.

    Yan