I have been looking on the new cool ARM7 Cortex from ST for awhile,
now got my latest dev board up and running.
----------------
Benchmark test1:
I have a nice 3rd order lowpass filter with floating point calculations,
float filter(float s)
{
Z[3]=Z[2];
Z[2]=Z[1];
Z[1]=Z[0]; // the rolling buffer
Z[0]= s - (D[1]*Z[1] + D[2]*Z[2] + D[3]*Z[3]);
return Z[0]*N[0] + Z[1]*N[1] + Z[2]*N[2] + Z[3]*N[3];
}
here are the filter constants used:
float N[]={1.67e-02, 5.01e-02, 5.01e-02, 1.67e-02};
float D[]={1, -1.798, 1.221, -.2898};
float Z[4]={200.001,200.001,200.001,200.001};
This code is made and tested for AVR,
but this exactly same C code compile and run just fine on the STM32 !
AVR at 8 MHz time = 2200uS (244uS at 72MHz caluculated) GCC compiler for AVR
STM32 at 72MHz time = 12-14uS (126uS at 8MHz caluculated) KEIL compiler
STM32 at 72MHz time = 16-41uS (with GCC compiler)
STM32 at 72MHz time = 12-15uS (with IAR compiler)
the STR32 is 157-183 times faster.
but the clock is also 9 times faster.
so at SAME clock the STR32 is 17-20 times faster than AVR.
uptimizer changed from none to max speed: 14uS to 12uS
if you call the filter routine with zero it is known to be a bit faster, but I called it with
a variable number and saw almost same result all the time.
--------------------------------------------------
Benchmark test2:
Pin toggle, the STM32 can toogle a pin with 20.8MHz on port b,
the port B bridge setup to 50MHz, and 72MHz core.
so if you set a bit hi and then lo, the pulse will be only 24nS wide !! KEIL compiler
Pin toggle, the STM32 can toogle a pin with 7.3MHz on port b,
the port B bridge setup to 50MHz, and 72MHz core.
so if you set a bit hi and then lo, the pulse will be 68nS wide GCC compiler
Pin toggle, the STM32 can toogle a pin with 19.2MHz on port b,
the port B bridge setup to 50MHz, and 72MHz core.
so if you set a bit hi and then lo, the pulse will be only 26nS-109nS wide !! IAR compiler, time depends on uptimize
An AVR MEGA type, can toogle a pin at halve its core frequency,
pin 10MHz, core 20MHz.
so if you set a bit hi and then lo, the pulse will be only 125nS wide at 8MHz (50nS wide, at 20MHz clock)
so an 20MHz clocked AVR will outperform STM32 only with GCC compiler in bit banging applications
-----------------------------------------------------
code size test floats:
STM32 this filter and init of the floats needed: (KEIL compiler microvision)
O0: 1108 bytes
O3: 1068 bytes
--
STM32 this filter and init of the floats needed: (GCC compiler)
NO: 896 bytes
O3: 896 bytes
MAX: 896 bytes
funny the uptimizer levels dont change a thing in size or speed of this filter.
GCC wins on smallest code, looses on speed
--
STM32 this filter and init of the floats needed: (IAR compiler)
None: 1000 bytes
medium: 926 bytes
High : 918 bytes
several optimizer options exist, rather complex.
--
AVR this filter and init of the floats needed: (GCC compiler here)
O0: 2046 bytes
O3: 2248 bytes
-S: 1838 bytes
(all optimized results where tested to function, the filter call takes same time to execute)
it is a known fact that is IAR compiler can make code size much smaller for normal AVR programs.
I have seen 50% code size with IAR, and the program still worked, on another project.
--------------------------------------------------
code size test chars and integers:
needs to be done
--------------------------------------------------
Price:
ok it is crasy cheap with STM32 !! you get so much internal features
and so much code space for so much less compared to avr 128kb vs 128kb !!
-----------------
ADC:
The AVR have 10 bit internal ADC and normally we see 1 LSB jitter with no extra software filter added.
On the STR32 dev board from KEIL I have here I see 4-5 LSB jitter,
ok it is 12bit resolution os I say it is the same internal digital noise,
the STM32 can run at 1MS !! so it can handle plenty of oversampling and digital noise filters = much better resolution and still much faster ADC result.
I made a normal running avarage like this on the STM32:
adcfiltered=((adcfiltered*0.9)+(newadc*0.1)); // this gives 12 bits useable resolution 0-4000
this is a 10 cycle filter, now I have the full 12 bits resolution with under 1 LSB jitter.
I have proved by lab test if the runing avarage is changed a bit, so it accumulate the noise,
and the output is therefore a calculated higher value = more bits resolution due to the noise,
this gives a much lower speed, but ok it can handle 1 MEGA samples/pr sec at 12bit this converter !
adc13bits = ((adc13bits*0.99)+((float)ADC_ConvertedValue*0.02) ); // this gives 13 bits useable resolution 0-8000
adc14bits = ((adc14bits*0.99)+((float)ADC_ConvertedValue*0.03) ); // this gives 14 bits useable resolution 0-12000
-------------------
Upgradeablility:
The STM32 exist in 48 - 64 - 100 pin LQFP pakages,
easy to hand solder and works fine on even 2 layer boards
also they exist from 32-64-128kb flash, the cheapest is 1.8$ and the biggest 3.6$
they exist in pin compatible slow and cheaper versions also.
they will release 256kb and 512kb soon.
__________________
Last edited by ThomasScherrer (2008-01-15 18:10:31)