Skip to content

Commit 0cc164e

Browse files
tyaliejgl-meta
authored andcommitted
drivers: lpadc: fix ADC command chaining
When reading multiple ADC channel in parallel, an ADC command chain will be build. This is similar to a linked list, as every command references the next command. Before this patch every ADC command after the first, would always reference this initial command. So that during execution only two commands (the last and first) would be executed which resulted in readout of only two analog values. As Zephyr expected more to come in, the `read_adc` function would block endlessly. The patch fixes the behaviour and allows a correct chain to build up. Fixes #60277 Signed-off-by: Elisabeth Friedrich <[email protected]>
1 parent 1611b4c commit 0cc164e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/adc/adc_mcux_lpadc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ static int mcux_lpadc_start_read(const struct device *dev,
238238
} else {
239239
/* End of chain */
240240
data->cmd_config[channel].chainedNextCommandNumber = 0;
241-
last_enabled = channel;
242241
}
242+
last_enabled = channel;
243243
LPADC_SetConvCommandConfig(config->base,
244244
channel + 1, &data->cmd_config[channel]);
245245
}

0 commit comments

Comments
 (0)