Dual regular simultaneous mode ADC triggered from timer 4 using DMA1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-06-26 5:32 AM
Hello all,
I have cube 4.25.1 installed and I'm using stm32f303 mcu.
What I have to do is to read 5 analog channels with ADC1 and 5 analog channel with ADC2 triggered from timer 4 counting.
I read application note An3116 and it said that it is possible to trigger simultaneus reading of sequence of channel.
I used the cube configuration attached:
than after the hardware inizialization is performed the instruction below:
HAL_ADC_Start(&hadc2);
HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t*)adc_array, sizeof(adc_array));where adc_array is 32 bit array is a 5 item array.
Is there some error in the configuration or in the ADC start command?
Is there some software example using the new stm32 hal library?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-06-26 6:51 AM
I am only using a single channel, but this is my init code
typedef enum {
Rs8_Ad1, Rs5_Ad5, Rs1_Ad6, Rs2_Ad7, Rs3_Ad8, Rs4_Ad9, CurrentSense_Ad13, Rs6_Ad14, Rs7_Ad15, VTemp_Ad16, VRef_Ad17, VBat_Ad18, ADC_ChannelCount, // channels count} ADCresultsAveColumn_t; HAL_ADC_Start_DMA(&hadc, (uint32_t *)ADC_DMABuffer, ADC_ChannelCount);- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-06-26 8:59 AM
Your ADC DMA is set to transfer Words at 32bit, my code the DMA transfers Half-Words.
I never used that processor sorry,
but under ADC properties, ranking, with sampling at 1.5 cycles,
that's as fast as it goes, it will be unstable and drifting around and incorrect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-06-26 9:30 AM
Hello TJ,
when
multimode.Mode = ADC_DUALMODE_REGSIMULT;
I checked the post below and in order to start the conversion uses my same functions:
https://community.st.com/0D50X00009XkY98SAF
For the sampling time I can try to increase and Let you know the result.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-06-26 9:59 AM
I tried increasing the sample time but it doesn't seem to be the problem.
Do you know if there is some adc software example where task are performed using the new HAL library
cubemx 4.25.1 or later?I found some example but they all uses old HAL library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-06-28 1:07 AM
somebody has some hints related to this problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-06-28 6:46 PM
Hi, sorry to be a bit busy...
Did you notice in your ICO file that the ADC config DMA is moving 32 bits ?
it is supposed to be 16 bits...
Are you seeing any data ?
