nrf54l15 pwm capture on sdk v3.3.1

I have a sensor that outputs PWM that I need to interface to. All I need is an input GPIO pin and using GPIOTE + GPPI + timer capture I would be able to determine the duty cycle ratio.

I found a sample program that gives me an idea on how to go about it. From its README: "Zephyr GPIO driver is disabled to prevent it from registering its own handler for the GPIOTE interrupt."  The driver is disable by placing "CONFIG_GPIO=n" in prj.conf. 

The thing is I do need the GPIO driver to be enabled for other functions. Can it be done with the GPIO driver enabled? Is there an example I could use? If not, documentation?

Thanks

Regards

Sammy

Parents
  • Hi,

    Yes you don't need CONFIG_GPIO=n. You can keep the GPIO driver enabled and still do this. That sample disables GPIO as it initializes GPIOTE and hooks the interrupt itself. Since you're keeping CONFIG_GPIO=y, the GPIO driver already handles that at boot, so I think you just don't need to copy the sample's nrfx_gpiote_init() and IRQ_CONNECT() lines.

    For your sensor pin, set it up through nrfx, then read the capture values and work out the duty cycle in software. Keep using the normal GPIO API for all your other pins and just don't mix both APIs on that one sensor pin.

    And there isn't a PWM input sample for the nRF54L15, but if there is any confusion or if I have misunderstood your question please do let me know. Thanks

    Best Regards,
    Syed Maysum

Reply
  • Hi,

    Yes you don't need CONFIG_GPIO=n. You can keep the GPIO driver enabled and still do this. That sample disables GPIO as it initializes GPIOTE and hooks the interrupt itself. Since you're keeping CONFIG_GPIO=y, the GPIO driver already handles that at boot, so I think you just don't need to copy the sample's nrfx_gpiote_init() and IRQ_CONNECT() lines.

    For your sensor pin, set it up through nrfx, then read the capture values and work out the duty cycle in software. Keep using the normal GPIO API for all your other pins and just don't mix both APIs on that one sensor pin.

    And there isn't a PWM input sample for the nRF54L15, but if there is any confusion or if I have misunderstood your question please do let me know. Thanks

    Best Regards,
    Syed Maysum

Children
No Data
Related