Hi BC Stewart
Sorry for the late reply, I was out of Office. we have checked your code and found the problem:
This is not a multiple TPM related problem, this is more related with the execution time and the TPM1 that is already counting when you setup DMAMUX, let me explain, in your code:
TPM_StartTimer(TPM1, kTPM_SystemClock);
TPM_Init(TPM0, &tpmInfo);
TPM_SetupPwm(TPM0, &tpmParam, 1U, kTPM_EdgeAlignedPwm, 22050U, TPM_SOURCE_CLOCK);
TPM_StartTimer(TPM0, kTPM_SystemClock);
TPM_UpdatePwmDutycycle(TPM0,kTPM_Chnl_0, kTPM_EdgeAlignedPwm,50U);
DMAMUX_Init(DMAMUX0);
DMAMUX_SetSource(DMAMUX0, 0 ,kDmaRequestMux0TPM1Channel0);
DMAMUX_EnableChannel(DMAMUX0, 0);
Now, as you can see, when try to set DMAMUX, TPM1 is already counting (TPM_StartTimer), this will cause a DMA request before DMAMUX initialization, this will cause problems in subsequent DMA requests.
This is why when you didn't have the TPM0 init part your code works without problem, because the TPM0 initialization (or any other code) consumes time and TPM1 request a DMA transfer before DMA being completely set.
If you start TPM0 timer after you set DMA the problem should disappear, so please locate
TPM_StartTimer(TPM1, kTPM_SystemClock);
After
DMA0->DMA[0].DCR &= ~(1u << 7u); //clear DREQ
NOTE: you don't need line NVIC_EnableIRQ(DMA0_IRQn); because NVIC is set in the DMA_CreateHandle(&g_DMA_Handle, DMA0, 0); line
Hope this could resolve your problem.
Have a great day,
Jorge Alcala
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------