This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pwm library continuous change with softdevice not working

Hi Guys,

once again, I have strange behavior of my code.

In my code I try in loop after ble_event received change PWM from 0 to 255 for my motor device. In debug logs, I can see continuous change value with 100ms delay (I tried also 500ms), but instead of slowly speed-up I can not see any motor movement. Here comes weird things. Then I change value back from 255 -> 0 (on logs everything looks good) but motor start working at maximum. Based on observations, it seems, PWM react only on 1st change at the time because when I set only one value, it works like charm.

This is my setup:

  • nrf51822 rev. 3
  • Softdevice 8.0.0
  • SDK 9.0.0
  • pwm library (latest version), nrf_pwm_noglitch
  • PWM working in general

Do you have any idea what is going on, or how should fix this issue?

Parents Reply
  • actually, I tried app_pwm from SDK 9 and issue remains. In forum I find out, that pwm was not able apply changes, because I did it all in ble event handling which has higher priority. So current version I have (still not working like I want) is following:

    • based on ble event (after parsing) i set some parameters for pwm.
    • separate timer (initialized in main.c) check if this parameters was changed, and if yes, change pwm accordingly. Unfortunately with this approach I get ble disconnect event due general timeout. So far I don't found/implement any solution. Maybe scheduler will do the trick, but I have no experience with this stuff.
Children
No Data
Related