STM32F2xx ctl tick time

Comments

4 comments

  • Avatar
    Michael Johnson

    I don't follow your code (I guess it hasn't seen a compiler).

    The CTL timer interrupt fires every 10ms and the counter is incremented by 10. So it's a ms counter that is increment every 10 ms.

    0
    Comment actions Permalink
  • Avatar
    Gordon Scott

    Hi Michael,

    It's a cut-down from the whole code showing just the essential bits.

    It would not compile without the omitted stuff.

    The call to the ctl wait was cut and pasted from STM32F1xx code. Your answer suggets either things have changed, or in my earlier code I'd done something, about which obviously I've forgotten, to shorten it to 1ms.

    Is there a means to get my ticker task running at 1ms increments instead of 10ms incremenms?

    Thanks.

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    You'll need to modify the ctl_start_timer function it's in the project - right click on the stm32_ctl.c file and select import to take a project local copy.

    Regards

    Michael

    0
    Comment actions Permalink
  • Avatar
    Gordon Scott

    Thanks Michael, that's done it.

    For the record, if anyone else looks for the answer, this was the change I made:

    void ctl_start_timer(CTL_ISR_FN_t timerFn)
    {    
      userTimerISR = timerFn;  
      SysTick->CTRL = SysTick_CTRL_TICKINT_Msk | SysTick_CTRL_ENABLE_Msk;
      // We want 1ms ticks, not 10ms.        ** GLS **
      //SysTick->LOAD = (SystemCoreClock/8/100)-1; // interrupt every 10 ms
      SysTick->LOAD = (SystemCoreClock/8/1000)-1; // interrupt every 1 ms
    #ifdef CTL_TASKING
      // So we don't need to increment by tens    ** GLS **
      // ctl_time_increment = 10; // so increment the counter by 10 to get the ms counter
      ctl_time_increment = 1;    // I think this is actually redundant.    ** GLS **
    #endif
     .....

    0
    Comment actions Permalink

Please sign in to leave a comment.