cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO Analog

Luiz Guilherme
Associate II
Posted on May 09, 2017 at 14:39

How use the analog port with the stm32l0538 disco using the hal library

#analog
9 REPLIES 9
RomainR.
ST Employee
Posted on May 09, 2017 at 16:20

Hello Luiz

Do you mean how to use the ADC peripheral or does your question concern the configuration of GPIOs in analog mode ?

Have you looked at the ADC examples for the STM32L053C8-Discovery board in your STM32Cube directory?

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.

Posted on May 09, 2017 at 19:00

Hi Romain 

My question is the comfiguration of GPIO in analog mode, and i not found examples for this

you can help me ?

Posted on May 09, 2017 at 19:23

STM32Cube_FW_L0_V1.8.0\Projects\STM32L053C8-Discovery\Examples\ADC\ADC_DMA_Transfer\Src\main.c

STM32Cube_FW_L0_V1.8.0\Projects\STM32L053R8-Nucleo\Examples\ADC\ADC_RegularConversion_Interrupt\Src\main.c

Bunch of examples, for DISCO and NUCLEO boards, review them

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 09, 2017 at 19:45

Ok i saw the examples, but i not found the analog output example

Posted on May 09, 2017 at 20:31

Your question wasn't that specific, look at the DAC examples then

STM32Cube_FW_L0_V1.8.0\Projects\STM32L053C8-Discovery\Examples\DAC\DAC_SimpleConversion\Src\main.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 09, 2017 at 21:20

i know the dac, but i want control a RGB led in different values established from the software 

ex.

Led Red 127

Led Green 55

Led Blue 255

And the stm32l0538 Disco has only one channel DAC

understood ?

Posted on May 09, 2017 at 23:56

May be it is poor choice of part for your application? Also the DAC doesn't drive the amount current you'd need for an LED.

Could you use a timer in PWM mode? Many of the TIM have 4 channels which can share a common period, with different pulse widths.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 10, 2017 at 10:30

Hi Luiz

The DAC is not suitable for this type of application.

I advise you to use 3 channels of a GP TIMER in PWM output mode with the HAL Library (as Clive One explains there are a multitude of examples)

Alternatively you can watch and try the MBed class below. Your STM32L053-Discovery is compatible with MBed Online.

https://developer.mbed.org/users/4180_1/notebook/rgb-leds/

 

Best regards

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.

Posted on May 10, 2017 at 14:41

Really i had forgotten the PWM Thanks