From d5b5b02685a399ee7f129aeb7628650a1856799e Mon Sep 17 00:00:00 2001 From: Sai Asish Y Date: Mon, 18 May 2026 16:29:00 -0700 Subject: [PATCH] [boards] Fix off-by-one in SysTick cyclesPerTick reload values --- boards/pic32cz_curiosity_ultra/board.h | 2 +- boards/stm32c031_nucleo/board.h | 2 +- boards/stm32f091rc_nucleo/board.h | 2 +- boards/stm32f302r8_nucleo/board.h | 2 +- boards/stm32f411_blackpill/board.h | 2 +- boards/stm32h563zi_nucleo/board.h | 2 +- boards/stm32l152re_nucleo/board.h | 2 +- boards/stm32n657a0_nucleo/board.h | 2 +- boards/stm32wb55xx_nucleo/board.h | 2 +- boards/stm32wba55cg_nucleo/board.h | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/boards/pic32cz_curiosity_ultra/board.h b/boards/pic32cz_curiosity_ultra/board.h index d1cb9f5..8c9d365 100644 --- a/boards/pic32cz_curiosity_ultra/board.h +++ b/boards/pic32cz_curiosity_ultra/board.h @@ -86,7 +86,7 @@ extern volatile uint32_t g_tick; .base = WHAL_CORTEX_M7_SYSTICK_BASE, \ /* .driver: direct API mapping */ \ .cfg = (void *)&(const whal_SysTick_Cfg){ \ - .cyclesPerTick = 300000000 / 1000, \ + .cyclesPerTick = (300000000 / 1000) - 1, /* SysTick reloads every LOAD+1 cycles */ \ .clkSrc = WHAL_SYSTICK_CLKSRC_SYSCLK, \ .tickInt = WHAL_SYSTICK_TICKINT_ENABLED, \ }, \ diff --git a/boards/stm32c031_nucleo/board.h b/boards/stm32c031_nucleo/board.h index 0439815..37af27f 100644 --- a/boards/stm32c031_nucleo/board.h +++ b/boards/stm32c031_nucleo/board.h @@ -112,7 +112,7 @@ enum { .base = WHAL_CORTEX_M0PLUS_SYSTICK_BASE, \ /* .driver: direct API mapping */ \ .cfg = (void *)&(const whal_SysTick_Cfg){ \ - .cyclesPerTick = 48000000 / 1000, \ + .cyclesPerTick = (48000000 / 1000) - 1, /* SysTick reloads every LOAD+1 cycles */ \ .clkSrc = WHAL_SYSTICK_CLKSRC_SYSCLK, \ .tickInt = WHAL_SYSTICK_TICKINT_ENABLED, \ }, \ diff --git a/boards/stm32f091rc_nucleo/board.h b/boards/stm32f091rc_nucleo/board.h index 4be5510..cc75b42 100644 --- a/boards/stm32f091rc_nucleo/board.h +++ b/boards/stm32f091rc_nucleo/board.h @@ -156,7 +156,7 @@ enum { .base = WHAL_CORTEX_M0_SYSTICK_BASE, \ /* .driver: direct API mapping */ \ .cfg = (void *)&(const whal_SysTick_Cfg){ \ - .cyclesPerTick = 48000000 / 1000, \ + .cyclesPerTick = (48000000 / 1000) - 1, /* SysTick reloads every LOAD+1 cycles */ \ .clkSrc = WHAL_SYSTICK_CLKSRC_SYSCLK, \ .tickInt = WHAL_SYSTICK_TICKINT_ENABLED, \ }, \ diff --git a/boards/stm32f302r8_nucleo/board.h b/boards/stm32f302r8_nucleo/board.h index 8a3a37e..32190b1 100644 --- a/boards/stm32f302r8_nucleo/board.h +++ b/boards/stm32f302r8_nucleo/board.h @@ -158,7 +158,7 @@ enum { .base = WHAL_CORTEX_M4_SYSTICK_BASE, \ /* .driver: direct API mapping */ \ .cfg = (void *)&(const whal_SysTick_Cfg){ \ - .cyclesPerTick = 48000000 / 1000, \ + .cyclesPerTick = (48000000 / 1000) - 1, /* SysTick reloads every LOAD+1 cycles */ \ .clkSrc = WHAL_SYSTICK_CLKSRC_SYSCLK, \ .tickInt = WHAL_SYSTICK_TICKINT_ENABLED, \ }, \ diff --git a/boards/stm32f411_blackpill/board.h b/boards/stm32f411_blackpill/board.h index 9e40712..f2e5a9c 100644 --- a/boards/stm32f411_blackpill/board.h +++ b/boards/stm32f411_blackpill/board.h @@ -119,7 +119,7 @@ extern const whal_Stm32f4_Flash_Sector g_flashSectors[FLASH_SECTOR_COUNT]; .base = WHAL_CORTEX_M4_SYSTICK_BASE, \ /* .driver: direct API mapping */ \ .cfg = (void *)&(const whal_SysTick_Cfg){ \ - .cyclesPerTick = 100000000 / 1000, \ + .cyclesPerTick = (100000000 / 1000) - 1, /* SysTick reloads every LOAD+1 cycles */ \ .clkSrc = WHAL_SYSTICK_CLKSRC_SYSCLK, \ .tickInt = WHAL_SYSTICK_TICKINT_ENABLED, \ }, \ diff --git a/boards/stm32h563zi_nucleo/board.h b/boards/stm32h563zi_nucleo/board.h index 30648b6..1e14ca0 100644 --- a/boards/stm32h563zi_nucleo/board.h +++ b/boards/stm32h563zi_nucleo/board.h @@ -214,7 +214,7 @@ extern uint8_t ethRxBufs[BOARD_ETH_RX_DESC_COUNT * BOARD_ETH_RX_BUF_SIZE]; .base = WHAL_CORTEX_M33_SYSTICK_BASE, \ /* .driver: direct API mapping */ \ .cfg = (void *)&(const whal_SysTick_Cfg){ \ - .cyclesPerTick = 168000000 / 1000, \ + .cyclesPerTick = (168000000 / 1000) - 1, /* SysTick reloads every LOAD+1 cycles */ \ .clkSrc = WHAL_SYSTICK_CLKSRC_SYSCLK, \ .tickInt = WHAL_SYSTICK_TICKINT_ENABLED, \ }, \ diff --git a/boards/stm32l152re_nucleo/board.h b/boards/stm32l152re_nucleo/board.h index 0797bd7..cd613db 100644 --- a/boards/stm32l152re_nucleo/board.h +++ b/boards/stm32l152re_nucleo/board.h @@ -158,7 +158,7 @@ enum { .base = WHAL_CORTEX_M3_SYSTICK_BASE, \ /* .driver: direct API mapping */ \ .cfg = (void *)&(const whal_SysTick_Cfg){ \ - .cyclesPerTick = 32000000 / 1000, \ + .cyclesPerTick = (32000000 / 1000) - 1, /* SysTick reloads every LOAD+1 cycles */ \ .clkSrc = WHAL_SYSTICK_CLKSRC_SYSCLK, \ .tickInt = WHAL_SYSTICK_TICKINT_ENABLED, \ }, \ diff --git a/boards/stm32n657a0_nucleo/board.h b/boards/stm32n657a0_nucleo/board.h index 5b4eb13..de7b827 100644 --- a/boards/stm32n657a0_nucleo/board.h +++ b/boards/stm32n657a0_nucleo/board.h @@ -339,7 +339,7 @@ extern uint8_t ethRxBufs[BOARD_ETH_RX_DESC_COUNT * BOARD_ETH_RX_BUF_SIZE]; .base = WHAL_CORTEX_M55_SYSTICK_BASE, \ /* .driver: direct API mapping */ \ .cfg = (void *)&(const whal_SysTick_Cfg){ \ - .cyclesPerTick = 64000000 / 1000, \ + .cyclesPerTick = (64000000 / 1000) - 1, /* SysTick reloads every LOAD+1 cycles */ \ .clkSrc = WHAL_SYSTICK_CLKSRC_SYSCLK, \ .tickInt = WHAL_SYSTICK_TICKINT_ENABLED, \ }, \ diff --git a/boards/stm32wb55xx_nucleo/board.h b/boards/stm32wb55xx_nucleo/board.h index f1928db..bd4755e 100644 --- a/boards/stm32wb55xx_nucleo/board.h +++ b/boards/stm32wb55xx_nucleo/board.h @@ -216,7 +216,7 @@ enum { .base = WHAL_CORTEX_M4_SYSTICK_BASE, \ /* .driver: direct API mapping */ \ .cfg = (void *)&(const whal_SysTick_Cfg){ \ - .cyclesPerTick = 64000000 / 1000, \ + .cyclesPerTick = (64000000 / 1000) - 1, /* SysTick reloads every LOAD+1 cycles */ \ .clkSrc = WHAL_SYSTICK_CLKSRC_SYSCLK, \ .tickInt = WHAL_SYSTICK_TICKINT_ENABLED, \ }, \ diff --git a/boards/stm32wba55cg_nucleo/board.h b/boards/stm32wba55cg_nucleo/board.h index 63c7231..944185d 100644 --- a/boards/stm32wba55cg_nucleo/board.h +++ b/boards/stm32wba55cg_nucleo/board.h @@ -256,7 +256,7 @@ enum { .base = WHAL_CORTEX_M33_SYSTICK_BASE, \ /* .driver: direct API mapping */ \ .cfg = (void *)&(const whal_SysTick_Cfg){ \ - .cyclesPerTick = 100000000 / 1000, \ + .cyclesPerTick = (100000000 / 1000) - 1, /* SysTick reloads every LOAD+1 cycles */ \ .clkSrc = WHAL_SYSTICK_CLKSRC_SYSCLK, \ .tickInt = WHAL_SYSTICK_TICKINT_ENABLED, \ }, \