STM: SPI: Initialize Rx in spi_master_write #3540
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes an SPI issue as reported here: #3501
Also applicable to other NUCLEO boards tested on -ci-test-shield
Note:
To have the test completely PASS on NUCLEO_L476RG, this PR on ci-test-shield repo is also needed ARMmbed/ci-test-shield#21
Otherwise the test would fail at the "SPI - Object Definable" step.
Description
In case Rx is not initialized its content might be random from stack.
This is causing problem in case of 8 bits read only as the left-side 8 bits
of the returned int value may contain this random byte data. This was for
instance detected when using SDFileSystem Lib.
Status
READY
Tests results
+-----------------------+---------------+---------------+------------------------+--------+--------+--------+--------------------+
| target | platform_name | test suite | test case | passed | failed | result | elapsed_time (sec) |
+-----------------------+---------------+---------------+------------------------+--------+--------+--------+--------------------+
| NUCLEO_L476RG-GCC_ARM | NUCLEO_L476RG | tests-api-spi | SPI - Object Definable | 1 | 0 | OK | 0.05 |
| NUCLEO_L476RG-GCC_ARM | NUCLEO_L476RG | tests-api-spi | SPI - SD Read | 1 | 0 | OK | 0.25 |
| NUCLEO_L476RG-GCC_ARM | NUCLEO_L476RG | tests-api-spi | SPI - SD Write | 1 | 0 | OK | 0.51 |
| NUCLEO_L476RG-GCC_ARM | NUCLEO_L476RG | tests-api-spi | SPI - SD card exists | 1 | 0 | OK | 0.44 |
+-----------------------+---------------+---------------+------------------------+--------+--------+--------+--------------------+
+-----------------------+---------------+---------------+------------------------+--------+--------+--------+--------------------+
| target | platform_name | test suite | test case | passed | failed | result | elapsed_time (sec) |
+-----------------------+---------------+---------------+------------------------+--------+--------+--------+--------------------+
| NUCLEO_F410RB-GCC_ARM | NUCLEO_F410RB | tests-api-spi | SPI - Object Definable | 1 | 0 | OK | 0.05 |
| NUCLEO_F410RB-GCC_ARM | NUCLEO_F410RB | tests-api-spi | SPI - SD Read | 1 | 0 | OK | 0.21 |
| NUCLEO_F410RB-GCC_ARM | NUCLEO_F410RB | tests-api-spi | SPI - SD Write | 1 | 0 | OK | 0.42 |
| NUCLEO_F410RB-GCC_ARM | NUCLEO_F410RB | tests-api-spi | SPI - SD card exists | 1 | 0 | OK | 0.71 |
+-----------------------+---------------+---------------+------------------------+--------+--------+--------+--------------------+