Dhrystone and Whetstone Benchmarks for STM32F103

Post here first, or if you can't find a relevant section!
User avatar
RogerClark
Posts: 7494
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Dhrystone and Whetstone Benchmarks for STM32F103

Post by RogerClark » Sun Oct 02, 2016 9:01 pm

I will try to find some time to rebuild the lib today

Edit.

I recompiled with ENABLE_HIGH_SPEED defined and it actually made it worse

Code: Select all

Dhrystone Benchmark, Version 2.1 (Language: C)
Execution starts, 300000 runs through Dhrystone

Execution ends
Microseconds for one run through Dhrystone: 9.75
Dhrystones per Second: 102609.18
VAX MIPS rating = 58.40

I think this is a problem that Wi6 / STM need to investigate and decide what speed they want to run the Nucleo at

LMESTM
Posts: 4
Joined: Mon Sep 12, 2016 12:36 pm

Re: Dhrystone and Whetstone Benchmarks for STM32F103

Post by LMESTM » Mon Oct 03, 2016 9:29 am

Hi all
this is much probably an issue about setting up clock pathes during init phase
As a reference, you can find the MBED clock initialization code here:
https://github.com/ARMmbed/mbed-os/blob ... tm32l4xx.c
In the function SetSysClock_PLL_HSE you can indeed find the setting for deriving 80MHz system clock from the 8MHz VCO input (which is what you get on the NUCLEO boards). Let me know if this helps
Laurent

User avatar
RogerClark
Posts: 7494
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Dhrystone and Whetstone Benchmarks for STM32F103

Post by RogerClark » Mon Oct 03, 2016 10:05 am

Thanks Laurent

I didn't realise the code was based on mbed.

Has anyone confirmed that the mbed code runs at 80Mhz, I suspect there may be a mistake in the mbed code is Wi6Labs just made an exact copy

User avatar
Slammer
Posts: 255
Joined: Tue Mar 01, 2016 10:35 pm
Location: Athens, Greece

Re: Dhrystone and Whetstone Benchmarks for STM32F103

Post by Slammer » Mon Oct 03, 2016 11:11 am

The mbed code runs at 80MHz from MSI. Look this file https://github.com/ARMmbed/mbed-os/blob ... tm32l4xx.c at lines 551-554, the PLLM=1, PLLN=40 and PLLR=2, thus (4 * 40)/2 = 80MHz. There is no 64MHz setup in mbed, the SetSysClock_PLL_MSI function is only for 80MHz. Actually is not "mbed" code, this function is the typical function for clock setup as generated from CubeMX when MSI@80Mhz is selected.

The Nucleo L476 board does not use HSE clock, only the MSI clock, is not the same like all other nucleo boards!!!

Nucleo 64 manual (UM1724) page 24 states:

Note: For NUCLEO-L476RG the ST-LINK MCO output is not connected to OSCIN to reduce
power consumption in low power mode. Consequently NUCLEO-L476RG configuration
corresponds to HSE not used.



EDIT: @Roger I think that your results are correct:
F103@72 : 48.81 VAX MIPS
L476@64 : 46.64 VAX MIPS
L476@80 : 58.40 VAX MIPS
Am I missing something?

LMESTM
Posts: 4
Joined: Mon Sep 12, 2016 12:36 pm

Re: Dhrystone and Whetstone Benchmarks for STM32F103

Post by LMESTM » Mon Oct 03, 2016 1:04 pm

Thanks Slammer for your inputs.

I was also going thru Roger measurements, and this sounds consistent (i.e. 46.64 * 80 / 64 ~= 58.4) and Dhrystone results are linear to cpu frequency.
This all sounds reasonable.

And yes clock setting clock comes from cubeMX.
Thanks also for sharing the right and complete information about MSI / HSE clock selection.

User avatar
Slammer
Posts: 255
Joined: Tue Mar 01, 2016 10:35 pm
Location: Athens, Greece

Re: Dhrystone and Whetstone Benchmarks for STM32F103

Post by Slammer » Mon Oct 03, 2016 1:13 pm

If you examine the mbed code you will notice that actually the HSE clock is configured but it is common in mbed to try always first the HSE Clock and if this fails (in Nucleo L476 fails as nothing is connected in HSE input) to setup the internal clock. This helps boards to startup correctly in any case.

User avatar
RogerClark
Posts: 7494
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Dhrystone and Whetstone Benchmarks for STM32F103

Post by RogerClark » Mon Oct 03, 2016 8:13 pm

I will double check, but its odd that SPI shows exactly 1mhz on my logic analyzer using DIV64

Also I am surprised a 80mhz processor performs worse than a 72mhz processor.

Also, The recompiled library with ENABLE HIGH SPEED showed lower Drystone test speeds.

I still think their may be a problem.

User avatar
martinayotte
Posts: 1229
Joined: Mon Apr 27, 2015 1:45 pm

Re: Dhrystone and Whetstone Benchmarks for STM32F103

Post by martinayotte » Mon Oct 03, 2016 8:16 pm

Did you try to print the value of SystemCoreClock ?

User avatar
RogerClark
Posts: 7494
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Dhrystone and Whetstone Benchmarks for STM32F103

Post by RogerClark » Mon Oct 03, 2016 8:30 pm

no.

I will try that

User avatar
Rick Kimball
Posts: 1058
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Dhrystone and Whetstone Benchmarks for STM32F103

Post by Rick Kimball » Mon Oct 03, 2016 8:33 pm

/* this call on the stm32f103 works to output the clock on PA8 .. not sure if it is the same for the stm32l4 */

HAL_RCC_MCOConfig(RCC_MCO, RCC_MCO1SOURCE_SYSCLK, RCC_MCODIV_1); // PA8 shows clock
-rick

Post Reply