Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: minor cleanup

...

  • open <period> <duty> - opens the DN_PWM_DEV_ID device (PWM0,  LTC5800 pin 49) with an initial period and duty cycle in % of period. The period can be selected from one of the defined glitch-free periods (1-11) or specified directly in units of ns. See dn_pwm.h for the list of glitch-free periods. The device must be opened before enabling/disabling the PWM. 
  • enable - enables the PWM signal output on PWM0.
  • disable - disables the PWM signal output on PWM0
  • set - sets the current duty cycle in %. 
  • close - closes the pwm PWM device and disable output. The PWM must be closed before changing the period.

...

No Format
PWM app, ver 1.2.0.1
SmartMeshIP stack, ver 1.4.1.6

> open 5 50
Opening PWM with period=8888889 ns and duty cycle = 50% (4444444 ns) 

> >enableenable
Enabling PWM

> >setset 40
Setting duty cycle to 40% (3555555 ns)


> open 4 50
Opening PWM failed RC=-8

>disable> disable
Disabling PWM

> >closeclose
Closing PWM

Important points:

...

Note

While the period can be set to any value, there is an enumerated list of guaranteed glitch-free periods. When using other periods, enabling the pwm PWM may produce a single cycle of the pin being asserted for an arbitrary portion of the period. For this reason, it is recommended to use one of the periods defined in dnm_pwm.h.

...

  • Add a task to the sample that opens the PWM device following the example in the open handler.
  • In the task's while(1) loop, slowly ramps ramp the duty cycle up and down.  
  • Jumper PWM0 to DP3 and check if the blue INDICATOR_0 LED behaves as you'd expect it to.  

...