From de477987f7f207e3fe5fa9832943ff9e245ec613 Mon Sep 17 00:00:00 2001 From: Emilio Benavente Date: Thu, 23 May 2024 15:07:56 +0000 Subject: [PATCH] drivers: counter: counter_mcux_lptmr: Update to start with top value Updated the driver to start with a value to compare the counter with otherwise the counter will not start until the user sets the top value manually, an issue that will occur inside the counter test. Signed-off-by: Emilio Benavente --- drivers/counter/counter_mcux_lptmr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/counter/counter_mcux_lptmr.c b/drivers/counter/counter_mcux_lptmr.c index 4e1007d9b4927ca..2ff0cbb5a83ebf9 100644 --- a/drivers/counter/counter_mcux_lptmr.c +++ b/drivers/counter/counter_mcux_lptmr.c @@ -134,9 +134,10 @@ static int mcux_lptmr_init(const struct device *dev) lptmr_config.pinSelect = config->pin; lptmr_config.pinPolarity = config->polarity; } - LPTMR_Init(config->base, &lptmr_config); + LPTMR_SetTimerPeriod(config->base, config->info.max_top_value); + config->irq_config_func(dev); return 0; @@ -205,7 +206,11 @@ static void mcux_lptmr_irq_config_0(const struct device *dev); static struct mcux_lptmr_config mcux_lptmr_config_0 = { .info = { +#if defined(CONFIG_SOC_SERIES_MCXNX4X) + .max_top_value = UINT32_MAX, +#else .max_top_value = UINT16_MAX, +#endif .freq = DT_INST_PROP(0, clock_frequency) / DT_INST_PROP(0, prescaler), .flags = COUNTER_CONFIG_INFO_COUNT_UP,