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
STM32F303k8 and ADC2/DMA2 Topic is solved
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: STM32F303k8 and ADC2/DMA2
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
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
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"
../../../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"
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: STM32F303k8 and ADC2/DMA2
Hi,
It is a bug, moving this topic under "bug reports" for handling.
In the meanwhile you can change this:
this way:
Make sure to change it for F303x8 only, the others are correct.
Giovanni
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
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times