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

realtime interrupt with 50us processing possible with s110?

I have a situation where I need a software PWM for several channels, which are multiplexed via a shift register.

The output loop needs to run at several kHz for this to work, but the processing only takes about 50us, which at about 8kHz puts it at a little below 50% processor use.

Can the softdevice be interrupted in this manner without breaking it, if I switch interrupt priorities? If I don't have the timer at highest priority, the softdevice interrupts for sometimes several ms, which means I lose at least 10s of cycles in the PWM, which is quite undesirable for the application.

Parents
  • Hi

    Have you considered to use the PWM library instead which enables 4xPWM on multiple pins simultaneously without using the CPU. When using the PWM library, you only need the CPU to change the frequency or duty cycle of the PWM.

    For the second revision nRF51 hardware the CPU is blocked by the S110 BLE softdevice with 1ms-6ms, so the application can not use the CPU for 1ms-6ms for any interrupt processing. For the third revision hardware, the softdevice blocks the CPU for maximum 250us.

    The softdevice will always have higher priority than the application, in order for not to break the BLE protocol.

  • The PWM lib is impractical for the application, as it happens that I need to multiplex the output signals, else I could do it easily via the TIMER peripherals directly, and wouldnt need software PWM. The CPU need in my case is ca. 50us per 125us (8kHz).

    I find it unfortunate that the softdevice cant be preempted for small time periods like these. On a relatively high powered LED setup, for example, missing several ms in PWM can cause noticable flicker, when the pulse edge is affected.

Reply
  • The PWM lib is impractical for the application, as it happens that I need to multiplex the output signals, else I could do it easily via the TIMER peripherals directly, and wouldnt need software PWM. The CPU need in my case is ca. 50us per 125us (8kHz).

    I find it unfortunate that the softdevice cant be preempted for small time periods like these. On a relatively high powered LED setup, for example, missing several ms in PWM can cause noticable flicker, when the pulse edge is affected.

Children
No Data
Related