Hi,
I select the ch0 to generate PWM signal, PWM period = 100us, PWM duty cycle = 10%, the following code is configuration:
void emios_0_init(void)
{
EMIOS_0.MCR.R = 0x10003f00; /* Enable global prescaler, divider ratio = 64, clock = fsys / 64 = 1MHz */
EMIOS_0.CH[0].CADR.R = 0;
EMIOS_0.CH[0].CBDR.R = 10;
EMIOS_0.CH[0].CCR.R = 0x20206e0; /* Select internal counter */
EMIOS_0.CH[0].CSR.R = 0x80008001;
EMIOS_0.MCR.B.GPREN = 1; /* Start eMIOS */
}
void intc_init(void)
{
EXCEP_InitExceptionHandlers();
INTC_InitINTCInterrupts();
INTC_InstallINTCInterruptHandler(emios_ch1_isr, 141, 2); /* eMIOS channel 1 priority: 2 */
INTC.CPR.R = 0x0;
}
void emios_ch1_isr(void)
{
if (EMIOS_0.CH[0].CSR.B.FLAG == 1)
{
EMIOS_0.CH[0].CADR.R += 100;
EMIOS_0.CH[0].CBDR.R += 100;
EMIOS_0.CH[0].CSR.B.FLAG = 1;
}
}
But the wave is wrong, the positive pulse width is 10us and the negative pulse width is 65ms. It seems that EMIOS_0.CH[0].CADR.R and EMIOS_0.CH[0].CBDR.R can't be updated. Is anything wrong with my configuration?
Please guide me to solve it, thanks!