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

STM32F103VET6 TIM simulation problem

I am starting to develop on STM32F10x. I attempted to use TIM1 to measure PWM input using the following code(copied from a book--prescaler and auto-reload changed to match the signal source):

    /* ... configure PA8 as floating input ... */
    TIM1->CR1   = 0x00000000; //default
    TIM1->CCER  = 0x00000000; //default
    TIM1->PSC   = 0x00000003; //set max prescaler
    TIM1->ARR   = 0x00000009; //set max reload count
    TIM1->CCMR1 = 0x00000001; //Input IC1 mapped to TI1
    TIM1->CCER |= 0x00000000; //IC1 triggers on rising edge
    TIM1->CCMR1|= 0x00000200; //Input IC2 mapped to TI1
    TIM1->CCER |= 0x00000020; //IC2 triggers on falling edge
    TIM1->SMCR  = 0x00000054; //Select TI1FP1 as input,rising edge trigger
    TIM1->CCER |= 0x00000011; //enable capture channels
    TIM1->CR1   = 0x00000001; //enable the timer
    while(1);

After burning and connecting PA8 to the signal source, CCR1 and CCR2 correctly showed the period and duty cycle of the input signal.

I then launched the simulator and ran the same code(both by manually switching the timer pins and setting off a debug function). This time, CCR1 still correctly showed the period, but CCR2 never gets updated.

Since the same code works perfectly on the real chip, I think the STM32F10x simulator is to blame for. Any ideas?

Parents
  • While I can certainly appreciate the complexities in programming the unique simulator profiles, this was used as a selling feature and somewhat unique to Keil's tools.

    It seems they are focusing their efforts somewhere other than making tools allow for complete device simulation or properly compile valid code. Yes, real compiler bugs that have been verified by technical support.

    From one of our call tickets:


    "Chances are, we have not fully implementd the feature you want, in the simulator. Sometime ago, our developers decided to abandon the simulator, and concentrate on providing on-chip debugging tools. This was right about the time we devloped support for the first STM32 devices. Therefore, we simulate some of the STM32 features, and not others.

    Unfortunately, we will most likely never add simulation for the missing features"

    Chad

Reply
  • While I can certainly appreciate the complexities in programming the unique simulator profiles, this was used as a selling feature and somewhat unique to Keil's tools.

    It seems they are focusing their efforts somewhere other than making tools allow for complete device simulation or properly compile valid code. Yes, real compiler bugs that have been verified by technical support.

    From one of our call tickets:


    "Chances are, we have not fully implementd the feature you want, in the simulator. Sometime ago, our developers decided to abandon the simulator, and concentrate on providing on-chip debugging tools. This was right about the time we devloped support for the first STM32 devices. Therefore, we simulate some of the STM32 features, and not others.

    Unfortunately, we will most likely never add simulation for the missing features"

    Chad

Children
No data