Skip to main content
mehmet.karakaya
Associate III
November 7, 2010
Question

how to configure EXTI ?

  • November 7, 2010
  • 4 replies
  • 669 views
Posted on November 07, 2010 at 01:26

how to configure EXTI ?

    This topic has been closed for replies.

    4 replies

    mehmet.karakaya
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 14:14

    thank you I enabled AFIO clock and it worked

    in order not to open a new topic I have another question here

    I want a timer to tick between 1 Hz  and 10 KHz

    is there an example for this ? ( how to calculate prescaler and reload register for this job ? )

    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:14

    You must enable the AFIO clock, and the GPIOC clock.

    The EXTI registers are within the AFIO unit, chances are you haven't enabled it.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:14

    With SYSTICK. provided your main clock is within range.

    SysTick_Config(SystemCoreClock / 10); // 10 Hz

    SysTick_Config(SystemCoreClock / 10000); 10 KHz

      // TIM4CLK = 36 MHz

      x = 100; y = 36; // Clock at 1 MHz (36 MHz/36), 100 ticks, 10 KHz

    or

      x = 1000; y = 36000; // Clock at 1 KHz (36 MHz/36000), 1000 ticks, 1 Hz

      RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);

      /* Time base configuration */

      TIM_TimeBaseStructure.TIM_Period = (x - 1); // 1-65536

      TIM_TimeBaseStructure.TIM_Prescaler = (y - 1); // 1-65536

      TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; // 1,2 or 4 for tDTS

      TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;

      TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure);

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:14

    in order not to open a new topic I have another question here

     

     

    I want a timer to tick between 1 Hz  and 10 KHz

     

    is there an example for this ? ( how to calculate prescaler and reload register for this job ? )

     

    I think I've posted examples before.

    The basic formula, f = CLK / (p * q), where Prescaler = (p - 1), Period = (q - 1), and where q = less than 65536

    I'll post some other examples in a bit.
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..