cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-L053R8 unable to configure ADC to read multiple channels

Kariopolis
Associate

Hello,

I am trying to read multiple ADC channels using DMA. However, I cannot find scan mode configuration and rank selection in settings when I am setting up ADC on this particular board. Is there a way to set thrm up or any other way to read multiple channels at once?

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Hello,

The scan mode is there but there is no ranking configuration on this device like other STM32 like STM32F4.

The scan mode can be Forward or Backward. 

  AdcHandle.Init.ScanConvMode          = ADC_SCAN_DIRECTION_FORWARD;
#define ADC_SCAN_DIRECTION_FORWARD        (0x00000001U)        /*!< Scan direction forward: from channel 0 to channel 18 */
#define ADC_SCAN_DIRECTION_BACKWARD       (0x00000002U)        /*!< Scan direction backward: from channel 18 to channel 0 */

 In ADC_CHSELR register if the corresponding channel bit is set, the channel will be part of the scan.

So if for example select CH0 and CH1 to be converted with  Forward  set the sequence will be CH0, CH1

If Backward is selected the sequence will be CH1 then CH0.

refer to the RM0377 rev 10/ section 13.3.8 Channel selection (CHSEL, SCANDIR)

SofLit_1-1716309641300.png

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
SofLit
ST Employee

Hello,

The scan mode is there but there is no ranking configuration on this device like other STM32 like STM32F4.

The scan mode can be Forward or Backward. 

  AdcHandle.Init.ScanConvMode          = ADC_SCAN_DIRECTION_FORWARD;
#define ADC_SCAN_DIRECTION_FORWARD        (0x00000001U)        /*!< Scan direction forward: from channel 0 to channel 18 */
#define ADC_SCAN_DIRECTION_BACKWARD       (0x00000002U)        /*!< Scan direction backward: from channel 18 to channel 0 */

 In ADC_CHSELR register if the corresponding channel bit is set, the channel will be part of the scan.

So if for example select CH0 and CH1 to be converted with  Forward  set the sequence will be CH0, CH1

If Backward is selected the sequence will be CH1 then CH0.

refer to the RM0377 rev 10/ section 13.3.8 Channel selection (CHSEL, SCANDIR)

SofLit_1-1716309641300.png

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Muhammed Güler
Senior III

It just lacks the hardware to change the channel order. There is nothing stopping you from implementing multi channel ADC. Data read from DMA is sorted according to ADC channel number.