[riot-notifications] [RIOT-OS/RIOT] cpu/esp8266: fix of set func in periph/pwm (#10982)

Gunar Schorcht notifications at github.com
Sun Feb 10 16:22:45 CET 2019


### Contribution description

In the `pwm_set` function, the switch-on and switch-off times for PWM channels were only determined for the following phase, but not for the current phase. This could result in a missing duty cycle when calling the function `pwm_set` if the switch-on time of the current phase was not yet reached or to an extended duty cycle if the switch-off time of the current phase had not yet been reached.

### Testing procedure

Use `test/periph_pwm` with following changes in `main.c`:

```diff
-#define OSC_STEP        (10)
+#define OSC_STEP        (1)
-#define OSC_STEPS       (1000U)
+#define OSC_STEPS       (100U)
```
Flash the application with and without the changes in this PR to compare the results.
```
make BOARD=esp8266-esp-12x -C tests/periph_pwm flash test
```
Execute the `osci` command. Without the changes of this PR, you should be able to observe one extended duty cycle every 9th cycles. That is, `pwm_set` function is executed in 10th cycle and does not switch off the output port.

![snapshot_2019-02-10_16-04-39](https://user-images.githubusercontent.com/31932013/52535522-cc042200-2d4f-11e9-93eb-9b63e7fa2b17.png)

With changes of this PR, the output port should be switched on and off also in 10th cycle.
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/10982

-- Commit Summary --

  * cpu/esp8266: fix of set func in periph/pwm

-- File Changes --

    M cpu/esp8266/periph/pwm.c (18)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/10982.patch
https://github.com/RIOT-OS/RIOT/pull/10982.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10982
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190210/690c161d/attachment.html>


More information about the notifications mailing list