Page 1 of 1

STM32F303x8 has 2 ADCs (STM32F3xx/stm32_rcc.h issue)

Posted: Thu May 05, 2016 9:54 am
by Dwar
Found a problem trying to add ADC to the Nucleo-32 demo with the trunk. The F303K8T6 has 2 ADCs

1) halconf.h: #define HAL_USE_ADC TRUE
2) mcuconf.h: #define STM32_ADC_USE_ADC1 TRUE

See these errors when compiling:

Code: Select all

In file included from ../../../os/hal/ports/STM32/STM32F3xx/hal_lld.h:1149:0,
                 from ../../../os/hal/include/hal.h:32,
                 from ../../../os/hal/ports/STM32/LLD/ADCv3/adc_lld.c:25:
../../../os/hal/ports/STM32/LLD/ADCv3/adc_lld.c: In function 'adc_lld_stop':
../../../os/hal/ports/STM32/STM32F3xx/stm32_rcc.h:227:43: error: 'RCC_AHBENR_ADC3EN' undeclared (first use in this function)
 #define rccDisableADC34(lp) rccDisableAHB(RCC_AHBENR_ADC3EN, lp)
                                           ^
../../../os/hal/ports/STM32/STM32F3xx/stm32_rcc.h:147:20: note: in definition of macro 'rccDisableAHB'
   RCC->AHBENR &= ~(mask);                                                   \
                    ^
../../../os/hal/ports/STM32/LLD/ADCv3/adc_lld.c:733:7: note: in expansion of macro 'rccDisableADC34'
       rccDisableADC34(FALSE);
       ^
../../../os/hal/ports/STM32/STM32F3xx/stm32_rcc.h:227:43: note: each undeclared identifier is reported only once for each function it appears in
 #define rccDisableADC34(lp) rccDisableAHB(RCC_AHBENR_ADC3EN, lp)
                                           ^
../../../os/hal/ports/STM32/STM32F3xx/stm32_rcc.h:147:20: note: in definition of macro 'rccDisableAHB'
   RCC->AHBENR &= ~(mask);                                                   \
                    ^
../../../os/hal/ports/STM32/LLD/ADCv3/adc_lld.c:733:7: note: in expansion of macro 'rccDisableADC34'
       rccDisableADC34(FALSE);
       ^
make: *** [build/obj/adc_lld.o] Error 1


In STM32F3xx/stm32_rcc.h the macro definition assumes 3 or more ADCs are present:

Code: Select all

#if defined(RCC_AHBENR_ADC34EN) || defined(__DOXYGEN__)
#define rccDisableADC34(lp) rccDisableAHB(RCC_AHBENR_ADC34EN, lp)
#else
#define rccDisableADC34(lp) rccDisableAHB(RCC_AHBENR_ADC3EN, lp)
#endif

Re: STM32F303x8 has 2 ADCs (STM32F3xx/stm32_rcc.h issue)

Posted: Thu May 05, 2016 9:56 am
by RoccoMarco
I'll take a look to this and eventually fix it. Thanks.

Re: STM32F303x8 has 2 ADCs (STM32F3xx/stm32_rcc.h issue)  Topic is solved

Posted: Thu May 05, 2016 6:55 pm
by RoccoMarco