2015-12-16 05:49 AM
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:2015-12-16 06:22 AM
2015-12-16 08:47 AM
2015-12-16 10:25 AM
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.
2015-12-16 11:31 AM
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.9ns1679999 yields 50.00003 Hz1680000 yields 50 Hz1680001 yields 49.99997 HzFor 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.2015-12-16 11:40 AM
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
2015-12-16 12:11 PM
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. Glenn2015-12-22 04:02 AM
I do not understand?
2015-12-22 04:05 AM
2015-12-22 10:24 AM
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.