2025-06-10 5:44 AM
Hello,
I am currently using a X-NUCLEO-GFX01M2 screen to display logs from a NUCLEO-STM32WL55JC board. Unfortunately, it is quite slow to display the logs, so I wanted to improve the SPI frequency. I tested it by lowering the SPI BaudRatePrescaler from the nucleo board, but below 16, I noticed no improvements. When measuring the SPI clock, there is no improvement above roughly 3 MHz.
How can I improve the SPI link?
Moreover, there is nothing related to the max SPI frequency in any X-NUCLEO-GFX01M2 documentation. What is the max frequency the GFX01M2 screen can support?
Regards,
Sacha
Solved! Go to Solution.
2025-06-10 6:35 AM
@sacha-usmb wrote:I tried higher optimization levels and the result was much better (almost twice better with -O3)!
So the software is the bottleneck!
Are you using HAL?
@sacha-usmb wrote:I don't use DMA but polling.
If you need further improvement, look into DMA...
2025-06-10 5:46 AM - edited 2025-06-10 5:47 AM
Surely, if increasing the SPI speed makes no difference, that suggests that the SPI is not the bottleneck?
What optimisation level are you using?
Are you using DMA?
2025-06-10 6:02 AM
The max SPI speed will depend on the controller. Different versions of the board have different controllers. Refer to the board documentation to find out which controller you have, and refer to that for timing information.
2025-06-10 6:17 AM
You are probably right that SPI is not the bottleneck.
I am using -O0 optimization. I tried higher optimization levels and the result was much better (almost twice better with -O3)!
I don't use DMA but polling.
2025-06-10 6:35 AM
@sacha-usmb wrote:I tried higher optimization levels and the result was much better (almost twice better with -O3)!
So the software is the bottleneck!
Are you using HAL?
@sacha-usmb wrote:I don't use DMA but polling.
If you need further improvement, look into DMA...
2025-06-10 6:50 AM
@Andrew Neil wrote:Are you using HAL?
Yes I am. I'll check DMA to see if it's worth it.
2025-06-10 6:54 AM
The board used is MB1642-TCXD022IB5-D01, but I did not manage yet to find the documentation and, hence, the controller for timing information. I'll keep searching.
2025-06-10 6:58 AM
You said polling - does that mean you're not even using interrupts?
Even then, HAL's SPI is quite clunky - if you look with a scope, you will see significant gaps between bytes on the bus.
There is definitely scope to manually optimise here!
DMA should also help.
After all that, you then might see improvements from raising the SPI speed...
2025-06-10 7:17 AM
@Andrew Neil wrote:You said polling - does that mean you're not even using interrupts?
Good question, I don't really know. I'am using the st7789 library which only calls HAL SPI functions, like HAL_SPI_Transmit() and HAL_SPI_Transmit_DMA() if I want to use DMA.
2025-06-10 7:23 AM
HAL_SPI_Transmit() is blocking; HAL_SPI_Transmit_IT() is the interrupt-driven one: