diff options
| author | Stefan Kerkmann <[email protected]> | 2021-08-09 21:36:50 +0200 |
|---|---|---|
| committer | Stefan Kerkmann <[email protected]> | 2021-08-09 21:37:06 +0200 |
| commit | 1b6540a61cef4f7c5eb5b6001a64cd1425e805ff (patch) | |
| tree | a5735fff9322acb7ae7c14caff451896360a021d | |
| parent | 27f147f421927c6822f00608e2c3757687834e2f (diff) | |
Update systick reload value
The systick timer is driven by the AHB bus divided by 4, set the correct
reload value to generate a timer irq every ms.
| -rw-r--r-- | hw/bsp/gd32vf103_longan_nano/gd32vf103_longan_nano.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/bsp/gd32vf103_longan_nano/gd32vf103_longan_nano.c b/hw/bsp/gd32vf103_longan_nano/gd32vf103_longan_nano.c index e15d4e2b2..951ab844c 100644 --- a/hw/bsp/gd32vf103_longan_nano/gd32vf103_longan_nano.c +++ b/hw/bsp/gd32vf103_longan_nano/gd32vf103_longan_nano.c @@ -39,7 +39,9 @@ void USBFS_IRQHandler(void) { tud_int_handler(0); } #define USB_NO_VBUS_PIN -#define TIMER_TICKS (SystemCoreClock / 1000) +// According to GD32VF103 user manual clock tree: +// Systick clock = AHB clock / 4. +#define TIMER_TICKS ((SystemCoreClock / 4) / 1000) #define BUTTON_PORT GPIOA #define BUTTON_PIN GPIO_PIN_0 |
