Re: [riot-devel] STM32l1xx Internal ADC Channels

2016-12-21 Thread Oleg Artamonov
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

 

 

___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


[riot-devel] STM32l1xx Internal ADC Channels

2016-12-16 Thread Francisco Molina
Hi,

I have been working with the STM32L151RC uc and would like to read two of
it's internal ADC channels. The problem is RIOT present implementation por
the ADC only takes into account external ADC lines, witch means it require
a GPIO assignment. What would be the best way of implementing this? a new
function in the adc lib that doesn't need a GPIO assignment or implement
this a a CPU function since these internal ADC channels are used to get
internal voltage references and such. Best regards,

Francisco Molina
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel