Skip to main content
markl2
Associate
October 14, 2008
Question

adc sample trigger

  • October 14, 2008
  • 5 replies
  • 1262 views
Posted on October 14, 2008 at 05:15

adc sample trigger

    This topic has been closed for replies.

    5 replies

    janosch
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:47

    Hi Mark,

    I'm working on the same problem, and found out, that the best solution,

    would be to programm the regular ADC and the injected ADC to be triggered

    by a Timer. See Section 10.7 in the reference manual for this.

    Mostly you want to measure the current in the middle of the high and in

    the middle of the low phase of the PWM signal.

    My approch was to sync all timers and use TIM1 CC2 for regular channel

    trigger (middle of high phase) and TIM3 CC3 for injected trigger (middle

    of low phase).

    So much to the theory, as you can see in my thread, the triggering itself

    is not working. If you find a solution to this problem, I woulb be glad

    if you could report back here.

    Janosch

    markl2
    markl2Author
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 12:47

    Hi all,

    I am designing a buck converter using a STM30F103RBT6. I am trying to measure the mosfet current and I am wondering is possible to trigger adc to sample in the middle of a pwm pulse?

    mark

    lanchon
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:47

    > where can I find the code for the lib itself ?

    you have to talk to support and be prepared to accept a non-free license (and have patience).

    let me stress that I think that center-aligned pwm is a better solution.

    janosch
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:47

    > you don't use register shadowing for the injection

    > triggering so that you can change it mid period

    For me, this is (sadly) no option, as I use the shadow feature for

    changing my timer configuration atomar.

    > configure one timer for up/down counting with center-aligned pwm

    Nice idea

    > ST has ACIM and PMSM field-oriented motor control libs

    > that sample synched to PWM. maybe you should take a look there.

    I found the documentation of it, and it looks nice, but where

    can I find the code for the lib itself ?

    lanchon
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:47

    > My approch was to sync all timers and use TIM1 CC2 for regular channel

    trigger (middle of high phase) and TIM3 CC3 for injected trigger (middle

    of low phase).

    given the uncomfortable interface differences between regular and injected (dma vs register), maybe you could consider these options. first the ugly one:

    use a single timer. one channel does PWM. another channel triggers injected. you don't use register shadowing for the injection triggering so that you can change it mid period. on each ISR after injected conversion you configure the trigger value for the middle of the next half period. note that you get two ints per period.

    and the much nicer option:

    configure one timer for up/down counting with center-aligned pwm (optionally with double updates for twice the resolution). the two mid-half-period sample points now occur when the timebase is zero and maximum. so now maybe you can trigger the ADC directly from the timebase update events. (if not -I doubt it-, you could use two compare channels with constant values; you might need to synch a second timer.)

    > So much to the theory, as you can see in my thread, the triggering itself

    is not working.

    ST has ACIM and PMSM field-oriented motor control libs that sample synched to PWM. maybe you should take a look there.