cc2538: pwm: Fix clock
The peripheral core clock of the general-purpose timers used by the PWM driver is the system clock, not the I/O clock. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
This commit is contained in:
parent
4302e23ddc
commit
9c6d9a7fe0
2 changed files with 12 additions and 12 deletions
|
@ -135,10 +135,10 @@ pwm_enable(uint32_t freq, uint8_t duty, uint8_t timer, uint8_t ab)
|
|||
}
|
||||
|
||||
/* Get the peripheral clock and equivalent deassert count */
|
||||
interval_load = sys_ctrl_get_io_clock() / freq;
|
||||
interval_load = sys_ctrl_get_sys_clock() / freq;
|
||||
duty_count = ((interval_load * duty) + 1) / 100;
|
||||
|
||||
PRINTF("PWM: IO %luHz: %lu %lu\n", sys_ctrl_get_io_clock(),
|
||||
PRINTF("PWM: sys %luHz: %lu %lu\n", sys_ctrl_get_sys_clock(),
|
||||
interval_load, duty_count);
|
||||
|
||||
/* Set the start value (period), count down */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue