Skip to content
  1. Jun 13, 2017
    • JM's avatar
      stm32/stm32l4 PWM: While attempting to output a 70 MHz square wave from the... · 7903a8a4
      JM authored
      stm32/stm32l4 PWM: While attempting to output a 70 MHz square wave from the timer output of a STM32 clocked at 140 MHz (which works fine in baremetal C), I stumbled on what I believe to be an error in arch/arm/src/stm32/stm32_pwm.c.  Line 1304 we are told that
      
      reload = timclk / info->frequency;
      
      which I belive to be incorrect, it should be
      
      reload = timclk / info->frequency - 1;
      
      since starting to count from 0, if I want to output half of the TIM clock, I must count to 1 and not to 2.
      
      Surely enough, the original code did output 140/3=47 MHz, while this correction does allow the output up to 70 MHz.
      
      I am not sure this affects most users generating slow PWM (e.g. PX4) but for frequencies
      close to the PCLK, indeed the difference becomes significant.
      7903a8a4
  2. Jun 12, 2017
  3. Jun 11, 2017
  4. Jun 10, 2017
  5. Jun 09, 2017
  6. Jun 08, 2017