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
  • @Paweł Zadrożniak, Finally, I incorporate scheduler into my application. Unfortunately, problem with Disconnect after some period of time remains. Updated workflow is following:

    1. scheduler and my core functionality is initialized in main.
    2. When ble_event is received it's dispatched to my service.
    3. Service checks send message (few bytes) it is propagated to HW.
    4. When PWM function is required, I start timer 1 (timer was already initialized)
    5. When timer IRQ happened, it schedules setting PWM value.
    6. In while loop (main), scheduler is executed.

    In general program works, but when I set continuous changing PWM from duty cycle 0 to 255 with step 4, it takes about 20 iterations till BLE is disconnected. Do you have any idea how to solve this issue?

Children
No Data
Related