Skip to content

HydraFW PWM guide

Baldanos edited this page Sep 29, 2018 · 9 revisions

HydraFW PWM (Pulse Width Modulation)

Output type: 0 or 3.3volt

This guide is updated towards firmware release HydraFW v0.9 Beta

PWM configuration syntax description:

  • Usage: pwm <frequency (1Hz to 42MHz)> [duty-cycle (0 to 100%)] [exit]
  • PWM1 is mapped on PB11 pin

Syntax:

  • frequency PWM frequency integer value in Hz <value 1Hz to 42MHz> (support k, m suffix or no suffix)

    • Returns real frequency depending on Hardware (for frequency >10KHz error increase)
  • duty-cycle Duty Cycle in % <value 0 to 100>

    • Returns real duty-cycle depending on Hardware (for frequency >10KHz error increase)
  • exit Exit PWM mode (reinit PWM1 pin to safe mode/in)

PWM examples:

> pwm frequency 12 duty-cycle 33
PWM1 Frequency: 12, Duty Cycle: 33%(+/-1%)

> pwm duty-cycle 50
PWM1 Frequency: 12, Duty Cycle: 50%(+/-1%)

> pwm frequency 1234
PWM1 Frequency: 1234, Duty Cycle: 50%(+/-1%)

> pwm frequency 5432 duty-cycle 33
PWM1 Frequency: 5432, Duty Cycle: 33%(+/-1%)

> pwm frequency 10123 duty-cycle 33
PWM1 Frequency: 10124, Duty Cycle: 33%(+/-1%)

> pwm frequency 54321 duty-cycle 33
PWM1 Frequency: 54333, Duty Cycle: 34%(+/-1%)

> pwm frequency 1000123 duty-cycle 33
PWM1 Frequency: 1012048, Duty Cycle: 32%(+/-1%)

> pwm frequency 40000000 duty-cycle 33
PWM1 Frequency: 42000000, Duty Cycle: 0%(+/-1%)

> pwm duty-cycle 50
PWM1 Frequency: 42000000, Duty Cycle: 50%(+/-1%)

> pwm frequency 42000000 duty-cycle 75
PWM1 Frequency: 42000000, Duty Cycle: 50%(+/-1%)
Clone this wiki locally
You can’t perform that action at this time.