As title, what is different betweem stm32f10x standard library & stm32cubemx(hal) library.
Shall we make STM32CubeMX to use standard peripheral library?
If possible, please let me know how to do detail.
Also, what is different of stm32cubemx & stm32cubef1?
STSW-STM32054 - STM32F10x standard peripheral library - STMicroelectronics - STMicroelectronics
STM32CubeF1 - Embedded software for STM32 F1 series (HAL low level drivers, USB, TCP/IP, File system, RTOS, Graphic - co…
STM32CubeMX is an application. It gives you GUI for choosing your pinouts, pin functions, and clock timings, among other things. It generates initialization code for the peripherals you choose. It doesn't write your program for you, it just initializes the peripherals.
stm32cube_f1_xx is the HAL library for the stm32f1 series. it is example code and drivers, too.
standard peripheral library is deprecated. HAL is the library/set of libraries currently maintained and promoted by the factory.
Thanks John Doe
I want to use SPI function. Just to push a data(8-bit) out via SPI port.
To compare this function in standard peripheral library & HAL library, the HAL library's seem very complex.
To push a command(for ili9341) or data to function "HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout)" one by one.
This function is powerful and check many thing. However it has higher overhead & less efficiency.
If use it for a lot data transfer will better.
Generally ILI9341's data is one command with one or more parameter/data.
Store them into array and pass to HAL_SPI_Transmit() is possible.
array = 0x04 //total number of array
array = 0xCF //ILI9341 command
array = 0x30 //parameter
array = 0x00 //parameter
How to separately handle the command and parameter for D/C pin operation?
1) If simply pass the array to HAL_SPI_Transmit(), I afraid it handle the whole array like parameter only.
2) How to handle the rest parameter, if special handle the command first? It is because the parameter is start from the third location(not first location).
Please share your comment to me.
I wrote a series of articles about SPI recently, here is the last piece that deals with calling the HAL routines to get the transfer done:
I Apply SPI: Good Vibrations — Embedded
It's not really clear what your concerns are. You say that the HAL routines are very complex, and yet the only complication in SPI is that ST doesn't handle the chip select line very well and you have to call two GPIO functions.
If you are worried that the routines are doing too much on your behalf, remember that these processors are running at many megahertz and your compiler is optimizing the hell out of the code and probably NOT having the processor do as much as you think it is. You could paste values into the device registers directly, but you probably have better things to do with your time than second guess the compiler by simulating assembly code.
Andrei from The Great White North.
Andrei Thanks for your comment.
It is because my english is not good, so my explanation is not clear.
Let me try again.
"the HAL routines are very complex" I mean that there will process & check many thing in this function such time out.
In some design(small system), never check it.
The max. freq. of STM32F1xx is 72MHz and is very faster than many chip. However in design point of view, we should optimize it more.
With HAL library, it is powerful & safe.
If using simple method like assembler language, direct write a value to registers. It will be faster.
It is trade off between high level & low level language. right?
Start with a hal example close to your needs. Once functional, if performance beyond compiler's ability is mandatory, convert to the LL (Low Layer macrod) in a later step.
Thanks & note.
I shall try it step by step.
Retrieving data ...