- SDK: 15.2
- SoftDevice: s140_nrf52_6.1.0
- SDK example: SDK\nRF5_SDK_15.2.0_9412b96\examples\peripheral\pwm_driver
- Hardware: nRF52840 Development Kit
- PCA10056
- 2.0.1
- 2020.33
Hello,
I have run through the logic for demo 1 through demo 3 and they make sense based on unit testing. When testing demo 4 with a slight modification, I am encountering an issue with BSP_LED_2 (LED3 on silkscreen) that I can't explain. First, running demo 4 with no modifications to main.c results in the expected output as shown below for LED3 (silkscreen label). Specifically, the "stay off" time is 1.5 seconds.

Now if I change the stay off time length from 2 to 1, I would expect the off time to now be 0.75 seconds (half). Code change is below.
// Sequence 1 - off, duration: 1500 ms.
nrf_pwm_sequence_t const pwm1_seq1 =
{
.values.p_common = stay_off_values,
.length = 1, // 2 <------------- Change from 2 to 1
.repeats = 149,
.end_delay = 0
};
When measuring the output after this change, I see the following:

The off time is now ~30 msec instead of the expected 750 msec. Why is this? Is this because the buffer length is too small for the PWM frequency selected?
From the nRF52840 datasheet: "If a sequence is in use in a simple or complex sequence, it must have a length of SEQ[n].CNT
> 0."
Thanks,
Derek