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.

TMS570LS3137: HalCoGen ADC settings

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

Tool/software:

Hello,

I am using the following settings in HalCoGen for the ADC2 of my TMS570LS3137 MCU:

(The event group and group 2 are not used).

My understanding is that after starting the continuous conversion on the ADC, the FIFO buffer will be filled after approx. 10ms (total conversion time ~1ms for 4 channels, so 10ms for 40 samples). But when I run adcGetData with a 10ms period, I rarely get 40 samples read out from the buffer.

Am I misunderstanding something here, or are there some additional delays I have not accounted for somewhere?

Thank you and regards,

Aaron

  • Hi Aaron,

    Am I misunderstanding something here, or are there some additional delays I have not accounted for somewhere?

    No, you are not misunderstanding.

    According to your settings for every ~1mS 4-ADC channels should be converted and in 10mS we should get 40 ADC samples.

    Is it possible to share your code, i want to see how you are creating 10mS timeout and how you are verifying it.

    --
    Thanks & regards,
    Jagadish.

  • Hi Aaron,

    I just want to mention one more thing:

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

    The tScan Total showed in the configuration window is only for single time conversion for all ADC the channels, but if you enable the continuous conversion then we should also be one more switching time between last channel to the first channel. 

    So according to your configuration, each switching will take 62.5ns (187.5 / 3), so the total conversion for to convert all channels in continuous mode will be 965.3875+62.5 = 965.4,

    But it is still less than the 1mS, so in 10ms time out we should get the 40samples theoretically. I never did this verification before in practical but i want to make sure that we are not doing any code errors, so to confirm this i am requesting you for your code. You can create a simplest project and can share to me through private chat window.

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    Thank you for your response and for confirming.

    I am using a proprietary RTOS (that I can't share) for the 10ms task scheduling and am quite confident that the timing is correct. Inside the task I simply run the following code:

    adcData_t conversionDataBufferAdc2[40] = {0};
    const uint32_t conversionDataCountAdc2 = adcGetData(adcREG2, adcGROUP1, conversionDataBufferAdc2);

    On inspection, the returned count of conversions does not match the expected 40, instead it is around 7 or 8 samples. I was wondering if it has something to do with the OVR_RAM_IGN bit which controls the overrun of the ADC FIFO buffers. I could not find any option to control this bit in the HalCoGen configuration.

    Do you have any other ideas what could be the mistake here?

    Thank you and regards,

    Aaron

  • Hi Aaron,

    I am using a proprietary RTOS (that I can't share) for the 10ms task scheduling and am quite confident that the timing is correct.

    Okay, no problem.

    Do you have any other ideas what could be the mistake here?

    First i would like to test this scenario on my board with bare metal code without RTOS and i want to see whether we can get 40 ADC samples or not. I will update this ASAP.

    --

    Thanks & regards,
    Jagadish.

  • Hi Aaron,

    How many words did you configure at below highlighted filed

    You should also configure minimum 40 here as well to get the 40 ADC conversions.

    Can you please check this and let me know?

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    Thank you for your update. I configured the BNDB length to 40, so I think this should be fine too.

    Regards,

    Aaron

  • Hi Aaron,

    I configured the BNDB length to 40, so I think this should be fine too.

    You mean the issue persists even after configuring BNDB length to 40?

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    Sorry, my message was not clear. I had the BNDB length configured correctly during the tests, so the issue indeed persists with the BNDB length set to 40.

    Regards,

    Aaron

  • Hi Aaron,

    I created one example project on my LS3137 board with RTI interrupt for 10ms and the remaining configuration similar to yours and i am able to get 40 ADC samples every time.

    Can you verify this code and HALCoGen settings with your code?

    Here is my complete project:

    ADC_10mS_40_Samples_Issue_LS3137.zip

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    Thank you for the sample project, which works indeed as expected.

    This led me to question the configuration of the RTOS used in my the project and found that the task timings were not correct... Fixed this and now I get the 40 samples in 10ms period.

    Thank you for your support and for helping me find this issue!
    Regards,

    Aaron