1

The HAL for my stm32f10x provides an adc interface with the following mode selector by enabling ScanConvMode, which determines whether multiple channels or a single one are processed by the ADC, or just a single one

For multi-channel adc reading (scan mode), there is an interface to provide a sequence to order how the multiple channels are read. With this interface you can initialize each channel with a sequence number for which they will be converted in ascending order.

My question is, if you assign a channel to 0, will it be ignored? And if you have discontinuities in your adc ranks, (say 1-5, 8, 9, 16) will these be read in the correct order? The docs are very unclear on this

I have up to 16 channels which I want to read by multi-channel scan, for which I don't care about the order, but I want to be able to toggle them off and on as I need them so that any given time I am not making more conversions than I need to.

Relevant information

uint32_t ScanConvMode If enabled: Conversions are performed in sequence mode (multiple ranks defined by 'NbrOfConversion'). Scan direction is upward: from rank1 to rank 'n'. This parameter can be a value of ADC_Scan_mode

uint32_t Rank Specifies the rank in the regular group sequencer This parameter can be a value of ADC_regular_rank Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel setting (or parameter number of conversions can be adjusted)

2 Answers2

0

Rank defines the sequence/order of channels to be scanned. For example, rank 1 contains CH1, CH3 and CH5. Rank 2 contains CH4 and CH2. If rank 2 is activated, CH4 will be scanned and then CH2. Please correct me if I'm wrong.

guest
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 20 '23 at 14:04
0

sorry, I'm wrong. Ranks define sequence/order of channels to be scanned. In scan mode, the channels assigned to higher ranks will be scanned in higher priority. Assign CH3 to rank 1, CH1 to rank 2, CH5 to rank 3. Scan order will be CH3, CH1 and CH5. Please counter check.

guest
  • 1