2024-02-15 04:40 PM
This question is about SPI simplex communication.
Is there any sample code that realizes SPI simplex communication only by register operations?
Also, is there any sample code that uses HAL or LL?
I would like to know both cases of sending and receiving.
[IDE]STM32CubeIDE 1.14.0
[MCU] STM32F412VGT6
2024-02-15 09:16 PM
What do you mean by "simplex"? Uni-directional (just TX or just RX)?
And "register operations" is often called "Polling Mode".
When you download the CubeMX FW, it comes with many examples, even for different boards. Just look inside
"projects/__aBoard__/Examples/", and there is often also a ".../Examples_LL" folder.
You can also look for other boards inside CubeMX FW, not exactly the one you use: often the Eval Boards (-EV) or Development Kits (-DK) have more examples (which are still helpful to get a clue).
For my STM32U5xx I have for instance this:
en.stm32cubeu5-v1-4-0\STM32Cube_FW_U5_V1.4.0\Projects\NUCLEO-U575ZI-Q\Examples\SPI\SPI_FullDuplex_ComPolling_Master
Just download and unzip the stm32cube for your processor and browse through all the examples (also for other boards not expecting just your particular one has a demo). Often a demo for another board can be ported to your board.
Or create a project with STM32CubveMX, as dummy: let it generate code for you. When it has placed all the needed HAL_Driver files into your project folder: just browse through the H-files, e.g. "stm32u5xx_hal_spi.h" vs. "stm32u5xx_ll_spi.h": you will see all functions exported (supported) and so many comments which are very helpful.
Be smart by looking into Cube_FW folders and files for your processor.