Skip to main content
Graduate
May 8, 2024
Solved

STMG431 RBT6 - ADC sync does not seem to work as per manual

  • May 8, 2024
  • 2 replies
  • 1507 views

Hi,

i am testing the ADC at the moment, and the values i get out of it look pretty good. Except, when using a squarewave.

See my video:

https://www.youtube.com/watch?v=TmKADM2yQvU 

The manual states for having the ADC run from AHB clock: "... has the advantage of bypassing the clock domain resynchronizations. This can be useful when the ADC is triggered by a timer and if the application requires that the ADC is precisely triggered without any uncertainty ...". But as can be seen, there is an issue, as the blue signal (which represents the bits of the adc - derived from tim2 pwm) does some "steps" over a period of about 1.3us. It does not so when inputting a triangular wave.

Anyone has experience here? Or any idea? I have already changed from checking the ADC measure from NOPs in a loop to PWM, to rule out any delays in code execution. But it still looks, like there is no precise triggering of the ADC.

I would expect the ADC value (blue pulse) to step up at one point.

Edit:

I made another screenshot, where it probably is easier to comprehend whats happening: Steep signals create artefacts in the measurement of unknown source.

    This topic has been closed for replies.
    Best answer by Tobe

    I found the cause:

    I had oversampling on. This, the fact, that the Rigol DG800 could not be used as one would need (could not sync anything with the backside plugs - and much more issues), and that the scope also has its capture and processing "rhythm", most likely caused the issue.

    2 replies

    TobeAuthorAnswer
    Graduate
    May 8, 2024

    I found the cause:

    I had oversampling on. This, the fact, that the Rigol DG800 could not be used as one would need (could not sync anything with the backside plugs - and much more issues), and that the scope also has its capture and processing "rhythm", most likely caused the issue.

    TobeAuthor
    Graduate
    May 8, 2024

    Now i have finished the research:

    - It works as in the manual stated.

    - The results could be quantified.

    AHB freq is 42.5MHz.

    The triangular wave is 25kHz with 1% sym.

     

    Blue trace is pwm from timer 2 at 170Mhz -> timer tics = adc bits