Calibration parameters - no effect on measured voltages

Applications, development tools, FPGA, C, WEB
Post Reply
schaeds
Posts: 10
Joined: Thu Mar 03, 2016 10:22 am

Calibration parameters - no effect on measured voltages

Post by schaeds » Fri Jun 24, 2016 10:00 am

Hi

I performed the calibration of the fast analog inputs according the wiki manual
http://wiki.redpitaya.com/index.php?tit ... alibration

Unfortunately, the adjustment of the offset input parameters have no effect on my measured voltages.. I tested the measurement with following code - but independently of the set parameters, I am getting the same measurement values:

Code: Select all

int main(int argc, char **argv){

        /* Print error, if rp_Init() function failed */
        if(rp_Init() != RP_OK){
                fprintf(stderr, "Rp api init failed!\n");
        }

        uint32_t buff_size = 16384;
        float *buffV = (float *)malloc(buff_size * sizeof(float));
        int16_t *buffRaw = (int16_t *)malloc(buff_size * sizeof(int16_t));

        rp_AcqReset();
        rp_AcqSetDecimation(RP_DEC_8);
        rp_AcqSetTriggerLevel(0.1); //Trig level is set in Volts while in SCPI 
        rp_AcqSetTriggerDelay(0);

        rp_AcqStart();

        /* After acquisition is started some time delay is needed in order to acquire fresh samples in to buffer*/
        /* Here we have used time delay of one second but you can calculate exact value taking in to account buffer*/
        /*length and smaling rate*/

        sleep(1);
        rp_AcqSetGain (RP_CH_1, RP_HIGH);
        rp_AcqSetGain (RP_CH_2, RP_HIGH);

        rp_AcqSetTriggerSrc(RP_TRIG_SRC_NOW);
        rp_acq_trig_state_t state = RP_TRIG_STATE_TRIGGERED;

        while(1){
                rp_AcqGetTriggerState(&state);
                if(state == RP_TRIG_STATE_TRIGGERED){
                sleep(1);
                break;
                }
        }

        rp_AcqGetOldestDataV(RP_CH_2, &buff_size, buffV);
        rp_AcqGetOldestDataRaw(RP_CH_2, &buff_size, buffRaw);


        int i;
        for(i = 0; i < 50; i++){
                printf("%i  %f\n", buffRaw[i], buffV[i]);
        }
        /* Releasing resources */
        free(buffRaw);
        free(buffV);
        rp_Release();

        return 0;
}
The calibration parameters itself are stored correctly.. I can read them with calib -r -v

Code: Select all

redpitaya> calib -r -v
FE_CH1_FS_G_HI = 42949672
FE_CH2_FS_G_HI = 42949672
FE_CH1_FS_G_LO = 858993459
FE_CH2_FS_G_LO = 858993459
FE_CH1_DC_offs = 91
FE_CH2_DC_offs = 90
BE_CH1_FS = 42949672
BE_CH2_FS = 42949672
BE_CH1_DC_offs = 0
BE_CH2_DC_offs = 0
Thanks for your help and kind regards
Stefan

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: Calibration parameters - no effect on measured voltages

Post by Nils Roos » Sun Jun 26, 2016 3:15 pm

Hi Stefan,

it seems the calib utility is not in line with the latest changes to the calibration storage of the RP api. Apparently, the api introduced a separat offset setting for HV input configuration, which is stored together with a magic number after the "old" calibration settings.

Now, if your RP has a valid magic stored and you use the RP_HIGH gain setting, the api will use the HV offset calibration value, but the calib utility can only display and change the LV offset calibration.

For a solution, you could either modify the calib utility (see here on how the api interprets the new settings) or delete your user calibration to get rid of the magic number and HV calibration setting (eg. write zeroes to the first 64 bytes of the eeprom).

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 100 guests