Hi,
I think you can consider the following code.
P0_10 FC6_SCK CT_INP10 CT2MAT0 FC1_TXD_SCL_
MISO
The following code set up so that the PWM signal can output to CT2MT0 pin(P0_10)
In the pin_mux.c, pls add the code in the void BOARD_InitPins(void)
void BOARD_InitPins(void)
{
.........................
CLOCK_EnableClock(kCLOCK_Iocon);
//P0_10 func3=CT2_MAT0
const uint32_t port0_pin10_config = (/* Pin is configured as CTIMER2_MAT1 */
IOCON_PIO_FUNC3 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT1 PIN4 (coords: 1) is configured as CTIMER2_MAT1 */
IOCON_PinMuxSet(IOCON, 0U, 10U, port0_pin10_config);
}
For example, you want to add the CT2_MAT0 pin to output PWM signal.
srcClock_Hz = CTIMER_CLK_FREQ;
PRINTF("CTimer example to generate a PWM signal\r\n");
CTIMER_GetDefaultConfig(&config);
timerClock = srcClock_Hz / (config.prescale + 1);
CTIMER_Init(CTIMER, &config);
/* Get the PWM period match value and pulse width match value of 20Khz PWM signal with 20% dutycycle */
CTIMER_GetPwmPeriodValue(20000, 20, timerClock);
CTIMER_SetupPwmPeriod(CTIMER, CTIMER_MAT_OUT, g_pwmPeriod, g_pulsePeriod, false);
//Can not use kCTIMER_Match_3, which is used to control PWM period
//output PWM signal from the P0_10
CTIMER_SetupPwmPeriod(CTIMER, kCTIMER_Match_0, g_pwmPeriod, g_pulsePeriod, false);
CTIMER_StartTimer(CTIMER);
while (1)
{
}
}
I do not have a test, pls test yourself.
Hope it can help you
BR
XiangJun Rong