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

nrf51422a led intensity control

I wonder if I can ask about the leds intensity control:

I need to control the led intensity without the PWM because I'm using the softdevice & PWM didn't work with it, I'm thinking of applying a waveform of zeros& ones to led & the resultant intensity depends on how much ones in the waveform I need another method as the previous one didn't work

Parents
  • Hi,

    have you tried PWM (app_pwm) from SDK? It's working fine with SoftDevice. Another thing that you could try is to use app_timer to create software-controlled low power, low frequency PWM. It's not precise because of other interrupts (mainly softdevice) but might be good enough for LED intensity changing. BTW you will find such module in upcoming SDK.

  • Hi, the goal of sdk drivers was to work with and without softdevice. app_pwm is using nrf_drv_timer and nrf_drv_ppi underneath which works the same with and without softdevice (ppi has less channels, you cannot use timer0 instance). To make app_pwm work with softdevice you need to use it with TIMER1 or TIMER2 instance. It is the second argument of APP_PWM_INSTANCE(name, num) macro. Timer instance must be enabled in nrf_drv_config.h before it can be used. If you check pwm example it is already using TIMER1 instance so if you merge this code with one of ble examples it should work.

Reply
  • Hi, the goal of sdk drivers was to work with and without softdevice. app_pwm is using nrf_drv_timer and nrf_drv_ppi underneath which works the same with and without softdevice (ppi has less channels, you cannot use timer0 instance). To make app_pwm work with softdevice you need to use it with TIMER1 or TIMER2 instance. It is the second argument of APP_PWM_INSTANCE(name, num) macro. Timer instance must be enabled in nrf_drv_config.h before it can be used. If you check pwm example it is already using TIMER1 instance so if you merge this code with one of ble examples it should work.

Children
No Data
Related