Hello everyone,
I tried to use the 16 bit timer as PWM generator on NHS3152 chip with CT16_M0 and M1 pins and it seems that the highest frequency reached is only 30Hz when the system clock is 2MHz and the timer prescaler is set to 0.
I also tried to set the the system clock to 8MHz and the PWM reach 120Hz (logically), whiwh is still too slow for our application.
Is there any advice on how to increase the frequency, or did I make something wrong in the program ?
Here is the simple code implemented :
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_3, IOCON_FUNC_1);
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_7, IOCON_FUNC_1);
Chip_TIMER16_0_Init();
Chip_TIMER_PrescaleSet(NSS_TIMER16_0, 0);
Chip_TIMER_SetMatch(NSS_TIMER16_0, 0, 20000);
Chip_TIMER_MatchDisableInt(NSS_TIMER16_0, 0);
Chip_TIMER_StopOnMatchDisable(NSS_TIMER16_0, 0);
Chip_TIMER_ResetOnMatchDisable(NSS_TIMER16_0, 0);
Chip_TIMER_SetMatch(NSS_TIMER16_0, 1, 40000);
Chip_TIMER_MatchDisableInt(NSS_TIMER16_0, 1);
Chip_TIMER_StopOnMatchDisable(NSS_TIMER16_0, 1);
Chip_TIMER_ResetOnMatchDisable(NSS_TIMER16_0, 1);
Chip_TIMER_SetMatchOutputMode(NSS_TIMER16_0, 0, TIMER_MATCH_OUTPUT_PWM);
Chip_TIMER_SetMatchOutputMode(NSS_TIMER16_0, 1, TIMER_MATCH_OUTPUT_PWM);
Chip_TIMER_Reset(NSS_TIMER16_0);
Chip_TIMER_Enable(NSS_TIMER16_0);
Thank you.