-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stm32 spi : use LL API to improve performances #4375
Conversation
@LMESTM
Could you investigate please |
@adbridge I believe because of the dependency mentioned above, it's now ready to be merged, then this should be rebased and make it green. |
Hey |
#3445 is also being fixed as part of this PR |
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just that macro is not clear to me what it does and how to find documentation (changes HAL implementation).
targets/TARGET_STM/stm_spi_api.c
Outdated
struct spi_s *spiobj = SPI_S(obj); | ||
SPI_HandleTypeDef *handle = &(spiobj->handle); | ||
|
||
size = (handle->Init.DataSize == SPI_DATASIZE_16BIT) ? 2 : 1; | ||
#ifdef STM32_SPI_KEEP_HAL_USAGE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this macro coming from ? IS it documented anywhere? This changes the implementation .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It differs from what was before (RX an error handling ? )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message describes it:
This commit implements a SPI mode which will offer better performance
thanks to usage of Lower Layer API which use fewer registers access,
at the cost of lower robustness (no error management at all).
The SPI driver can be configured to re-use the HAL and error management by
defining the STM32_SPI_KEEP_HAL_USAGE compilation switch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this macro change the implementation? That wouldn't be good. We should choose one implementation and stick to it.
CI Jenkins reports a build failure - can you share the error ? |
@LMESTM There is the old jenkins config, can you rebase from master to pick it up, that should resolve the error. |
This commit implements a SPI mode which will offer better performance thanks to usage of Lower Layer API which use fewer registers access, at the cost of lower robustness (no error management).
@0xc0170 ok thx - rebased |
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Description
This PR contains a change in SPI driver to improve performances by accessing to registers directly (using LL layer in STM32 SDK, which provides inline functions to access it.
See #4246
Resolves #3445
Status
READY
Waiting for 2 other PRS:
Related PRs
There were 2 pending dependencies of upgrading STM32 SDK for
F4 (#4299) => MERGED
F2 (#4402) => MERGED
This SDK updates will include the LL API that is used here.
I will rebase when this is done - but this PR can be used for test by anyone interested in it, and review can happen in parallel.
Test results
CI tests passed ok
+-------------------+---------------+---------------+--------+--------------------+-------------+
| target | platform_name | test suite | result | elapsed_time (sec) | copy_method |
+-------------------+---------------+---------------+--------+--------------------+-------------+
| NUCLEO_F091RC-ARM | NUCLEO_F091RC | tests-api-spi | OK | 60.5 | shell |
| NUCLEO_F103RB-ARM | NUCLEO_F103RB | tests-api-spi | OK | 61.56 | shell |
| NUCLEO_F303ZE-ARM | NUCLEO_F303ZE | tests-api-spi | OK | 61.3 | shell |
| NUCLEO_F446RE-ARM | NUCLEO_F446RE | tests-api-spi | OK | 59.17 | shell |
| NUCLEO_F767ZI-ARM | NUCLEO_F767ZI | tests-api-spi | OK | 58.7 | shell |
| NUCLEO_L073RZ-ARM | NUCLEO_L073RZ | tests-api-spi | OK | 64.15 | shell |
| NUCLEO_L152RE-ARM | NUCLEO_L152RE | tests-api-spi | OK | 61.34 | shell |
| NUCLEO_L476RG-ARM | NUCLEO_L476RG | tests-api-spi | OK | 60.87 | shell |
+-------------------+---------------+---------------+--------+--------------------+-------------+
Also MBED OS2 SPI tests verified OK.