Skip to content

Commit

Permalink
drivers: counter: counter_mcux_lptmr: Update to start with top value
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
EmilioCBen committed May 23, 2024
1 parent 1149ccb commit de47798
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/counter/counter_mcux_lptmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit de47798

Please sign in to comment.