Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Compiler/OPT9221: Writing Common Offset Calibration parameters

$
0
0

Part Number:OPT9221

Tool/software: TI C/C++ Compiler

Hello, TI!

I performed common offset calibration in our-self board base on our demo-board OPT8221.\

I have got these parameters: phase_corr_1 = -118, phase_corr_2 = 820.

I have question:

Do I write rightly to register negative value by I2C inteface (code fragment is below):

    #define REG_5C 0x5C
    #define REG_58 0x58
    #define REG_READ 192
    #define REG_WRITE 193
 //// some code
  
    unsigned char pocket_send[8];
    unsigned char pocket_recv[6];
    unsigned int len, gotLength;

    pocket_send[0] = REG_5C;
    pocket_send[1] = REG_WRITE;
    pocket_send[2] = 8;
    pocket_send[3] = 0;
    pocket_send[4] = 0x37;
    pocket_send[5] = 0;
    pocket_send[6] = 0;
    pocket_send[7] = 0;
    
    short temp;
    //temp = (phase_corr0<<4)&0xFFF0;
    temp = (phase_corr0 * 16)&0xFFF0;
    memcpy((char*)pocket_send + 5, &temp, 2);

    sendto(server_sock_cmd, pocket_send, sizeof (pocket_send), 0, (struct sockaddr *)&tof_adr_command, sizeof (tof_adr_command));
    len = recvfrom(server_sock_cmd, pocket_recv, sizeof (pocket_recv), 0, (struct sockaddr *)&tof_adr_command, &gotLength);

    short temp_recv;
    memcpy(&temp_recv, (char*)pocket_recv + 3, 2);
    phase_corr0 = (temp_recv / 16);
    if(temp == temp_recv){

        printf("Common Offset Calibration: phase_corr0 = %hi was successfully written to register\n", phase_corr0);
    }

here, I get -118 (for phase_corr_1), but I am not sure that register makes right interpretation of negative values.

2. What is the principal difference between phase_corr_x and hdr_phase_corr_x values and where/when first or second are used?


Viewing all articles
Browse latest Browse all 262198

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>