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.

TMS570LS1227: Clarification on MibADC Event Group sample cap discharge and conversion (acquisition) time relationship

Part Number: TMS570LS1227
Other Parts Discussed in Thread: HALCOGEN

Tool/software:

Dear all,

I am writing this post to kindly ask for insights on how to interpret collected results and identify any potential relationship, between the mibADC software-selectable Csamp discharge time and conversion time, and resulting group conversion time and group cycle time.

Input:

"Csamp discharge time" == td_discharge
"conversion time" == td_c_12b
"group conversion time" == td_total_group
"group cycle time" == t_group_cycle

tc_ADCLK = 0.1e-6; % in s, f_vclk = 80 MHz, PS = 7; f_adc = f_vclk / (PS+1) = 80 MHz / 8 = 10 MHz;

EV_ACQ = A; % in ADCLK cycles; defined by ADEVSAMP[11:0] register bits; TRM, SPNU515C, p 1007;
td_sh_group0 = tc_ADCLK * (EV_ACQ + 2); % in s; group 0 == event group; sh ==sample and hold; td ==  time delay;

td_c_12b  = td_sh_group0 + 12 * tc_ADCLK; % in s; Conversion with 12 bit precision;

EV_SAMP_DIS_CYC = B; % in ADCLK cycles; defined by ADEVSAMPDISEN [15:8] register bits; TRM SPNU515C, p 1039;
td_discharge = DISCTIME * tc_ADCLK; % in s

td_total_group = ( td_discharge + td_c_12b ) * 4 =C; In s; % 4 is the no of channels converted in this group; MibADC, ADC 2, grouped by software for sequential conversion sequences. The ADC2 event group is triggered by RTO compare 0 interrupts.
t_group_cycle = 34e-6; % In s, Event triggered ISR period.
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".
The 4 channels are the following: motor_current/CH10, motor_voltage/CH13,bus_current/CH14 and bus_voltage/CH15.

In the MCU environment electronics, Cext was not selected with the proper value as per SPNA118B (ADC Source Impedance for Hercules ARM Safety MCUs, referenced in SPNU515C) and at this stage can’t be modified.

The results overview synthesizes detailed findings, highlighting three subsets of ADC configurations that produce similar outcomes. These subsets are visually linked between the table and figures using a color-coded scheme. Orange signifies the worst fit and green the best fit. The best fit is linked to the expected results i.e., motor current and bus current should be very close to each other.

Question:
Could you please help me to get some insights on why configuration sets utilizing asymmetric discharge and conversion settings— see table e.g., green colour: 0e-6s discharge + 4.6e-6s conversion and 3.2e-6s discharge + 1.5e-6 conversion—yield similar conversion are show in the plots?
What is the expected relationship and/or design good practices for group time and group cycle?

Thanks in advance for your support.

Best regards,

Luis
  • Erratum:

    EV_SAMP_DIS_CYC = B
    wrong: td_discharge = DISCTIME * tc_ADCLK; % in s
    correct: td_discharge = EV_SAMP_DIS_CYC * tc_ADCLK; % in s

  • 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.

    (+) TMS570LS0714: ADC sampling time for one of the input signals - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

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