cancel
Showing results for 
Search instead for 
Did you mean: 

Does stm32h7 at 480Mhz runs at 17MIPS only?

JLope.11
Associate III

I have seen that it takes about 28 ticks to read registers, so I think my stm32h750 runs really at 17Mhz, it seems is not risk, so perhaps it exists another more fast stm32 micro that have more 17 MIPS 

5 REPLIES 5
Uwe Bonnes
Principal III

If you get unexpected results, look on your side first for errors!

AScha.3
Chief III

Which optimizer setting you use ? (try -O2 or -Ofast , i use -O2 most time.)

+

How you measure this ?

If you feel a post has answered your question, please click "Accept as Solution".
SMSAD.1
ST Employee

Hello @JLope.11,

Welcome to the ST community! Can you share with us the code or more details about it?

Also, as AScha.3 said which optimizer do you use? It differs if you use Keil or IAR.


Thanks,
SMSAD.1 

JLope.11
Associate III

Of course, I used this to read registers:

 

 

a0=HRTIM1->sTimerxRegs[HRTIM_TIMERINDEX_TIMER_A].CNTxR;
a1=HRTIM1->sTimerxRegs[HRTIM_TIMERINDEX_TIMER_A].CNTxR;

 

 

I was surprised to see a difference of 28-32 ticks between the readings. This was annoying!

I then tried reading the DWT->CYCCNT counter and got slightly better results.

I used stm32cubeide with default parameters

 

 

Now I used this code and -O2 optimization for speed and see a lot of improvements, here is a better code:

 

 

 

		a0=DWT->CYCCNT;
		a1=DWT->CYCCNT;
		i=GPIOC->IDR & GPIO_PIN_0;
		a2=DWT->CYCCNT;
		i=GPIOC->IDR & GPIO_PIN_0;
		a3=DWT->CYCCNT;
		i=GPIOC->IDR & GPIO_PIN_0;
		a4=DWT->CYCCNT;
		a5=DWT->CYCCNT;
		printf("a0,1,2,3,4,5= %5lu %5lu %5lu %5lu %5lu %5lu  ",a0,a1,a2,a3,a4,a5);
		printf("d1,1,2,3,4= %4lu %4lu %4lu %4lu %4lu\r\n",a1-a0,a2-a1,a3-a2,a4-a3,a5-a4);

 

 

 

 

Now I see to read the counter is needed 10ticks always, and the gpio pin 34-42 tics, 

Thanks a lot!

 

To set optimizations:
Right-click on your project in the Project Explorer window in properties, C/C++ Build->Settings, 
in Setting windows, click MCU/GCC Compiler->Optimization: set -O2