Author Topic: STM8 ADC multi-channel scan mode  (Read 6851 times)

0 Members and 1 Guest are viewing this topic.

Offline HwAoRrDkTopic starter

  • Super Contributor
  • ***
  • Posts: 1456
  • Country: gb
STM8 ADC multi-channel scan mode
« on: April 21, 2017, 02:42:23 pm »
I have been investigating the STM8S range for use instead of an ATmega328P in a project of mine. (Gotta love the fact they're half the price, even in single-digit quantities. ;D)

Was looking in the reference manual at the ADC capabilities, and the multi-channel scan mode caught my eye as being something that might be very handy. But I have a couple of queries:

- Is multi-channel scan mode only capable of scanning from AIN0 upwards? That is, you can't start from, for example, AIN3? That seems rather inflexible in terms of pin usage.
- Can scan mode definitely be used in conjunction with conversion triggering from timer? It would seem logically possible by just setting both SCAN and EXTSEL of ADC_CR2 appropriately, but you never know with these things, so I thought I'd check.
 

Offline HwAoRrDkTopic starter

  • Super Contributor
  • ***
  • Posts: 1456
  • Country: gb
Re: STM8 ADC multi-channel scan mode
« Reply #1 on: April 22, 2017, 10:49:06 am »
Anyone?
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3452
  • Country: it
Re: STM8 ADC multi-channel scan mode
« Reply #2 on: April 22, 2017, 10:56:45 am »
state the part, link to datasheet please.
 

Offline HwAoRrDkTopic starter

  • Super Contributor
  • ***
  • Posts: 1456
  • Country: gb
Re: STM8 ADC multi-channel scan mode
« Reply #3 on: April 22, 2017, 11:39:40 am »
I'm considering the STM8S105 or STM8S005. The datasheets don't have that information, and the reference manual isn't particularly explicit - that's why I'm asking. :)
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3452
  • Country: it
Re: STM8 ADC multi-channel scan mode
« Reply #4 on: April 22, 2017, 12:56:20 pm »
I think it means that it will sample and convert from IN0 to INn so no you can't. Maybe you want it like on certain pics where you select which channels to scan. could be only IN2 and IN9 for example
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4067
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: STM8 ADC multi-channel scan mode
« Reply #5 on: April 22, 2017, 02:11:44 pm »
Look in the reference manual. (RM0016)
1. From AIN0 only.
Quote
A single conversion is performed for each channel starting with AIN0 and the data is stored
in the data buffer registers ADC_DBxR. When the last channel (channel ā€˜nā€™) has been
converted, the EOC (End of Conversion) flag is set and an interrupt is generated if the
EOCIE bit is set.
Where channel 'n' is defined in CH[3:0].

Other variants of ST ADC's feature sequence registers, see it as a playlist you can set for channels. Or scan mode from low to high with a mask register. Where only the enabled channels are in the scan. But the STM8 you mentioned do not have this.
Get an STM32's for more advanced ADC.

2. You can start the scan from a trigger.
« Last Edit: April 22, 2017, 02:13:40 pm by Jeroen3 »
 

Offline HwAoRrDkTopic starter

  • Super Contributor
  • ***
  • Posts: 1456
  • Country: gb
Re: STM8 ADC multi-channel scan mode
« Reply #6 on: April 22, 2017, 02:38:55 pm »
Thank you.

I had seen that paragraph from the reference manual, but for some reason my first impression was that they were giving an example, not stating a limitation. But it seemed too inflexible to be of the greatest utility, so I had my doubts as to whether they really meant it.

Of course, had I looked at the register reference a bit closer, it would probably have dawned on me that there is otherwise no way to specify a scan sequence/mask/etc. like you say there is on the STM32, so therefore it must be limited to AIN0 as a start point. ::)

I suppose it's not so much of a bother if you're using the 48- or 44-pin versions.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf