Calibration with API

Placement, modules, components and accessories; the ones that exist and the the nice-to-be's
Post Reply
msalz
Posts: 11
Joined: Fri Jul 14, 2017 11:51 pm

Calibration with API

Post by msalz » Wed Feb 06, 2019 12:37 pm

Dear Red-Pitaya community,

we use several Red-Pitayas in industrial applications and would like to use the calibration function of the website directly via the API in C/C++. The following functions are provided by the API for this purpose:

rp_calib_params_t rp_GetCalibrationSettings ();
int rp_CalibrateFrontEndOffset (rp_channel_t channel, rp_pinState_t gain, rp_calib_params_t * out_params);
int rp_CalibrateFrontEndScaleLV (rp_channel_t channel, float referential_voltage, rp_calib_params_t * out_params);
int rp_CalibrateFrontEndScaleHV (rp_channel_t channel, float referential_voltage, rp_calib_params_t * out_params);
int rp_CalibrateBackEndOffset (rp_channel_t channel);
int rp_CalibrateBackEndScale (rp_channel_t channel);
int rp_CalibrateBackEnd (rp_channel_t channel, rp_calib_params_t * out_params);
int rp_CalibrationReset ();
int rp_CalibrationSetCachedParams ();
int rp_CalibrationWriteParams (rp_calib_params_t calib_params);

Please refer:
https://github.com/RedPitaya/RedPitaya/ ... itaya/rp.h

Now we want to implement the exact process of calibration through the API calls. Here is a part of our software:

Low voltage channel 1 & 2:
rp_CalibrateFrontEndOffset (RP_CH_1, RP_LOW, NULL); //shortcut IN1
rp_CalibrateFrontEndOffset (RP_CH_2, RP_LOW, NULL); //shortcut IN2
rp_CalibrateFrontEndScaleLV (RP_CH_1, 0.9, NULL);
rp_CalibrateFrontEndScaleLV (RP_CH_2, 0.9, NULL);

High voltage channel 1 & 2:
rp_CalibrateFrontEndOffset (RP_CH_1, RP_HIGH, NULL); //shortcut IN1
rp_CalibrateFrontEndOffset (RP_CH_2, RP_HIGH, NULL); //shortcut IN2
rp_CalibrateFrontEndScaleHV (RP_CH_1, 19, NULL);
rp_CalibrateFrontEndScaleHV (RP_CH_2, 19, NULL);

Low voltage gen1 -> chan1; gen2 -> chan2 (loop)
rp_CalibrateBackEndOffset (RP_CH_1);
rp_CalibrateBackEndOffset (RP_CH_2);
rp_CalibrateBackEndScale (RP_CH_1);
rp_CalibrateBackEndScale (RP_CH_2);

These functions are called in C in the order listed. Then the software is stopped and switched to the Red-Pitaya website. In the oscilloscope app, a signal is read to check the settings. Here's the problem - the calibration was unsuccessful. The detected signals are shifted. If the calibration function of the web page is used, this problem does not occur.

In my opinion, the following function calls are not required for calibration:

rp_calib_params_t rp_GetCalibrationSettings - Read values ​​from EEPROM
rp_CalibrationWriteParams - Write values ​​to EEPROM
rp_CalibrationReset - Writes default values ​​to EEPROM
rp_CalibrateBackEnd - What is the difference to rp_CalibrateBackEndOffset?

rp_CalibrationReset - Not required for my application
rp_CalibrationSetCachedParams - Not required for my application
rp_CalibrationWriteParams - Not required for my application

My questions:
Is the order of function calls correct?
Are the passed parameters correct?
Is a function call possibly missing?

As far as I understand the API, after each CalibrateFront or CalibrateBackEnd function the parameters are written to the EEPROM. (Depending on the specific function). Possibly. are these settings not saved?

In the above code, I think NULL can be specified as a parameter. In this case, the new settings are written directly into the EEPROM (see API functions)
https://github.com/RedPitaya/RedPitaya/ ... rc/calib.c

Thank you very much
Martin

msalz
Posts: 11
Joined: Fri Jul 14, 2017 11:51 pm

Re: Calibration with API

Post by msalz » Thu Feb 07, 2019 10:58 am

I can now adjust the calibration via the API in C/C++. (Comparable to the web interface).
However, the values in the EEPROM are not written immediately. Only after the C application has been restarted.

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 26 guests