This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

A question about timer configuration

Hi all,
I am relatively new to the ARM family and I didn't find an answer in the documentation, unfortunately...
I am trying to change the interrupt rate of my STR7's timer 0. I have an 16[Mhz] external oscillator. Could you explain to me why the following setting generates an interrupt every 130[ms]?

// Initialize the Timer
TIM_Init (TIM0);
// Configure Timer 0 Prescaler
TIM_PrescalerConfig (TIM0,0x0F);
// Enable Timer 0 Overflow Interrupt
TIM_ITConfig(TIM0,TIM_TO_IT,ENABLE);

  • You haven't shown the bodies of any of those functions, nor even your definitions of TIM0, TIM_TO_IT, or ENABLE - so how can anyone possibly comment on this?!

  • Andy,
    Sorry for that...
    I am using the standard ST library, without any fishy modifications.

    #define ENABLE          1
    #define TIM0_BASE       (APB2_BASE + 0x9000)
    #define TIM0            ((TIM_TypeDef *)TIM0_BASE)
    
    and
    
    typedef volatile struct
    {
      vu16 ICAR;
      vu16 EMPTY1;
      vu16 ICBR;
      vu16 EMPTY2;
      vu16 OCAR;
      vu16 EMPTY3;
      vu16 OCBR;
      vu16 EMPTY4;
      vu16 CNTR;
      vu16 EMPTY5;
      vu16 CR1;
      vu16 EMPTY6;
      vu16 CR2;
      vu16 EMPTY7;
      vu16 SR;
    } TIM_TypeDef;
    

  • Very nice. You have now informed the list about:
    - the physical location of the timer in the address space of the processor.
    - a typedef that describes which registers that may be configured for the timer.

    You have not sent a single piece of information about what values the code actually writes to all these registers - hence, it is absolutely impossible to answer anything about your question.

  • What documentation did you check? Generic ARM documentation, or specific STR7 documentation? My guess is the former, since STR7 peripherals would not be documented there. The info you need to understand how to configure the STR7's peripherals is in the STR7 datasheet. Do you have it? Do you know where you can get it?

  • "I am using the standard ST library, without any fishy modifications."

    Does the Documentation for this library not tell you what you need to know?