paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [paparazzi/paparazzi] 83ddd8: [stm32] timer_get_freq


From: GitHub
Subject: [paparazzi-commits] [paparazzi/paparazzi] 83ddd8: [stm32] timer_get_frequency helper function
Date: Tue, 03 Jun 2014 13:15:18 -0700

  Branch: refs/heads/stm32_timer_get_frequency
  Home:   https://github.com/paparazzi/paparazzi
  Commit: 83ddd80b709c14ca2ac21e43e8f5be000f4a804a
      
https://github.com/paparazzi/paparazzi/commit/83ddd80b709c14ca2ac21e43e8f5be000f4a804a
  Author: Felix Ruess <address@hidden>
  Date:   2014-06-03 (Tue, 03 Jun 2014)

  Changed paths:
    M sw/airborne/arch/stm32/mcu_arch.c
    M sw/airborne/arch/stm32/mcu_arch.h
    M sw/airborne/arch/stm32/subsystems/actuators/actuators_shared_arch.c
    M sw/airborne/arch/stm32/subsystems/actuators/actuators_shared_arch.h
    M sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.c
    M sw/airborne/arch/stm32/subsystems/radio_control/spektrum_arch.c

  Log Message:
  -----------
  [stm32] timer_get_frequency helper function


  Commit: 58aa596ac975d78b329120f007d13a34b753adc4
      
https://github.com/paparazzi/paparazzi/commit/58aa596ac975d78b329120f007d13a34b753adc4
  Author: Felix Ruess <address@hidden>
  Date:   2014-06-03 (Tue, 03 Jun 2014)

  Changed paths:
    M conf/Makefile.chibios-libopencm3
    M sw/airborne/arch/stm32/mcu_periph/adc_arch.c

  Log Message:
  -----------
  [stm32] adc timer frequency

The ADC was running at different frequencies, depending on which timer was used
(e.g. TIM1 is on high speed APB2, TIM2 on low speed APB1).

And seems it was running a LOT slower on F4.
TRGO is used to trigger ADC conversion, which generated upon reaching period 
reload value.
That was 0xFFFF on F4 and 0xFF on F1.

So it seems that before this commit we had:

F1:
----
All timers normally all run with 72MHz as we have set it up...
* with prescaler of 8: we get 72MHz/9 = 8MHz timer freq
* with period of 0xFF: ADC conversions at 8MHz / 255 = ~31kHz

F4:
----
TIM1 is on ABP2 witch means twice as fast as e.g. TIM2 on APB1:
timers run at 2xAPB frew: on high speed bus 168MHZ and on low speed with 84MHz
* with prescaler of 0x53: 168MHz/84 = 2MHz timer freq for TIM1 (1MHz for TIM2)
* with period of 0xFFFF: 2MHZ / 0xFFFF = ~30Hz (15Hz for TIM2)

That is a difference of factor 1000 between F1 and F4!!

Now it will run at same freq regarless of wich TIM is used (and same on F1/F4):
default ADC update freq: ADC_TIMER_FREQUENCY / ADC_TIMER_PERIOD = 2MHz / 1000 = 
2kHz


  Commit: e3f4b9ada9b4152225df1868167f3780557b0723
      
https://github.com/paparazzi/paparazzi/commit/e3f4b9ada9b4152225df1868167f3780557b0723
  Author: Felix Ruess <address@hidden>
  Date:   2014-06-03 (Tue, 03 Jun 2014)

  Changed paths:
    M sw/airborne/arch/stm32/mcu_arch.c
    M sw/airborne/arch/stm32/mcu_arch.h
    M sw/airborne/arch/stm32/mcu_periph/adc_arch.c
    M sw/airborne/arch/stm32/subsystems/actuators/actuators_shared_arch.h

  Log Message:
  -----------
  [stm32] define TIM9 and TIM12


Compare: 
https://github.com/paparazzi/paparazzi/compare/3a21d6984e9e...e3f4b9ada9b4

reply via email to

[Prev in Thread] Current Thread [Next in Thread]