Hi. I am trying to output a square wave on to separate output pins. I want to have one inverted, however I can't even get the same output on both pins at the moment. The pin assigned to the second output on the PWM doesn't toggle like the first output, it just stays on whilst the PWM is enabled (see trace below).
Should the below PWM setup not result in both pins outputting the same signal?
When I swap them in software (so PWM_2 first) then they swap on the oscilloscope, so the 2 output pins are working.
void pwm_init(uint16_t freq) { nrf_drv_pwm_config_t const config0 = { .output_pins = { COIL_PWM_1, // channel 0 COIL_PWM_2, //channel 1 NRF_DRV_PWM_PIN_NOT_USED, // channel 2 NRF_DRV_PWM_PIN_NOT_USED, // channel 3 }, .irq_priority = APP_IRQ_PRIORITY_LOWEST, .base_clock = NRF_PWM_CLK_16MHz, .count_mode = NRF_PWM_MODE_UP, .top_value = freq, .load_mode = NRF_PWM_LOAD_INDIVIDUAL, .step_mode = NRF_PWM_STEP_AUTO }; // Init PWM without error handler APP_ERROR_CHECK(nrf_drv_pwm_init(&m_pwm0, &config0, NULL)); }
Thanks