Eddie !! I have been fighting a problem for a week now regarding my ADC1 converting 7 regular sequence channels through DMA and wondering WHY my ADC output array shifts the ADC results into different array indexes ! Your usage of L{3:0} showed me that a value of 000 really means ONE (1) CONVERSION !! I KNEW my problem had to be a mis-match of DMA and ADC1 conversion/transfer values. THANK YOU THANK YOU THANK YOU !!!!! boB
Hello! I'm facing the same problem despite configuring the sequence length for 3 conversions(0010) and making the count value in DMA channel as 3 (DMA1_Channel1->CNDTR=3;). The values are not getting printed as per the array index value. Could you please help me with this?
Great tutorial! It's really helping me, going from AVR Assembly World to STM. Things are much clearer when someone shows the minimum set of particular steps to implement one function or another. At this point I just cannot see how HAL or LL libraries can simplify the life of a new developer, because besides getting familiar with what each bit in registers does, one also need to skim through at least half of 4500 pages manual on HALL/LL to wrap his/her head around all the functions names and thier arguments that ST came up with. Your approach is more thrrough that most of STM tutorials on UA-cam. Keep making your videos, they are really great! BIG THUMBS UP =)
HAL is a mess in my opinion. It's simply too verbose and ugly, unreadable. Try libopencm3 if you want some wrapper, but not that much. The code actually looks way more like C, and it doesn't abstract away to much, it is like more descriptively named wrapper functions for accessing the registers. HW abstraction at deeply embedded level isn't that useful anyway.
Thank you very much for your another excellent video, i have implemented this code, its working fine. we wish that you should make more videos on this stm32f103c8 microcontroller. with different sensors and modules , like OLED with I2C , and other sensors.
If you have multiple channels in scan mode enabled, and you were to read the adc DR register, how do you know which channel that data corresponds to? BTW, any thoughts on using St's CubeMx/HAL to implement some of the code? For example, in CubeMx you can add a DMA for the ADC and enable continuous, scan mode. The user code would just be something like: HAL_ADC_Start_DMA (&hadc3, pBuff, uLen);
Well you as the programmer should know where your program is and what channel it is currently converting. Keep track of "end of conversion flags" but that is more of a race condition so I would most absolutely ALWAYS use DMA when scan and continuous are enabled. And as far as using HAL for some of the code it's all up to you and your programming style , that HAL function will jump to 10 other functions of error checking and other things until I finally ends up running the same exact code I am typing here, so with HAL you always end up with bigger code size but you have added security that it knows exactly what settings to do, even if you have no clue lol
Do you have the code for the projects in the video. I would like to study the code after watching the video to reenforced my understanding of the video presentation.
Hi Eddie, is there any interrupt which can be triggered to indicate the DMA transfer is complete, before going again in circular mode. I was wondering how do we ensure the consistency of data, if we were to read it whenever we like.
hi, how can I use analog watchdog to monitore the ADC DRegister? (I'm working with stm32f303) ADC1->IER|=ADC_IER_AWD1; ADC1->CFGR|=ADC_CFGR_AWD1SGL; ADC1->CFGR|=ADC_CFGR_AWD1EN; NVIC->ISER[0]|=1
EDDIE CAN U SHOW HOW TO SEND THE ADC VALUE VIA UART? I TRIED SENDING THE ADC READ VARIABLE AND I'M JUST GETTING A BLANK SPACE DISPLAYED IN THE CONSOLE.
Because maybe your sending the value as an ASCII. So if the value is 65 for example is will display the letter A, so that's a fun programming exercise for you to work on lol
Perhaps, though I can't think of how right now. And how you would know which channel you're reading at any given time and you'd have to constant interrupt to do something with the data ... What would the excuse for not using DMA be?
Hey Eddie, I've been trying to replicate this on an STM23F4 nucleo board and I've been having some problems, the first value transfers and then the board writes the OVR bit and disables both the ADC and DMA? Any advice would be appreciated
have you tried slowing down the conversions, is your SystemCore clock running fast enough, are other interrupts with higher priority going on etc... something is not letting the DMA service the ADC fast enough .. interesting dilemma you have let me know when you find a solution.. id like to hear it
there is a facebook group " STM32 developers" , i am there and a lot of smart guys too so maybe post the question there, let me know if you request admission and ill tell the admit to add you
been doing some research and it could be a DMA peripheral error or bug. Try a different DMA 1 or DMA2 set priority to high.. just throwing things out there at this point lol
@@EdwinFairchild Thanks for all the useful tips, my program is pretty barebones as I am working it up to final complexity and the sensor polling is the first part I'm working on. The ADC is running at 22.5 MHz, SystemCore at 180MHz.. I have no other interrupts (that I know of). I have been able to get the system to work using the SPL libraries but I can't see what is different between the final register settings between my two programs. I have sent an app to the facebook group, my name on facebook is Dhruv Goel
@@EdwinFairchild Im new to this. Can you explain how can i set my core speed to 72MHz using PLL? because my MCU is running at 8MHz, since i didnt change it.
Never thought I’d find a video that makes DMA look easy for ADC, thanks for such a good video!
Eddie !! I have been fighting a problem for a week now regarding my ADC1 converting 7 regular sequence channels through DMA and wondering WHY my ADC output array shifts the ADC results into different array indexes !
Your usage of L{3:0} showed me that a value of 000 really means ONE (1) CONVERSION !! I KNEW my problem had to be a mis-match of DMA and ADC1 conversion/transfer values.
THANK YOU THANK YOU THANK YOU !!!!!
boB
Hello! I'm facing the same problem despite configuring the sequence length for 3 conversions(0010) and making the count value in DMA channel as 3 (DMA1_Channel1->CNDTR=3;). The values are not getting printed as per the array index value. Could you please help me with this?
Great tutorial! It's really helping me, going from AVR Assembly World to STM. Things are much clearer when someone shows the minimum set of particular steps to implement one function or another. At this point I just cannot see how HAL or LL libraries can simplify the life of a new developer, because besides getting familiar with what each bit in registers does, one also need to skim through at least half of 4500 pages manual on HALL/LL to wrap his/her head around all the functions names and thier arguments that ST came up with.
Your approach is more thrrough that most of STM tutorials on UA-cam.
Keep making your videos, they are really great!
BIG THUMBS UP =)
sad but true. That is the reason why arduino has so much more space among embedded newbies
HAL is a mess in my opinion. It's simply too verbose and ugly, unreadable.
Try libopencm3 if you want some wrapper, but not that much. The code actually looks way more like C, and it doesn't abstract away to much, it is like more descriptively named wrapper functions for accessing the registers.
HW abstraction at deeply embedded level isn't that useful anyway.
Excellent video and programming style.
Thanks, subscribe!!
Thank you very much for your another excellent video, i have implemented this code, its working fine. we wish that you should make more videos on this stm32f103c8 microcontroller. with different sensors and modules , like OLED with I2C , and other sensors.
An excellent presentation, and very useful !
Great, you saved my day;)
any chance you could publish the code somewhere I could look over?
If bucky roberts (the new boston) had a twin, it would have been you :D
Can you show adcwatchdog with timers enabled to get the period or frequency of an analog signal. That would be helpful
If you have multiple channels in scan mode enabled, and you were to read the adc DR register, how do you know which channel that data corresponds to?
BTW, any thoughts on using St's CubeMx/HAL to implement some of the code? For example, in CubeMx you can add a DMA for the ADC and enable continuous, scan mode. The user code would just be something like: HAL_ADC_Start_DMA (&hadc3, pBuff, uLen);
Well you as the programmer should know where your program is and what channel it is currently converting. Keep track of "end of conversion flags" but that is more of a race condition so I would most absolutely ALWAYS use DMA when scan and continuous are enabled. And as far as using HAL for some of the code it's all up to you and your programming style , that HAL function will jump to 10 other functions of error checking and other things until I finally ends up running the same exact code I am typing here, so with HAL you always end up with bigger code size but you have added security that it knows exactly what settings to do, even if you have no clue lol
next video about adc watchdog ? :D it would be very helpfull
Do you have the code for the projects in the video. I would like to study the code after watching the video to reenforced my understanding of the video presentation.
Sorry man at the time of these videos I was not saving any of it
Hi Eddie, is there any interrupt which can be triggered to indicate the DMA transfer is complete, before going again in circular mode. I was wondering how do we ensure the consistency of data, if we were to read it whenever we like.
Yes there is an interrupt for complete and half complete
hi, how can I use analog watchdog to monitore the ADC DRegister? (I'm working with stm32f303)
ADC1->IER|=ADC_IER_AWD1;
ADC1->CFGR|=ADC_CFGR_AWD1SGL;
ADC1->CFGR|=ADC_CFGR_AWD1EN;
NVIC->ISER[0]|=1
Hello Eddie have you done a tutorial on the DAC per chance?
I have not actually but i MUST!! soon!
@@EdwinFairchild it's really helped me but I'm sure you're busy frying other fish and have loads of other requests!
@@brushhead no lie I was legit making some fish tacos 😂😂
EDDIE CAN U SHOW HOW TO SEND THE ADC VALUE VIA UART? I TRIED SENDING THE ADC READ VARIABLE AND I'M JUST GETTING A BLANK SPACE DISPLAYED IN THE CONSOLE.
Because maybe your sending the value as an ASCII. So if the value is 65 for example is will display the letter A, so that's a fun programming exercise for you to work on lol
;)
Can this(scan mode, continuous ) be done without using DMA transfers?
Perhaps, though I can't think of how right now. And how you would know which channel you're reading at any given time and you'd have to constant interrupt to do something with the data ... What would the excuse for not using DMA be?
how you do the printMsg stuff?? Whith USART right? By pooling or interruption?
Yes I have a tutorial on it on my channel you can find it if you go to my channel
Hey Eddie, I've been trying to replicate this on an STM23F4 nucleo board and I've been having some problems, the first value transfers and then the board writes the OVR bit and disables both the ADC and DMA? Any advice would be appreciated
I'll get back to you on that, I would have to check out the f4 RM and I'm not home right now
have you tried slowing down the conversions, is your SystemCore clock running fast enough, are other interrupts with higher priority going on etc... something is not letting the DMA service the ADC fast enough .. interesting dilemma you have let me know when you find a solution.. id like to hear it
there is a facebook group " STM32 developers" , i am there and a lot of smart guys too so maybe post the question there, let me know if you request admission and ill tell the admit to add you
been doing some research and it could be a DMA peripheral error or bug. Try a different DMA 1 or DMA2 set priority to high.. just throwing things out there at this point lol
@@EdwinFairchild Thanks for all the useful tips, my program is pretty barebones as I am working it up to final complexity and the sensor polling is the first part I'm working on. The ADC is running at 22.5 MHz, SystemCore at 180MHz.. I have no other interrupts (that I know of). I have been able to get the system to work using the SPL libraries but I can't see what is different between the final register settings between my two programs. I have sent an app to the facebook group, my name on facebook is Dhruv Goel
Where is part2?
on my channel
@@EdwinFairchild Im new to this. Can you explain how can i set my core speed to 72MHz using PLL? because my MCU is running at 8MHz, since i didnt change it.
@@KhalidMBakhit go To edwinfairchild.com I have a tutorial on how to do it for stm32L0 should be similar to f1
@@KhalidMBakhit if you are using keil theit is a function to do it too
@@EdwinFairchild yes I am using keil.