Page 1 of 1
STM32F303k8 and ADC2/DMA2
Posted: Mon Nov 07, 2016 4:26 pm
by davidji
If I enable ADC2 in mcuconf.h and add adcStart(&ADCD2, NULL) into main in the demo, the demo crashes. If I do the same with ADC1, then everything keeps running.
It looks like that's because as far as stm32_registry.h, STM32F303x8 has no DMA2.
Is that reasonable? Do I just need to add values for it?
Cheers
David
Re: STM32F303k8 and ADC2/DMA2
Posted: Mon Nov 07, 2016 5:02 pm
by Giovanni
Hi,
That device only has DMA1 so modifying the registry is pointless.
You should enable assertions, checks and state checker and then look at the message passed to chSysHalt() after the system stopped.
Giovanni
Re: STM32F303k8 and ADC2/DMA2
Posted: Mon Nov 07, 2016 6:54 pm
by davidji
I think in that case the problem is that DMA1/channel 2 isn't listed as a valid option for ADC2, and so won't compile for that setting. I think that's the only other option:
../../../os/hal/ports/STM32/LLD/ADCv3/adc_lld.h:512:2: error: #error "invalid DMA stream associated to ADC2"
#error "invalid DMA stream associated to ADC2"
Re: STM32F303k8 and ADC2/DMA2
Posted: Mon Nov 07, 2016 7:42 pm
by Giovanni
Hi,
It is a bug, moving this topic under "bug reports" for handling.
In the meanwhile you can change this:
Code: Select all
#define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1) |\
STM32_DMA_STREAM_ID_MSK(2, 3))
this way:
Code: Select all
#define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2))
Make sure to change it for F303x8 only, the others are correct.
Giovanni
Re: STM32F303k8 and ADC2/DMA2
Posted: Mon Nov 07, 2016 11:05 pm
by davidji
That works for me. Thanks for your help!
Re: STM32F303k8 and ADC2/DMA2
Posted: Tue Nov 15, 2016 11:34 am
by Giovanni
Hi,
Fixed as bug #790.
Giovanni