Showing results for 
Search instead for 
Did you mean: 

STM32F303re SPI AT 18Mhz

Associate II


I need assistance generating a continuous 18MHz SPI signal without gaps between data transmissions using the STM32F303RE. Additionally, I need to be able to perform other tasks on the microcontroller simultaneously.

I am using DMA in circular mode to handle the SPI data transfer. However, I encounter an issue where I cannot exceed a 2MHz SPI clock without the microcontroller failing to handle other tasks properly, such as toggling an LED.

Can you provide guidance on how to achieve a continuous 18MHz SPI signal while allowing the microcontroller to handle other tasks?

Thank you!


This is too little information to give anything but a generic answer.

If you process each byte you transmit or receive (or, worst case, both), you have 32 cycles per byte. That may be barely enough to pick the data and move them somewhere else. If that's the case, then you may be able to pull it out by using large enough buffers in memory, and by very carefully designing the ISRs (dumping Cube/HAL is the first step, using high levels of compiler optimization is second).

For any more substantial processing you simply don't have the computation power, there are no miracles to remediate that.


Hi thanks for ur reply, so in my case i want only generate data at 18Mhz(I have buffer of 511 byte ) in MOSI i don't use communication spi bcs i think it's better than use interupt at 40ns .


IAM using nucleo board and cubeIDE as i said i want understand if MCU can generate data at max speed 18Mhz and can run other task bcs in while loop i have toggle led with delay 100ms for test 


i do same test with stm32f407 stm32f407 discovery board it work with 21Mhz and i can blink 4 led in while loop what is difference why there is no gap in data in MOSI without gap so what is difference maybe input frequency bcp nucleof303re use only internal oscillator there is no external clock connected ....   

If you just transmit using circular DMA the same data over and over, there is no need for processor involvement, i.e. for DMA alone there is zero load on the processor.

However, if you use Cube, it generates for you the DMA half-complete and transfer-complete interrupts, whether you use them or not, and they may take up quite significant processor time.


ok but why with stm32f303RE it dosent work  and with stm32f407 it work fine and both i use CubeIDE 

and by the way second question stm32f407 spi can up 42Mhz but by divider of 2 ( 42Mhz,21Mhz,10.5Mhz,5.25Mhz can i use custom speed between those value like 40Mhz,25Mhz ,11Mhz, ....) 



The 'F3 processor's raw computing power is lower than the 'F4 - it has roughly half the maximum clock (168MHz vs. 72MHz) and the 'F3 does not have the ART FLASH accelerator the 'F4 has. There may be also other more nuanced differences.

The SPI dividers are generally powers of 2, see the SPI chapter in RM.