PWM not working after upgrade to nrf Connect SDK 1.9.1

Since upgrading to nrf Connect SDK 1.9.1, I no longer have PWM output. No errors returned when calling pwm_pin_set_usec, yet no output.

I tried upgrading to the latest nrf Connect SDK (2.2.0), thinking that perhaps a bug was fixed, but the number of changes (include paths, etc) was too daunting.

Parents
  • Hi,

    Can you post the part of your code where you use pwm_pin_set_usec()?

    Regards,
    Sigurd Hellesvik

  • #define AFE_CLOCK_NODE  DT_ALIAS(afe_clock)

    #if DT_NODE_HAS_STATUS(AFE_CLOCK_NODE, okay)
    #ifndef DT_PWMS_LABEL
    #define AFE_CLOCK_LABEL DT_NODELABEL(AFE_CLOCK_NODE)
    #else
    #define AFE_CLOCK_LABEL DT_PWMS_LABEL(AFE_CLOCK_NODE)
    #endif
    #define AFE_CLOCK_CHANNEL   DT_PWMS_CHANNEL(AFE_CLOCK_NODE)
    #define AFE_CLOCK_FLAGS DT_PWMS_FLAGS(AFE_CLOCK_NODE)
    #else
    #error "Unsupported board: afe-clock devicetree alias is not defined"
    #define AFE_CLOCK_LABEL ""
    #define AFE_CLOCK_CHANNEL   0
    #define AFE_CLOCK_FLAGS 0
    #endif
     
        int ret = 0;

        _AfeClock_dev = device_get_binding(AFE_CLOCK_LABEL);
        if (!_AfeClock_dev) {
            Z_LOG(LOG_LEVEL_ERR, "Error: didn't find %s device.", AFE_CLOCK_LABEL);
            ret |= 0x1;
        }
     
        retpwm_pin_set_usec(AfeClock_dev, AFE_CLOCK_CHANNEL,
                       PWM_USEC(period), PWM_USEC(width), AFE_CLOCK_FLAGS);
        if (ret) {
            Z_LOG(LOG_LEVEL_ERR, "Error %d: failed to set pulse width.", ret);
        }
Reply
  • #define AFE_CLOCK_NODE  DT_ALIAS(afe_clock)

    #if DT_NODE_HAS_STATUS(AFE_CLOCK_NODE, okay)
    #ifndef DT_PWMS_LABEL
    #define AFE_CLOCK_LABEL DT_NODELABEL(AFE_CLOCK_NODE)
    #else
    #define AFE_CLOCK_LABEL DT_PWMS_LABEL(AFE_CLOCK_NODE)
    #endif
    #define AFE_CLOCK_CHANNEL   DT_PWMS_CHANNEL(AFE_CLOCK_NODE)
    #define AFE_CLOCK_FLAGS DT_PWMS_FLAGS(AFE_CLOCK_NODE)
    #else
    #error "Unsupported board: afe-clock devicetree alias is not defined"
    #define AFE_CLOCK_LABEL ""
    #define AFE_CLOCK_CHANNEL   0
    #define AFE_CLOCK_FLAGS 0
    #endif
     
        int ret = 0;

        _AfeClock_dev = device_get_binding(AFE_CLOCK_LABEL);
        if (!_AfeClock_dev) {
            Z_LOG(LOG_LEVEL_ERR, "Error: didn't find %s device.", AFE_CLOCK_LABEL);
            ret |= 0x1;
        }
     
        retpwm_pin_set_usec(AfeClock_dev, AFE_CLOCK_CHANNEL,
                       PWM_USEC(period), PWM_USEC(width), AFE_CLOCK_FLAGS);
        if (ret) {
            Z_LOG(LOG_LEVEL_ERR, "Error %d: failed to set pulse width.", ret);
        }
Children
Related