cancel
Showing results for 
Search instead for 
Did you mean: 

to create stable signal problem with stm32F415RG

fjs71
Associate II
Posted on December 16, 2015 at 14:49

I'm doing a project that is based on the creation of signals with great precision frequency from a 32-bit microcontroller ARM Cortex M4 manufacturer ST, the (STM32F415RG) family.

What I'm looking for is accuracy in tenths frequency, eg 2.05 Hz want it to be fair.

And it can not, because these are unstable tenths, I'm doing the firmware with the MikroC microelectronics compiler for ARM.

I use a timer to interrupt every time you shoot that load a counter value corresponding to the DAC and so on will create the signal.

The input values ​​are stored in advance in an array.

I see examples of libraries maker ST own an example of creating these signals and what they do is use the DMA and the array data stored there, when the timer counter makes a shot that ends all load DMA values

in the DAC and thus gains stability quickly but not what I'm looking for.

Part of the array controller code and the timer interruption when Conclude your accountant.

This is what I and made with MikroC.

interruption:

10 REPLIES 10
fjs71
Associate II
Posted on December 16, 2015 at 15:22

Posted on December 16, 2015 at 17:47

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=0680X000006I6is&d=%2Fa%2F0X0000000btz%2Fd5At5con_jPbMxUhzzCHqhaHS0Ra9KVpmw2PKk5bduI&asPdf=false
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
fjs71
Associate II
Posted on December 16, 2015 at 19:25

I just need to create a sinusoidal signal. With precision frequency tenths, I wonder if this MCU is able to perform this task.

I created signals with STM32VLDISCOVERY card with examples of STM32F100xx ST libraries, and no stability in tenths frequency.

Posted on December 16, 2015 at 20:31

Yes, I don't know what that means. Tenths to me means 0.1Hz steps, so how does that relate to getting 2.05 Hz?

Over what range of frequencies?

With a 32-bit divider you can control the period in (1/84MHz steps), ie ticks of 11.9ns

1679999 yields 50.00003 Hz

1680000 yields 50 Hz

1680001 yields 49.99997 Hz

For a sine wave you'll need to determine how many samples per cycle you need to output, and scale up the DMA trigger rate to the DAC.

You should be able to compute what frequencies you can build from a single cycle table, or if you need a multi-cycle table to achieve finer granularity of control.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on December 16, 2015 at 20:40

Generating an ~1Hz sine wave using a 50 point table

-10 : 1679990 1.000006
-9 : 1679991 1.000005
-8 : 1679992 1.000005
-7 : 1679993 1.000004
-6 : 1679994 1.000004
-5 : 1679995 1.000003
-4 : 1679996 1.000002
-3 : 1679997 1.000002
-2 : 1679998 1.000001
-1 : 1679999 1.000001
0 : 1680000 1.000000
1 : 1680001 0.999999
2 : 1680002 0.999999
3 : 1680003 0.999998
4 : 1680004 0.999998
5 : 1680005 0.999997
6 : 1680006 0.999996
7 : 1680007 0.999996
8 : 1680008 0.999995
9 : 1680009 0.999995
10 : 1680010 0.999994

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Self.Glenn
Associate III
Posted on December 16, 2015 at 21:11

It might be worth considering a DDS chip. Commonly available varieties can generate sine waves of 40milli Hz resolution, so inside your  0.1Hz requirement.

They generally have some sort of serial interface, so very easy to control with an stm32.

Glenn

fjs71
Associate II
Posted on December 22, 2015 at 13:02

I do not understand?

fjs71
Associate II
Posted on December 22, 2015 at 13:05

this

is the card

I have:    http://www.mikroe.com/mini/stm32/

Posted on December 22, 2015 at 19:24

Ok, not a board I have.

Perhaps you can diagram the signal/waveform you are trying to create, providing indications of the timing, frequency, duration, etc?

I would probably look to avoid USART interaction within the timer interrupt.

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