cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Performance while running from RAM

dsettu
Associate II
Posted on March 03, 2008 at 11:51

STM32 Performance while running from RAM

4 REPLIES 4
dsettu
Associate II
Posted on May 17, 2011 at 12:25

Hi,

I tried to compile and run the code from RAM. I noticed that it takes about 40% more cycles then runing from zero wait stated flash. Do you expect such increase in cycles while running from RAM compared to Flash at zero wait state?

Can you please explain why it is slow from RAM, i was expecting it to be same as zero waitstated Flash...

Thanks,

SD

obtronix
Associate II
Posted on May 17, 2011 at 12:25

The STM32 has a cortex core, which has an harvard arhitecture - seperate instruction and data buses (seperate bus to the FLASH and RAM). When you run from RAM you shutting down the FLASH bus, so everything goes through one bus (you are using the RAM bus for both instructions and data). Therefore you will run much slower running just out of RAM (but slightly less power), that is of course assuming both FLASH and RAM have the same access time.

dsettu
Associate II
Posted on May 17, 2011 at 12:25

Thank you, this explain the reason well.

STM32 required 2wait states for Flash at 72Mhz clock frequency. Do you know how much impact it will have in code execution speed?

lspr35
Associate II
Posted on May 17, 2011 at 12:25

Switching to 1 waitstate when executing from flash will speed up a program by approximately 20%; see:

http://www.st.com/mcu/forums-cat-6133-23.html&start=30

Ofcourse this will depend upon Your program.

I don't know if code execution will be faster when switching to zero waitstates because zero waitstates leads to a crash of the program. But I think that there would be no significant further improvement because instructions are fetched with 64bit at a time.

Regards

Squonk