Hi Victor!
in my main function I am calling these two functions:
QTimerPWM_Ch1config();
QTimerPWM_Ch2config();
These functions are defined in the C file that I attached previously. The issue is that I cant have these functions defined both at the same time. I have to comment one them in order for me to see a one PWM on a single IO. if I dont comment one of them, I dont see any PWM anymore. Don't know if this makes sense or not. I found out that the lines in bold colors below are the source of the issue( which is the DMA).
My issue is the way the DMA is configured for cmpl1, and cmpl2 for TMR1 channel0 ; an d cmpl1,cmpl2 for TMR1 channel1.
with the scope i was able to see that DMA data gets corrupted as soon as a enable dma transfer for the above channels.
I hope you or someone can look closely at my c file that I attached before and tell me whats wrong with my DMA configuration?
/* Qtimer configuration for PWM count*/
void QTimerPWM_Ch1config(void)
{
qtmr_config_t qtmrConfig;
edma_config_t userConfig2,userConfig1;
EDMA_Init(QTMR_DMA, &userConfig1);
EDMA_CreateHandle(&LED1_EDMA_Handle1, QTMR_DMA, 1);
EDMA_SetCallback(&LED1_EDMA_Handle1, EDMA_LED1_Callback1, NULL);
EDMA_Init(QTMR_DMA, &userConfig2);
EDMA_CreateHandle(&LED1_EDMA_Handle2, QTMR_DMA, 0);
EDMA_SetCallback(&LED1_EDMA_Handle2, EDMA_LED1_Callback2, NULL);
/*
* qtmrConfig.debugMode = kQTMR_RunNormalInDebug;
* qtmrConfig.enableExternalForce = false;
* qtmrConfig.enableMasterMode = false;
* qtmrConfig.faultFilterCount = 0;
* qtmrConfig.faultFilterPeriod = 0;
* qtmrConfig.primarySource = kQTMR_ClockDivide_2;
* qtmrConfig.secondarySource = kQTMR_Counter0InputPin;
*/
//added
QTMR_GetDefaultConfig(&qtmrConfig);
qtmrConfig.primarySource = kQTMR_ClockDivide_1;
DMAMUX_Init(QTMR_DMA_MUX);
DMAMUX_SetSource(QTMR_DMA_MUX, 0, QTMR_EDMA_REQUEST_LED1CMPLD2_SOURCE);
DMAMUX_EnableChannel(QTMR_DMA_MUX, 0);
DMAMUX_SetSource(QTMR_DMA_MUX, 1, QTMR_EDMA_REQUEST_LED1CMPLD1_SOURCE);
DMAMUX_EnableChannel(QTMR_DMA_MUX, 1);
QTMR_Init(QTMR_BASEADDR, QTMR_PWM_CHANNEL1, &qtmrConfig);
/* Generate a 800Khz PWM signal with 0% dutycycle */
QTMR_SetupPwm(QTMR_BASEADDR, QTMR_PWM_CHANNEL1, 800000, 0, false, QTMR_SOURCE_CLOCK / 1);
// /* Enable comparator preload register 1 DMA */
// QTMR_EnableDma(QTMR_BASEADDR, QTMR_PWM_CHANNEL1, kQTMR_ComparatorPreload1DmaEnable);
// /* Enable comparator preload register 2 DMA */
// QTMR_EnableDma(QTMR_BASEADDR, QTMR_PWM_CHANNEL1, kQTMR_ComparatorPreload2DmaEnable);
// /* Start the counter */
// QTMR_StartTimer(QTMR_BASEADDR, QTMR_PWM_CHANNEL1, kQTMR_PriSrcRiseEdge);
}