cancel
Showing results for 
Search instead for 
Did you mean: 

DMA ADC with potentiometer

meriarajagukguk
Associate III

meriarajagukguk_0-1722506627093.png

i have program like this and from the program i have the output like this (picture) and i used the potentiometer to find the value is AD_RES_BUFFER: 

the potition of picture is disable of DMA Countinous Request ADC ANALOG

meriarajagukguk_0-1722506745039.png

but the potentiometer work (produces value ) if i enable the 'DMA Countinous Request' in stm32cubeMX i used the nucleof334r8  but the value of b and output is 0 (zonk).

and if i disable the 'DMA Countinous Request' in stm32cubeMX the potentiometer doesn't work (produces no value if rotated) and only displays value randomly and i dont know from where the value, but i have a value of 'output, b' in watch 1.

so i want to enable the 'DMA Countinous Request' and get the value of potentiometer (REAL TIME AND UPDATE ID I ROTATED THE POTENTIO) but i dont know how to set it in cubeMX and prgram the keil.

PLEASE ANYONE HELP ME. 

1 ACCEPTED SOLUTION

Accepted Solutions
Amel NASRI
ST Employee

Hi @meriarajagukguk ,

Try first a working example to understand how it works. Then you can update it to your specific needs.

I suggest you start with this MOOC: STM32CubeMX basics: 13.2 STM32Cube HAL labs ADC - Lab ADC DMA (youtube.com).

You will need to select STM32F3 instead of STM32F4 and Keil instead of IAR.

-Amel

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5
Amel NASRI
ST Employee

Hi @meriarajagukguk ,

Try first a working example to understand how it works. Then you can update it to your specific needs.

I suggest you start with this MOOC: STM32CubeMX basics: 13.2 STM32Cube HAL labs ADC - Lab ADC DMA (youtube.com).

You will need to select STM32F3 instead of STM32F4 and Keil instead of IAR.

-Amel

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

but I'm using a NUCLEO STM32F334R8 not the F4 SERIES and I should already understand how it works, it's just that I'm confused about applying it to the STM32cubemx and there's little software that has to be used.
any other ideas?

TDK
Guru

Debug your code and see where it's at. By that I mean hit the debug button, ensure it's running, let it run a few seconds and hit pause. See where execution is at. Set a breakpoint at the line that assigns b and see if it gets hit.

At a wild guess, probably you are stuck in neverending ADC interrupts because your sampling time is too small.

If you feel a post has answered your question, please click "Accept as Solution".

Do you happen to have an example? I'm a beginner, so I'm confused about how to check and set a breakpoint?

Plenty of resources out there on how to debug and program. Google is your friend. If your intention is to learn, having other people write your code won't help you in the long run.

Did you try at all? What is your sampling time? Did you increase it?

If you feel a post has answered your question, please click "Accept as Solution".