[riot-devel] STM32l1xx Internal ADC Channels

Oleg Artamonov oleg at unwds.com
Wed Dec 21 21:51:18 CET 2016


Hi Francisco,

 

We did it a while ago, it's quite easy.

 

https://github.com/unwireddevices/RIOT/blob/master/cpu/stm32l1/periph/adc.c

https://github.com/unwireddevices/RIOT/blob/master/cpu/stm32l1/include/perip
h_cpu.h

 

1)      In board.h configure internal ADC channels with GPIO_UNDEF pin

 

#define ADC_CONFIG {            \

    { GPIO_PIN(PORT_A, 1), 1 },\

    { GPIO_PIN(PORT_A, 2), 2 },\

    { GPIO_PIN(PORT_A, 3), 3 },\

    { GPIO_PIN(PORT_A, 4), 4 },\

    { GPIO_PIN(PORT_A, 5), 5 },\

    { GPIO_PIN(PORT_A, 6), 6 }, \

    { GPIO_PIN(PORT_A, 7), 7 }, \

    { GPIO_UNDEF, ADC_VREF_CHANNEL}, \

    { GPIO_UNDEF, ADC_TEMPERATURE_CHANNEL}, \

}

 

2)      In adc.c do not initialize GPIO if it equals GPIO_UNDEF (lines
87-90)

3)      In adc.c before accessing internal lines, wake up sensor and Vref
(lines 171-174), after getting data disable it (lines 206-207)

 

That's it.

 

--

Oleg Artamonov

+7 (916) 631-34-90

www.unwds.com

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20161221/6511e855/attachment.html>


More information about the devel mailing list