STM32F103C8T6 ADC1 + DMA reading gets corrupted when starting ADC2 conversion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-04 06:02 AM
Hi,
I'm almost new to the STM32 and have the following question:
I'm triggering multichannel ADC1 conversions using timer 1 and storing the readings in a buffer using the DMA. It works fine until I configure ADC2 (which doesn't support DMA) to be triggered by timer 2. The sole addition of HAL_ADC_Start(&hadc2); or HAL_ADC_Start_IT(&hadc2); at the beginning of the code causes corrupted readings from ADC1+DMA. What am I doing wrong? Is it possible to trigger other ADCs while using DMA with another channel?
Thanks in advance
- Labels:
-
ADC
-
STM32F1 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-04 06:31 AM
Yes it's possible. Could be overloading DMA, what is your sample rate? What does "corrupted" mean exactly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-04 07:30 AM
Hi, TDK
Thank you for the answer, The readings go from:
to only by adding HAL_ADC_Start(&hadc2);
the sample is triggered in the second event of a capture compare running at 20Khz, so I suppose the sample rate is 10Khz
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-04 07:31 AM
Hi, TDK
Thank you for the answer, The readings go from:
to
only by adding HAL_ADC_Start(&hadc2);
the sample is triggered in the second event of a capture compare running at 20Khz, so I suppose the sample rate is 10Khz
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-04 08:37 AM
Changing DMA to Half Word and, consequently, the buffer data type to 16 bits did the trick. Still don't know why Thanks!