nRF54L15 Timer based PWM duty cycles incorrect without RTT (NCS v2.9.1)

Hi,

I'm using the nRF54L15 DK (non-secure, NCS v2.9.1) to generate a 100 kHz PWM on a GPIO with TIMER00 (128 MHz, 1280 ticks, 2.5%–20% duty, 32–256 ticks). GPIOTE, DPPI, and PPIB drive the PWM, avoiding the PWM driver.

Setup:

  • Software: NCS v2.9.1, Zephyr RTOS, VS Code with nRF Connect, west 1.2.0
  • Hardware: nRF54L15 DK, chip build code unknown (standard DK)
  • Platform: Windows 11, 64-bit
  • Config: CONFIG_NRFX_TIMER00=y, CONFIG_NRFX_GPIOTE20=y, CONFIG_NRFX_DPPI20=y, CONFIG_NRFX_PPIB20=y, CONFIG_PWM=n
  • Code: TIMER00 (32-bit, PRESCALER=0), HFCLK via TASKS_XOSTART/XO.STAT (HFXO, 32 MHz), timer re-start for duty ≤96 ticks (errata [25] workaround)

Symptoms:

  • With RTT (CONFIG_USE_SEGGER_RTT=y): Duty cycles are correct (oscilloscope):
    • 32 ticks: 2.5% (~0.25 µs high)
    • 64 ticks: 5% (~0.5 µs)
    • 96 ticks: 7.5% (~0.75 µs)
    • 128 ticks: 10% (~1 µs)
    • 140 ticks: 10.9375% (~1.094 µs)
    • 256 ticks: 20% (~2 µs)
  • Without RTT (CONFIG_USE_SEGGER_RTT=n): Duty cycles ≤140 ticks are too low:
    • 32 ticks: ~0% (flat)
    • 64 ticks: ~2–3%
    • 96 ticks: ~4–5%
    • 128 ticks: ~7–8%
    • 140 ticks: ~8–9%
    • 256 ticks: Correct (~20%, 2 µs)
  • Period stays 10 µs (100 kHz). A GPIO toggle confirms the loop runs every 4 seconds. No hard faults.

Issue: Duty cycles ≤140 ticks are incorrect without RTT, possibly due to TIMER00 event timing or HFCLK stability. I’ve tried longer HFCLK timeouts, clearing events, and re-setting CC registers, but no improvement.

Questions:

  1. Why do low duty cycles fail without RTT on nRF54L15?
  2. Any TIMER00 or HFCLK configs to stabilize PWM?
  3. Known errata affecting TIMER00 or clock beyond [25] in NCS v2.9.1?

I can share sanitized code or logs if needed. Thanks for any help!

  • Hello,

    Is the only difference between using RTT and not using it whether the CONFIG_USE_SEGGER_RTT symbol is defined, or are you also viewing the logs? I'm asking because the chip will be kept in debug interface mode if you connect the debugger and read the logs, and this may have a some impact on the interrupt latency. Though it should not have much if any effect on DPPI triggered tasks. Did you want to avoid using the PWM altoghether, or just the driver? 

    I can share sanitized code or logs if needed. Thanks for any help!

    Are you able to provide a minimal sample that would allow me to reproduce the problem? I'm not aware of any errata issues which could explain what you are observing.

    Best regards,

    Vidar

  • Hi Vidar,
    No just setting CONFIG_USE_SEGGER_RTT alone is not doing anything. The difference is whether or not I am connected and view the logs. 
    Yes I want to avoid the PWM as 16MHz base clock gives me not enough resolution. 

    Yes I can send you some code to try it out, runs fine on the DK...

    Thanks a lot

Related