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

PWM doesn't work on PIN 4 and PIN 6

I am working with the DK-52 and SDK 14.2. I am generating two PWM signals using the pwm driver.

Everything works as expected on PINS 11 and 12.

If I change pins to 5 and 6, PIN 5 is fine, PIN 6 has no signal. The same if I try PIN 4 instead of PIN 6.

Is there any reason because PIN 4 and PIN 6 shouldn't work?

I have not tested all the other PINS because I suppose I missed something.

Thanks

--

Down here my code (excerpt from more complex code):

static nrf_drv_pwm_t m_pwm_1 = NRF_DRV_PWM_INSTANCE(1);
...

static nrf_pwm_values_individual_t seq_values_1[1];
....

nrf_drv_pwm_config_t config_1;

config_1.output_pins[0] = 11;
config_1.output_pins[1] = 12;
config_1.output_pins[2] = NRF_DRV_PWM_PIN_NOT_USED;
config_1.output_pins[3] = NRF_DRV_PWM_PIN_NOT_USED;
config_1.irq_priority = PWM_DEFAULT_CONFIG_IRQ_PRIORITY;
config_1.base_clock = NRF_PWM_CLK_125kHz;
config_1.count_mode = NRF_PWM_MODE_UP;
config_1.top_value = 2500;
config_1.load_mode = NRF_PWM_LOAD_INDIVIDUAL;
config_1.step_mode = NRF_PWM_STEP_AUTO;

err_code = nrf_drv_pwm_init(&m_pwm_1, &config_1, NULL);
APP_ERROR_CHECK(err_code);

seq_values_1[0].channel_0 = 62;
seq_values_1[0].channel_1 = 240;

nrf_pwm_sequence_t seq;

seq.values.p_individual = &seq_values_1;
seq.length = NRF_PWM_VALUES_LENGTH(seq_values_1);
seq.repeats = 0;
seq.end_delay = 0;

err_code = nrf_drv_pwm_simple_playback(&m_pwm_1, &seq, 1, NRF_DRV_PWM_FLAG_LOOP);
APP_ERROR_CHECK(err_code);
Related