STM32 simple bechmark - Page 1
Forum section: electronics / general

author: ebclr
author_rank: Super Contributor
timestamp: January 11, 2017, 09:51:46 am
content: I use mbed sinewave example and evaluate the results on generating analog sinewave on 4 diferent nucleo boards just for fun no optimization , only play mbed exampleResultsF767 15.8 KhzF429 5.98 KhzF072RB 704 HzL152 638Hz#include "mbed.h"AnalogOut my_output(PA_4);#define PI (3.141592653589793238462)#define AMPLITUDE (1.0) // x * 3.3V#define PHASE (PI * 1) // 2*pi is one period#define RANGE (0x7FFF)#define OFFSET (0x7FFF)// Configuration for sinewave output#define BUFFER_SIZE (360)uint16_t buffer;void calculate_sinewave(void);int main() {printf("Sinewave example\n");calculate_sinewave();while(1) {// sinewave outputfor (int i = 0; i < BUFFER_SIZE; i++) {my_output.write_u16(buffer);// wait_us(10);}}}// Create the sinewave buffervoid calculate_sinewave(void){for (int i = 0; i < BUFFER_SIZE; i++) {double rads = (PI * i)/180.0; // Convert degree in radianbuffer= (uint16_t)(AMPLITUDE * (RANGE * (cos(rads + PHASE))) + OFFSET);}}

author: jaromir
author_rank: Unknown
timestamp: January 11, 2017, 03:55:26 pm
content: No optimization compilation usually produces awful code - it is useful just for debugging, where you need to step through code and not being disturbed by optimizer shuffling your code all over the shop or "hiding" variables. At least O1 optimization produces much better code density.Along with "benchmark results" you should also provide CPU clock speed.Benchmarks are somehow black magic, with lot of folks having very different opinions and discussing forever; some benchmarks are specific to particular action (floating point, random or sequential memory access) do work better on some architectures and perform poorly on another.

author: Bruce Abbott
author_rank: Frequent Contributor
timestamp: January 12, 2017, 05:30:58 am
content: What CPU clock frequency was each board running at?

author: ebclr
author_rank: Super Contributor
timestamp: January 12, 2017, 07:20:12 am
content: http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-nucleo/nucleo-f767zi.htmlhttp://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-nucleo/nucleo-f429zi.htmlhttp://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-nucleo/nucleo-f072rb.htmlhttp://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-nucleo/nucleo-l152re.html

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: January 12, 2017, 04:31:09 pm
content: Easier to get the data from here I thinkhttps://developer.mbed.org/platforms/?pvend=10I'm not sure exactly what the benchmark is testing (DAC output and simple loop?), but interesting to see the M3 at 32MHz is not much faster than M0 at 48Mhz. M4 is roughly 6x faster than M3, and M7 2x faster than M4.It's obviously not just clock speed that is the factor, there are also differences in instruction sets, caching and bus architecture. It could be that all of the difference is down to caching, so probably a pretty useless benchmark.