From 8f8ec7e55001c3146927ba0bdfdd732b23fa789b Mon Sep 17 00:00:00 2001 From: Ilya Zhuravlev Date: Mon, 12 Sep 2022 20:09:28 -0600 Subject: [PATCH] fix rp2040 chconf to prevent freezes in wait_ms --- .../boards/GENERIC_PROMICRO_RP2040/configs/chconf.h | 8 ++++++-- .../chibios/boards/GENERIC_RP_RP2040/configs/chconf.h | 8 ++++++-- platforms/chibios/boards/QMK_PM2040/configs/chconf.h | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/chconf.h b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/chconf.h index d53f57edd9..eae6dcc529 100644 --- a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/chconf.h +++ b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/chconf.h @@ -5,9 +5,13 @@ #define CH_CFG_SMP_MODE TRUE #define CH_CFG_ST_RESOLUTION 32 -#define CH_CFG_ST_FREQUENCY 1000000 +#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_INTERVALS_SIZE 32 #define CH_CFG_TIME_TYPES_SIZE 32 -#define CH_CFG_ST_TIMEDELTA 20 +#define CH_CFG_ST_TIMEDELTA 0 + +/* Workaround a bug in chibios where port_timer_enable is not defined for RP2040 in tick mode */ +void stBind(void); +#define port_timer_enable(oip) stBind() #include_next diff --git a/platforms/chibios/boards/GENERIC_RP_RP2040/configs/chconf.h b/platforms/chibios/boards/GENERIC_RP_RP2040/configs/chconf.h index d53f57edd9..eae6dcc529 100644 --- a/platforms/chibios/boards/GENERIC_RP_RP2040/configs/chconf.h +++ b/platforms/chibios/boards/GENERIC_RP_RP2040/configs/chconf.h @@ -5,9 +5,13 @@ #define CH_CFG_SMP_MODE TRUE #define CH_CFG_ST_RESOLUTION 32 -#define CH_CFG_ST_FREQUENCY 1000000 +#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_INTERVALS_SIZE 32 #define CH_CFG_TIME_TYPES_SIZE 32 -#define CH_CFG_ST_TIMEDELTA 20 +#define CH_CFG_ST_TIMEDELTA 0 + +/* Workaround a bug in chibios where port_timer_enable is not defined for RP2040 in tick mode */ +void stBind(void); +#define port_timer_enable(oip) stBind() #include_next diff --git a/platforms/chibios/boards/QMK_PM2040/configs/chconf.h b/platforms/chibios/boards/QMK_PM2040/configs/chconf.h index d53f57edd9..eae6dcc529 100644 --- a/platforms/chibios/boards/QMK_PM2040/configs/chconf.h +++ b/platforms/chibios/boards/QMK_PM2040/configs/chconf.h @@ -5,9 +5,13 @@ #define CH_CFG_SMP_MODE TRUE #define CH_CFG_ST_RESOLUTION 32 -#define CH_CFG_ST_FREQUENCY 1000000 +#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_INTERVALS_SIZE 32 #define CH_CFG_TIME_TYPES_SIZE 32 -#define CH_CFG_ST_TIMEDELTA 20 +#define CH_CFG_ST_TIMEDELTA 0 + +/* Workaround a bug in chibios where port_timer_enable is not defined for RP2040 in tick mode */ +void stBind(void); +#define port_timer_enable(oip) stBind() #include_next