Thanks for your reply, You select regular or Circular buffer in a dropdown menu when enabling DMA for your peripheral. If you dont find it let me know. You acan also ofcourse enable it yourself in code if you dont prefer CubeMX do do the work for you. /PR TechTalk
Their is no advantage of that. Using 32bit variable to store a 12 bit value then remaining bits are wasted. So to conserve memory its better to declare halfword instead. /PR Tech talk
Thank you for your comment! I'm glad you found the tutorial helpful. Unfortunately, I don't have any plans to cover the LL library at the moment, but you never know so stay tuned :-)
hello! this tutorial is awesome! an interesting aspect regarding the reading of the Vbat would be to be able to include the reading of the Vbat only every now to preserve its charge (usually I read it once every hour), it is possible to programmatically disconnect the reading leaving the number of conversions (rank) unchanged so that I don't have to worry about restructuring the length of the DMA buffer? (i am assuming to use the 20+ buffer to check and managed the value only after a couple of compleate reading). best reguards!
If i understand your application correct you have a set of ADC channels you regulary sample and only the Vbat you would like to sample less often. If this is the case the i would set a separate timer to trigger only the Vbat channel. /PR TechTalk
@@prtechtalk416 yes you understanded very well my application! i want to not discharge the battery with to much readings , so it is possible to have a dma based readings for all the channel except the vbat and a single channel software activated polling for the Vbat? how can be possible to select this method with the cube ? if i select scan mode isnt for ALL the channel? thank you!
Is it just me or STM32G0 series microcontroller ADC peripheral is noisier than the previous gen (STM32F0). Even in your video vref converted data readings are bouncing by few counts, but that voltage should be very stable in my opinion? In addition, I recently swapped STM32F051K4 for STM32G071K8 MCU. While using exact same ADC timing configuration I noticed that most of the sampled channel values are bouncing by +/-3. I performed a good few tests (different sequencer modes, longer sample times from 1.5 ADC clocks to 3.5 ADC clocks), but no success really. Another interesting observation is that by using 0.1% resistors (43K || 43K) to provide an offset in the differential amplifier circuit the measured offset is 2036 - 2038 counts which is 6 - 8 counts off from 2048. This is a repetitive result in at least 5 more boards that I tested, but it was NEVER a problem with F0 based MCU while using exact same components and very similar layout. I know that in F0 series MCUs had a dedicated VDDA that was decoupled, do you think that is the main different regarding the measurement accuracy consistency or is there something else at play?
Decoupling VDDA is for a reason to stabilise the analog circuits. But the downside is loosing pins that could be used for alternative funtions. You can also try to over sample and make an average to gain stability and more ENOB. /PR TechTalk
To sence AC voltage you need to know what you are looking to measure. PeakVoltage, RMS Voltage, Frequenzy. All have their way to be measured but all have in common you need to get several readings and then let your software do it´s magic to calculate the answer you are looking for. /PR TechTalk
The normal way to measure RMS AC voltage is to sample at a fixed rate (e.g., 1000 Hz for 50 Hz AC), capture enough samples to cover several periods, and then calculate the RMS directly from the data without worrying about the exact frequency. This assumes the frequency is stable enough for accurate results. If the frequenzy is not known or vary then you need to establish the frequenzy first. /PR TechTalk
This is fantastic! I've been working on ADC but didn't know how to implement multi-ADC DMA method. Thank you so much!! 👏
Thank you for your kind words! I'm glad I could assist you in implementing the multi-ADC DMA method. If you have any more questions, feel free to ask!
Really great video. I hope you continue. This is very educational. Thank you. Best wishes from Denmark!
Davs Morten,
Thanks for your kind words.
Pls hit the Subscribe button also :-)
/PR TechTalk
Excellent tutorial, what kind of change do I need to make to set the DMA to Circular mode?
Thanks for your reply, You select regular or Circular buffer in a dropdown menu when enabling DMA for your peripheral. If you dont find it let me know. You acan also ofcourse enable it yourself in code if you dont prefer CubeMX do do the work for you. /PR TechTalk
what is the advantage of using word instead of half word for 12 bit adc reading?
Their is no advantage of that.
Using 32bit variable to store a 12 bit value then remaining bits are wasted. So to conserve memory its better to declare halfword instead.
/PR Tech talk
Thank for this great tutorial,
Can you do it with the LL library please ?
Thank you for your comment! I'm glad you found the tutorial helpful. Unfortunately, I don't have any plans to cover the LL library at the moment, but you never know so stay tuned :-)
hello! this tutorial is awesome! an interesting aspect regarding the reading of the Vbat would be to be able to include the reading of the Vbat only every now to preserve its charge (usually I read it once every hour), it is possible to programmatically disconnect the reading leaving the number of conversions (rank) unchanged so that I don't have to worry about restructuring the length of the DMA buffer? (i am assuming to use the 20+ buffer to check and managed the value only after a couple of compleate reading). best reguards!
If i understand your application correct you have a set of ADC channels you regulary sample and only the Vbat you would like to sample less often. If this is the case the i would set a separate timer to trigger only the Vbat channel.
/PR TechTalk
@@prtechtalk416 yes you understanded very well my application! i want to not discharge the battery with to much readings , so it is possible to have a dma based readings for all the channel except the vbat and a single channel software activated polling for the Vbat? how can be possible to select this method with the cube ? if i select scan mode isnt for ALL the channel? thank you!
Why do you enable MSM bit? It is not related to what you want to achieve.
Is it just me or STM32G0 series microcontroller ADC peripheral is noisier than the previous gen (STM32F0). Even in your video vref converted data readings are bouncing by few counts, but that voltage should be very stable in my opinion? In addition, I recently swapped STM32F051K4 for STM32G071K8 MCU. While using exact same ADC timing configuration I noticed that most of the sampled channel values are bouncing by +/-3. I performed a good few tests (different sequencer modes, longer sample times from 1.5 ADC clocks to 3.5 ADC clocks), but no success really. Another interesting observation is that by using 0.1% resistors (43K || 43K) to provide an offset in the differential amplifier circuit the measured offset is 2036 - 2038 counts which is 6 - 8 counts off from 2048. This is a repetitive result in at least 5 more boards that I tested, but it was NEVER a problem with F0 based MCU while using exact same components and very similar layout. I know that in F0 series MCUs had a dedicated VDDA that was decoupled, do you think that is the main different regarding the measurement accuracy consistency or is there something else at play?
Decoupling VDDA is for a reason to stabilise the analog circuits. But the downside is loosing pins that could be used for alternative funtions. You can also try to over sample and make an average to gain stability and more ENOB. /PR TechTalk
Can you show how to sense ac voltage
To sence AC voltage you need to know what you are looking to measure. PeakVoltage, RMS Voltage, Frequenzy.
All have their way to be measured but all have in common you need to get several readings and then let your software do it´s magic to calculate the answer you are looking for.
/PR TechTalk
I need to calculate rms@@prtechtalk416
The normal way to measure RMS AC voltage is to sample at a fixed rate (e.g., 1000 Hz for 50 Hz AC), capture enough samples to cover several periods, and then calculate the RMS directly from the data without worrying about the exact frequency. This assumes the frequency is stable enough for accurate results. If the frequenzy is not known or vary then you need to establish the frequenzy first.
/PR TechTalk
how did you set the NVIC ?
You can enable the NVIC using CubeMX. /PR TechTalk