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.

TMS320F28388D: Peculiar execution issue

Part Number: TMS320F28388D

Hello Experts,

I have a peculiar issue.

I have two set of code snippet. One to read the Raw ADC data and other to convert the read adc count to calibrated valued based on the provided computation.

The issue I notice is, when I step in and execute the code, the I see the math for the calibration getting executed. however, when the same is run as standalone, the calibrated values are showing 0.

This issue is not consistent, It happens only in specific software, but there is no change in the code snipped, between the softwares.

Regards,

Mohan

  • Hi Mohan,

    How are you controlling when to read the ADC results?  Are you sure that in the stand-alone case the code has waited for the ADC results to be available first before proceeding to perform the calibration? 

    Does the code read the ADC results from the register once and only once each time a new result is available?  Does the code record what the input to the calibration snippet was?  

  • The ADC is ready every 50 microseconds, triggered via PWM.

    I see the ADC count is getting populated. However, the next line of code to compute the analog from the count is showing 0.

    The math code is using the ADC result variable, In some projects, it is working, in a few, I see it's not working.

    Not sure where to start debugging for this kind of issue.

  • Hi Mohan,

    I'd break it into two parts:  the calculation code and the input to the code.  For the calculation, focus on ensuring the results are correct given different inputs.  For the input to the code, ensure that the ADC result variable is populated at the right time and has correct / expected results.  

  • I found one reason. This is happening in core 2

    my intermediate value was zero, and I found the reason listed below

    if the structure has data, then copy the data from flash structure to ram structure

    Again copy the Ram structure to another local ram structure once in the main

    This second copy is not working in main when executed stand alone.

  • Hi Mohan,

    Again copy the Ram structure to another local ram structure once in the main

    How are you coping the data and what is source and destination address ? Also you mentioned earlier that issue is not consistent and kind of random? Is that sill the case or you have now a code which always fails?

    Regards,

    Vivek Singh

  • We have Parameter Data Item, saved in one of the sectors. From that sector, we copy it to RAM and then use it in the application.

    When I copy the data during runtime in a loop, the data is available.

    I will try to recreate a simple project to replicate the issue and get back to you.

  • Thanks Mohan. Will wait for sample project. If sample project has no dependency on external input, if'll be easy to run (if possible).

    Regards,

    Vivek Singh

  • Hi Vivek,

    I did a detailed analysis to see why this scenario is occurring and figured out there was a piece of code before the actual execution, which cleared the contents of the local copy.

    This is not an issue anymore

    Thank you for the support.