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

More than 2 pwm channels per instance

Hi,

I am trying to fade out 5 LEDs over the course of 500ms simultaneously. I am using soft device s110 but am happy to pause everything for the half a second while the LEDs fade (ie make the pwm blocking).

Is this possible to do? Each of the LEDs is connected to a separate GPIO. If so, how?

Thanks,

Parents
  • Ok, if the softdevice is waiting for BLE commands, then your device is connected with another device, am I correct? When connected, empty payload packets are periodically sent to maintaining the connection. How often that is done depends on the connection interval you have chosen in your application.

    Anyway, generating a PWM for LED with timer interrupts could work despite softdevice activity, and most likely if you are using S110 8.0.0. It will surely work without softdevice activity.

    You could implement a PWM with two timers, one is periodic and always sets the pin signal high. The timer also starts a second one-shot timer that will set the pin signal low. For example, you could set the first timer to fire every 10ms. If you want a 50% pwm duty cycle, start the second timer immediately after you have put the pin signal to high, and set the second timer to 5ms.

Reply
  • Ok, if the softdevice is waiting for BLE commands, then your device is connected with another device, am I correct? When connected, empty payload packets are periodically sent to maintaining the connection. How often that is done depends on the connection interval you have chosen in your application.

    Anyway, generating a PWM for LED with timer interrupts could work despite softdevice activity, and most likely if you are using S110 8.0.0. It will surely work without softdevice activity.

    You could implement a PWM with two timers, one is periodic and always sets the pin signal high. The timer also starts a second one-shot timer that will set the pin signal low. For example, you could set the first timer to fire every 10ms. If you want a 50% pwm duty cycle, start the second timer immediately after you have put the pin signal to high, and set the second timer to 5ms.

Children
No Data
Related