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.

CCS/TMS320F28035: CCS Graph trace ADC on sine input

Part Number: TMS320F28035

Tool/software: Code Composer Studio

Hi all of you, this is Mike.

Here it is this graph, I have asked about how to fixed the problem of this distorsion. Some say about incresing the length of the buffer to match the frequency,but the signal, in my device, will have to support frequency changes. Just I want to know if it is possible to code some sort of trigger, like an oscope, because in the real time, my buffer counts this distorsion, and my measurement goes wrong.

Thanks for the support

Mike

  • Mike,

    As you imagine, the trigger for the data display is a breakpoint that can only be fully synchronous with the running software and not with the external signal. In this case, the graph may forcefully display some discontinuities given by how much of the ADC buffer is actually filled with data and how a sampling is triggered in HW.

    If you have your ADC running continuously, the discontinuity shown can be worked around by setting the breakpoint to update the view only when the buffer is full. This will force the display to show the entire 1000 sample buffer without discontinuities.

    Conversely, if the ADC is being halted at the end of "n" periods (which is dependent on frequency / sample rate), the discontinuity will always be shown, since the graph will be updated with the memory contents.

    Does that make sense or did I misunderstood your original question?

    Regards,
    Rafael
  • Rafael, Thanks for your answer. It makes a lot of sense to me

    Your coments in blue, my comments in green

    As you imagine, the trigger for the data display is a breakpoint that can only be fully synchronous with the running software and not with the external signal. In this case, the graph may forcefully display some discontinuities given by how much of the ADC buffer is actually filled with data and how a sampling is triggered in HW.

    I have triggered my ADC by making the counter equals to the period. ot the Time Base Period. So the Start of conversion is made by Software.Ok, thanks to your comment I understand it has to be fully synchronous  to firmware.

    If you have your ADC running continuously, the discontinuity shown can be worked around by setting the breakpoint to update the view only when the buffer is full. This will force the display to show the entire 1000 sample buffer without discontinuities. 

    Do I have to do this breakpoint also in my firmware, I mean, I want to read this 1000 samples, because I don't know much about the input signal ( the firmware is to a RMS voltemeter, so it has to achieve good rmeasurements doesn't matter the waveform). Or you were talking just to view  the samples in the graph.

    Conversely, if the ADC is being halted at the end of "n" periods (which is dependent on frequency / sample rate), the discontinuity will always be shown, since the graph will be updated with the memory contents. 

    I'm pretty sure the buffer is being graphed and this kind of distorsion affects the buffer  but also my measurement, Do you have some hint to fill the buffer properly?

     

    Thanks 

    Mike

  •  I was thinking to use the DAC function to see the waveform I'm getting. Here it is the signal again and the result of my variable name as RMS, it changes when this distortion occurs.

  • Anybody out there?
  • Mike,

    Mike_3007 said:

    If you have your ADC running continuously, the discontinuity shown can be worked around by setting the breakpoint to update the view only when the buffer is full. This will force the display to show the entire 1000 sample buffer without discontinuities. 

    Do I have to do this breakpoint also in my firmware, I mean, I want to read this 1000 samples, because I don't know much about the input signal ( the firmware is to a RMS voltemeter, so it has to achieve good rmeasurements doesn't matter the waveform). Or you were talking just to view  the samples in the graph.

    I was referring to just view the samples in the graph. The breakpoint will be responsible to "refresh" the contents of the graph with whatever the buffer contains. 

    Mike_3007 said:

    Conversely, if the ADC is being halted at the end of "n" periods (which is dependent on frequency / sample rate), the discontinuity will always be shown, since the graph will be updated with the memory contents. 

    I'm pretty sure the buffer is being graphed and this kind of distorsion affects the buffer  but also my measurement, Do you have some hint to fill the buffer properly?

    Mike_3007 said:

    I was thinking to use the DAC function to see the waveform I'm getting. Here it is the signal again and the result of my variable name as RMS, it changes when this distortion occurs.

    Your last reply indicates the glitch is happening in hardware (or at least influencing the ADC sample in some way). I don't necessarily see anything wrong with the way you are filling the buffer, since it seems to be faithfully representing the real world. 

    Well, one detail is if your calculating are taking too long to complete, then you would need to use a dual buffer approach - fill buffer A while performing calculations on buffer B. When the calculations are finished, start filling buffer B and use buffer A to perform the calculations.  

    If you want to quantitatively inspect the buffer, you can open a Memory Browser and inspect the troublesome range of samples (samples 730~750 in your first graph, for example) - perhaps you can get a correlation between the glitch and another activity in your system (a I2C/UART/SPI serial communications or part of your circuit being switched, for example). However, the graph itself may not be as helpful unless it is triggered by an external event that is synchronized with the activity of the suspicious part of your circuit.  

    I can't think of any additional details that may be influencing this scenario, but I will report back if I find anything else that may be relevant. 

    Hope this helps,

    Rafael

  • Rafael 

    Just commenting your last comment.

    This is the signal of the input, this signal goes directly to the ADC. I have removed the Direct Component on the scope just to see the measurements. 

    As you see, there is no glitch, maybe some noise, but no glitches at all. The hardware before this signal is just opamps, I have sampled other kind of waveforms with different sources and always I see some glitches in the graph, I have reviewed the memory browser as you said, I saw there were some that just stay like if the buffer where stopped to fill it, So, it takes me to think it's the way I'm reading. Just there other interruption in my firmware, that interrupt measures the frequency, I disable it but the problem is present

  • Is there anybody there?
  • Hi,

    Please apologize for the delay; I thought your before-the-last reply was simply a statement of the current scenario and not a request for further help.

    Your last waveform and your observations in the Memory browser seem to corroborate the thesis that the acquisition is not happening smoothly. However, I am not the most knowledgeable person on the F28035 ADC, therefore I suggest you to check with the experts in the C2000 forum and see if you can track down any possible misconfigurations or missing interrupts/events that are causing this random acquisition noise.

    Best regards,
    Rafael
  • Thanks desouza

    To this time I have not resolved the issue, because I have done other chores, the next week I will be doing some test. Or, Can you explain me how you would do an array capture? I mean, watching in the graph doesn't matter too much but just knowing the adc buffer is ok. So I think if you can explain, brief words how to do it in other way.

    Best Regards

    Mike
  • (sorry for the delay; I was out last week in vacation)

    Mike,

    >>Can you explain me how you would do an array capture?

    Since your first screenshot shows an array with 1000 samples that are being displayed via the graph view, I am not entirely sure what you mean by your question, as it seems that you are already doing the array capture.

    In any case, one of the most useful references (to me) for an ADC data capture example is Lab 6 of the multi-day workshop hosted at:
    processors.wiki.ti.com/.../C2000_Archived_Workshops

    Hope this helps,
    Rafael

  • Hi Desouza

    My question was about to other way to initializing the adc settings or the adc interupts, I think I'm doing something wrong because the signal glitch

    Thanks Desouza 

  • Hi Desouza I already get it

    That happens because I have to write a digital trigger algorithm, that is why when I change the frequency of the signal in the graph it moves. And also it moves in the registers, becuase it needs a trigger.
  • If you have your ADC running continuously, the discontinuity shown can be worked around by setting the breakpoint to update the view only when the buffer is full. This will force the display to show the entire 1000 sample buffer without discontinuities.
  • Your last reply indicates the glitch is happening in hardware (or at least influencing the ADC sample in some way). I don't necessarily see anything wrong with the way you are filling the buffer, since it seems to be faithfully representing the real world.
  • It is not happening in hardware, We already checked that, also the adc buffer is right, just it needs to be stable to do all the math in real time, or at least a brief moment after the capture was done
  • If you have your ADC running continuously, the discontinuity shown can be worked around by setting the breakpoint to update the view only when the buffer is full. This will force the display to show the entire 1000 sample buffer without discontinuities.

    We talked about that, but then , after halting the program I have to re-set all the math to next 1000 samples and it wastes a lot of time halting, resetting and that, I need to update my measurement fast. That is why I didnot use that

     

  • Hello Mike,
    looks to me that the disturbed wave consists of 10-15 more samples than an average for four waves on the left when counting from bottom to bottom. I do not know your application, however could it be a sine wave generation distortion?
  • Tomasz

    This is the same firmware but with a breakpoint after filling all the elements in the ADC_Buffer. Whenever refresh the data it seems the sine is moving What do you think ? 

    This one is the first breakpoint

    This one is after the refresh 

    and so on...

    Mike 

  • Must be a bug!
  • It can be... 

    I'll be working on it 

    Mike

  • mazenn adam said:
    If you have your ADC running continuously, the discontinuity shown can be worked around by setting the breakpoint to update the view only when the buffer is full. This will force the display to show the entire 1000 sample buffer without discontinuities.  8 Ball Pool Google Hangouts Omegle

    This will force the display to show the entire 1000 sample buffer without discontinuities.

  • I did an interruption with the CPU TIMER, I doesn't fix the problem, but makes my measurements more stable, that missing parts or the signal are happening for two thing

    The rate of change of the signal because the CCS is not able to change as fast as the signal. And the adc interrupts, breaking what Nyquis said

    Thank you all ...
  • Nyquist does not lies.
    Glad you did.