Closed bradanlane closed 1 year ago
The current DMA code in RP2040_AudioPwm.cpp always manipulates PWM0. In the following code I have changed the PWM_BASE value to using the pwm_hw->slice[] value for the COUNT COMPARE.
RP2040_AudioPwm.cpp
PWM_BASE
pwm_hw->slice[]
(See commented out parameter followed by new parameter)
dma_channel_configure( audio_dma_ch, &audio_dma_ch_cfg, // (void *)(PWM_BASE + PWM_CH0_CC_OFFSET), // Write to PWM counter compare &pwm_hw->slice[audio_pwm_slice_num].cc, // Write to PWM counter compare &(audio_buffer_a[0]), buffSize, false );
With this change, the proper slice is used based on the value of RP2040_AUDIO_PWM_PIN.
RP2040_AUDIO_PWM_PIN
Thank you very much, I've integrated your suggested code change
Glad I was able to find the fix.
The current DMA code in
RP2040_AudioPwm.cpp
always manipulates PWM0. In the following code I have changed thePWM_BASE
value to using thepwm_hw->slice[]
value for the COUNT COMPARE.(See commented out parameter followed by new parameter)
With this change, the proper slice is used based on the value of
RP2040_AUDIO_PWM_PIN
.