Skip to content

Commit de91097

Browse files
committed
drivers: adc: stm32: only handle OVR flag when supported
STM32 ADC DMA support added in zephyrproject-rtos#52965 incorrectly assumed that all ADC devices have a OVR flag. This commit changes the driver to only account for it if it's found in the LL drivers. Signed-off-by: Hein Wessels <[email protected]>
1 parent d4ed0d7 commit de91097

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/adc/adc_stm32.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,11 @@ static void dma_callback(const struct device *dev, void *user_data,
794794
LOG_DBG("dma callback");
795795

796796
if (channel == data->dma.channel) {
797+
#if !defined(CONFIG_SOC_SERIES_STM32F1X)
797798
if (LL_ADC_IsActiveFlag_OVR(adc) || (status == 0)) {
799+
#else
800+
if (status == 0) {
801+
#endif /* !defined(CONFIG_SOC_SERIES_STM32F1X) */
798802
data->samples_count = data->channel_count;
799803
data->buffer += data->channel_count;
800804
/* Stop the DMA engine, only to start it again when the callback returns
@@ -803,7 +807,9 @@ static void dma_callback(const struct device *dev, void *user_data,
803807
* within adc_context_start_sampling
804808
*/
805809
dma_stop(data->dma.dma_dev, data->dma.channel);
810+
#if !defined(CONFIG_SOC_SERIES_STM32F1X)
806811
LL_ADC_ClearFlag_OVR(adc);
812+
#endif /* !defined(CONFIG_SOC_SERIES_STM32F1X) */
807813
/* No need to invalidate the cache because it's assumed that
808814
* the address is in a non-cacheable SRAM region.
809815
*/
@@ -1087,7 +1093,9 @@ static int start_read(const struct device *dev,
10871093
*/
10881094
adc_stm32_enable(adc);
10891095

1096+
#if !defined(CONFIG_SOC_SERIES_STM32F1X)
10901097
LL_ADC_ClearFlag_OVR(adc);
1098+
#endif /* !defined(CONFIG_SOC_SERIES_STM32F1X) */
10911099

10921100
#if !defined(CONFIG_ADC_STM32_DMA)
10931101
#if defined(CONFIG_SOC_SERIES_STM32F0X) || \

0 commit comments

Comments
 (0)