cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L051/STM32L053 adc multichannel

joel239955
Associate
Posted on December 15, 2014 at 14:24

hi everyone,

are there any examples how to read individual adc values on more than one channel for the stm32l051/stm32l053 microcontroller. i'm using the stm32l0538 discovery board and i also checked the examples in STM32Cube_FW_L0_V1.1.0 which read adc values only on a single channel.

#adc #stm32l0x #stm32l053 #brought-to-you-by-microsoft(tm) #stm32l0 #internal-temperature-sensor
7 REPLIES 7
Posted on January 20, 2015 at 09:17

Hi,

Please find attached an example (from STM32L0 firmware package V1.1.0) showing how to use the ADC sequencer: in this example, 3 channels are converted sequentially (1 channel on external pin, 2 channels on internal measurement path: VrefInt and temperature sensor).

This example is running on STM32L053R8-Nucleo, and willbe included in the next STM32L0 firmware package release.

Regards,

Heisenberg.

________________

Attachments :

Example_ADC_Sequencer_STM32L053R8-Nucleo.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzHJ&d=%2Fa%2F0X0000000bLN%2F9tBKDDxKeD5TfyWRGtI2kfjVW9Vv0druVh0VBqYQOLw&asPdf=false
ace_koko2000
Associate
Posted on March 08, 2015 at 07:34

Posted on March 08, 2015 at 15:17

The forum doesn't support mobile devices, please try again.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
toban626
Associate
Posted on April 02, 2015 at 08:48

Hi,

I'm also interested in the ADC sequencer.

I have now modified the example to run on my STM32L0538-DISCO (discovery) board. I read channel 0, 4, VREFINT (17) and TEMPSENSOR (18). All channels except the temp sensor shows valid data. The temp sensor channel is stuck at AD value around 5 I have cooled the CPU with cold spray so I'm sure that I should read some other values than 598-600.

The only difference that I can see from the example you posted is the ADC clock prescaler:

MY CODE:

AdcHandle.Init.ClockPrescaler = ADC_CLOCKPRESCALER_PCLK_DIV2;

EXAMPLE CODE:

AdcHandle.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;

When using ASYNC_DIV1 I can't calibrate the ADC. As all other channels are working I thought that I would get the temperature sensor working as well, but now I feel I'm a bit stuck.

I also tried to configure the system configuration controller. The Reference control and status register (REF_CFGR3) bit 0 shall be used to switch on the VREFINT and temperature sensor. I'm a bit confused why this is not done in the example code, but I assume that it is done by enabling the temperature sensor in the ADC configuration (TSEN=1). So the system configuration controller is not needed to be used?

I have also tried with different sampling times but with no success.

Do you have any idea why the temperature measurement fails?

Thanks

________________

Attachments :

Src.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzNW&d=%2Fa%2F0X0000000bLJ%2FB0jdCMC1tQdXrzKE1RP9lPrd6Vp2i_3VzA_ZoZTm6uo&asPdf=false
foujanet
Associate II
Posted on February 02, 2017 at 13:42

Hi all!

Do you have a solution to measure the correct VDDa with the VrefInt?

Do you find a solution for STM32L0xx?

thanks

Posted on February 03, 2017 at 09:27

Hi Guillaume,

Did you tried the suggested examples in this discussion? What is exactly the problem you are facing?

It should be better to create a new discussion where you precise used environment, the tests you made and results you get.

-Amel

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.

LRPS_92
Associate II
Posted on March 27, 2017 at 17:14

Hi everyone,

                I've tried to read mutliple channels using the same code produced here. But my code struks at HAL_ADC_Start_DMA() this point during initialization. What willl be the reason for the code to hang in Start_DMA ??