Hello there.
I am wondering if PWM peripheral in waveform is able to generate a following sequence:
The idea, as you may see, is to generate a sequence with the same Duty Cycle (50%) and different Periods.
Best Regards, Genadi.
Hello there.
I am wondering if PWM peripheral in waveform is able to generate a following sequence:
The idea, as you may see, is to generate a sequence with the same Duty Cycle (50%) and different Periods.
Best Regards, Genadi.
Hi,
you can have a look at our example,
note to do different periods you need to restart PWM...
But you can have a look at the wave counter, this might help you.
Best regards,
Kaja
This might help:
#define CYCLE_A (2*1000) // Some arbitrary number of clock cycles to match required resolution #define CYCLE_B (2*2000) // More clock cycles gets wider #define CYCLE_C (2*3000) #define CYCLE_D (2*4000) nrf_pwm_values_wave_form_t pecularSequence[] = { // Index Normal pin Inverted (Spare) Top Value // ===== =================== ========== ======= ========= { /* 0 */ 0x8000|(CYCLE_A/2), (CYCLE_A/2), 0, CYCLE_A }, { /* 1 */ 0x8000|(CYCLE_B/2), (CYCLE_B/2), 0, CYCLE_B }, { /* 2 */ 0x8000|(CYCLE_C/2), (CYCLE_C/2), 0, CYCLE_C }, { /* 3 */ 0x8000|(CYCLE_D/2), (CYCLE_D/2), 0, CYCLE_D }, }; #define NUM_PWM_ITERATIONS ( sizeof(pecularSequence)/sizeof(pecularSequence[0].channel_0) ) #define NUM_PWM_TABLE_LINES ( sizeof(pecularSequence)/sizeof(pecularSequence[0]) ) STATIC_ASSERT(sizeof(nrf_pwm_values_wave_form_t) == sizeof(pecularSequence[0]), "pecularSequence line size"); // NUM_PWM_ITERATIONS WaveLength (.CNT) is 15-bit Amount of values (duty cycles) in this sequence