Skip to content

[Bug]: Unexpected behavior of LL_ADC_SetAnalogWDMonitChannels with AWD2 & AWD3 #72

Description

@basilegrunersmile

Bug Summary

The function LL_ADC_SetAnalogWDMonitChannels doesn't work as expected with AWD2 & AWD3

Detailed Description

Description of the function state that :

Multiple channels can be selected. For example:
(LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)

First, there is typos in this description (LL_ADC_AWD_CHANNEL4_REG_INJ instead of LL_ADC_AWD_CHANNEL_4_REG_INJ ).

Second, when calling for example:
LL_ADC_SetAnalogWDMonitChannels(adc1, LL_ADC_AWD2, LL_ADC_AWD_CHANNEL_4_REG_INJ | LL_ADC_AWD_CHANNEL_5_REG_INJ);

LL_ADC_AWD_CHANNEL_4_REG_INJ = 0x11c00000
LL_ADC_AWD_CHANNEL_5_REG_INJ = 0x15c00000
0x11c00000 | 0x15c00000 = 0x15c00000 = LL_ADC_AWD_CHANNEL_5_REG_INJ

The function ends up setting monitoring for channel 5 only.
And if we try to set monitoring for channels 5 and 6, it ends up setting monitoring for channel 7.

In LL macros for later SoC series such as stm32n6, macros LL_ADC_AWD_CHANNEL_n_REG_INJ include bit field for channel n (0x1UL << n, also available as ADC_CHANNEL_n_BITFIELD) and this bit field is used to set correct channel monitoring for AWD2 & AWD3.

Expected Behavior

No response

Actual Behavior

No response

Environment

Zephyr 4.4.99, Linux

Severity

Normal

Metadata

Metadata

Assignees

Labels

adcAnalog-to-Digital ConverterbugSomething isn't workinghalHAL-LL driver-related issue or pull-request.

Type

Fields

No fields configured for Bug.

Projects

Status
To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions