cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32f4 beginner qustions

weejonas28
Associate II
Posted on July 05, 2016 at 07:54

Hi, I am new to stm32f4 and just started picking up some basic skills on it. Hope you guys help me answer my doubts even though the questions I ask are very basic but it will really help me out.

1. Why do we need a timer to trigger ADC?

2.what is the purpose of timers?

2. What is interrupt for?

8 REPLIES 8
Nesrine M_O
Lead II
Posted on July 05, 2016 at 10:32

Hi jonas.wee,

Welcome to STM32 community.

I'd highly recommend you to have a look to the

http://www.st.com/content/ccc/resource/technical/document/application_note/group0/91/01/84/3f/7c/67/41/3f/DM00236305/files/DM00236305.pdf/jcr:content/translations/en.DM00236305.pdf

: The purpose of this application note is to provide a simple and clear description of the basic features and operating modes of the STM32 general-purpose timer peripherals.

-Syrine-
Posted on July 05, 2016 at 10:44

You don't have to trigger the ADC, but if you want specific and consistant sample rates it is important. So for example audio sampling, or frequency domain analysis.

Time stops everything from happening at once.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
weejonas28
Associate II
Posted on July 06, 2016 at 16:30

Lets say i need to sample 8KHz frequency for FFT, to do that do i  use timer to trigger adc every 8Khz or do i use dma to store data up till 8khz then tranfer to FFT?

Posted on July 06, 2016 at 16:59

I sense it is not just the STM32 you are new too.

The TIM would be set to trigger the ADC at 8 KHz, when it completes that conversion the DMA saves the value to a buffer. You would make a DMA buffer that is sufficiently deep to hold a set of samples you want to perform the FFT on, like 1024 samples? I'd configure the DMA for a 2048 sample buffer, in circular mode, and get it to interrupt with HT (Half Transfer) and TC (Transfer Complete) so that there were 1024 samples to work with. You could work with them in-place or copy them to a buffer for processing.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
weejonas28
Associate II
Posted on July 06, 2016 at 17:11

Thanks for the help, and yes i am very new to this field in general in fact i do not have any experience in computer architecture or anything related to it. Really sorry for asking ridiculous questions.

I will also like to know what is the function of interrupts and why do we use it?

Posted on July 06, 2016 at 18:34

I will also like to know what is the function of interrupts and why do we use it?

You take your car to a repair shop, they tell you it will take several hours to fix, so instead of sitting in the waiting room all day, you leave and go about other business, and wait for them to call you on the phone when it is done. The interrupt is like a phone call, alerting you something completed.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
weejonas28
Associate II
Posted on July 08, 2016 at 09:03

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6dM&d=%2Fa%2F0X0000000bsA%2FElXmZ9o428Lzi.auguVdXX5Qm3tDWgSowVGkOv45rTo&asPdf=false
Posted on July 08, 2016 at 12:41

Sorry, can't help you with issues using HAL

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..