Other Parts Discussed in Thread: HALCOGEN
Tool/software:
Dear all,


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.
Tool/software:
Dear all,
Hi Luis,
My apologies for the delayed response, i was stuck with other issues.
I have some questions about your table:
How you got these readings? Are you doing any practical testing's or are they just theoretical values?
And also, i am suggesting you refer below thread, here i gave detailed procedure on how exactly the total conversion should be calculated.
--
Thanks & regards,
Jagadish.
Hi Jagadish,
Thanks for your response.
>> How you got these readings? Are you doing any practical testing's or are they just theoretical values?
Practical testing.
I got the results using the procedure described is this thread post, here below for easy access:
"In the ISR, the ADC converted values in output code range 0..4095 are collected (pushed to a buffer) and in a separate thread of control then converted to engineering values and packed in messages that are then transmitted, unpacked and ultimately plotted in time series including current vs time for two sensors "motor" and "bus"."
>> And also, i am suggesting you refer below thread, here i gave detailed procedure on how exactly the total conversion should be calculated.
I did the mapping between the total conversion calculations in the mentioned procedure (also using our HALCoGen project) and the calculation I present in this thread ( based in SPNA118B). The following comments can be obtained from the mapping:
- I didn't know about tScan value, therefore I neglected systematically tScan = 62.5e-9s that yields 3*tScan fro the total conversion time of the 4 channels
- "Discharge time" in the table equals tDischarge in the procedure—both results applicable to a single channel
- "Sampling time + conversion" in the table equals tSample+tConversion in the procedure—both results applicable to a single channel; I used tConversion (12 bit) = 12 * cycleTime and HALCoGen calculations use tConversion (12 bit) = (12 + 1) * cycleTime; cycleTime equals tc_ADCLK in this thread.
- "Group time" in the table equals total conversion time in the procedure; I used the following calculation rearranged to use the terms in the procedure:
- totalTime = channels * (tExtended + tConversion) + (channels - 1) * tScan with: channels=4, tExtended = tSample+tDischarge and tScan=0s
In conclusion: If my understanding and calculations are correct, except for the systematic errors caused by the addition tScan=0 and multiplication by 13, the used calculation is correct w.r.t the procedure. The systematic error amounts to 4*cycleTime + 3*tScan = 4*100e-9 + 3*62.5e-9 = 587.5e-9s
Hi Luis,
Practical testing.
Is it possible to setup one live debugging session from your end.
I want to see the procedure that you are following to find out these results. If i have any other doubts in the procedure, then i can ask you and get clarify there itself.
--
Thanks & regards,
Jagadish.
Hi Jagadish,
Thanks for your response.
I am not sure if I am able to setup a live debugging session. Could you please clarify what it is?
Thanks!
Best regards,
Luis
I am not sure if I am able to setup a live debugging session. Could you please clarify what it is?
Is it possible to share your screen in call and explain me the how you are calculating these readings?
Hi Jagadish,
Yes it is. I am in time zone UTC+1. Please let me know what you need to setup the call.
Anyway, before the call, I would like to present the code use to generate the calculations presented in my previous post, using the information provided in HALCoGen and your explanation.
I am sharing below the script+functions I use to calculate the information provided in the table (and described in my previous post).
Please let me know if it explains the calculations you are looking for.
% Script
% Constants
cycleTime = 100e-9; % In s; ADC cycle time from HALCoGen proj.; f_vclk = 80 MHz, PS = 7; f_adc = f_vclk / (PS+1) = 80 MHz / 8 = 10 MHz => 100e-9
resolution = 12; % In bits; ADC data resolution
channels = 4; % In channels; Number of ADC channels to be converted
tScan = 62.5e-9; % In s; From HALCoGen proj.
groupCycleTime = 34e-6; % ISR period; within the ISR handler the ADC group converted output codes and collected and pushed to buffer
% Input values (just an example)
EV_SAMP_DIS_CYC = 1; % Csamp discharge time, in ADC cycles
EV_ACQ = 34; % Sample window, in ADC cycles
tSample = f_calc_adcChSampleTime(cycleTime,EV_ACQ); % In s
tConversion = f_calc_adcChConversionTime(cycleTime,resolution); % In s
tDischarge = f_calc_adcChnCsampDischargeTime(cycleTime,EV_SAMP_DIS_CYC); % In s
tExtended = tDischarge + tSample; % In s
tTotal = f_calc_adcConversionTotalTime(tExtended,tConversion,tScan,channels); % In s
% Functions
function conversionTime = f_calc_adcChConversionTime(cycleTime, resolution)
conversionTime = (resolution + 1) * cycleTime; % "+1" is from HALCoGen project calculation
end
function sampleTime = f_calc_adcChSampleTime(cycleTime,EV_ACQ)
% ADEVSAMP register field EV_ACQ in ADC clck cycles; TRM SPNU515C, p1007
sampleTime = cycleTime * (EV_ACQ + 2);
end
function dischargeTime = f_calc_adcChnCsampDischargeTime(cycleTime, EV_SAMP_DIS_CYC )
% ADEVSAMPDISEN register field EV_SAMP_DIS_CYC in ADC clck cycles; TRM SPNU515C, p1039
dischargeTime = EV_SAMP_DIS_CYC * cycleTime;
end
function totalTime = f_calc_adcConversionTotalTime(tExtended,tConversion,tScan,channels)
totalTime = channels * (tExtended + tConversion) + (channels - 1) * tScan;
end