I am working on an nRF52840 where I need the following outputs:
- a continuous 1MHz master clock
- a 126 bit serial bit data output sent out whenever a user wants with a 500khz clock output
This 126 bit data/clock must be perfectly edge-aligned with the 1MHz master clock to prevent timing jitter. Thus, I was planning to use a single PWM peripheral which outputs a continuous 1mhz clock and the 126 bit clock/data by setting the sequence buffer manually whenever the user wants to send the data. For this to work, I would initially need to start the continuous 1mhz clock using something like:
nrfx_pwm_simple_playback(&pwm_instance, &seq_1mhz_clk, 1, NRFX_PWM_FLAG_LOOP);
and then everytime the user wants to send the 126 bit serial data, they would call:
nrfx_pwm_complex_playback(&pwm_instance, &seq_126bits, &seq_clk_1mhz, 1, NRFX_PWM_FLAG_LOOP | NRFX_PWM_FLAG_SIGNAL_END_SEQ0);
where seq_126bits is populated with the data that the user wants to send everytime. Is this the right way to do this? Also, will the 1mhz continuous clock not pause in the middle?