[X] I have checked latest main branch and the issue still exists.
[X] I did not see it is stated as known-issue in release notes.
[X] No similar GitHub issue is related to this change.
[ ] My code follows the commit guidelines of this project.
[X] I have performed a self-review of my own code.
[ ] My changes generate no new warnings.
[ ] I have added tests that prove my fix is effective or that my feature works.
Describe the pull request
I am working on MK64F support in Mbed Community Edition, and noticed some issues related to the dummy data support in the DSPI peripheral driver. Specifically:
For transfers done using the fsl_dspi driver, if the SPI frame size is >8, the upper 8 bits are always sent as 0s, regardless of dummy data setting.
For transfers done using the fsl_dspi_edma driver, the upper 8 bits always match the bottom 8 bits. This is most of the time what you want, but why not let the user change it?
This PR fixes this by widening the dummy data variable to 16 bits. If the old-style DSPI_SetDummyData version is used, the upper 8 bits are set to match the lower 8 bits. This means that the non-DMA driver now matches the DMA version's behavior. If the new DSPI_SetDummyData16Bit function is called instead, the entire 16-bit dummy word can be set at once.
Type of change
[X] Bug fix (non-breaking change which fixes an issue)
[X] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[X] This change requires a documentation update
Tests
Test configuration (please complete the following information):
Hardware setting: FRDM-K64F
Toolchain: ARM GCC
Test Tool preparation:
Any other dependencies:
Test executed
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
[ ] Build Test (I am confused, how do I build this repo? The getting started instructions do not work for K64F)
[ ] Run Test
Currently I have tested this in-tree with Mbed CE. I verified with a logic analyzer that, for fsl_dspi transfers, 16-bit dummy data is sent. I still need to test this with the DMA version of the code. If this testing is not sufficient, please advise on what other manual tests I should do / test programs I should add!
Prerequisites
Describe the pull request
I am working on MK64F support in Mbed Community Edition, and noticed some issues related to the dummy data support in the DSPI peripheral driver. Specifically:
fsl_dspi
driver, if the SPI frame size is >8, the upper 8 bits are always sent as 0s, regardless of dummy data setting.fsl_dspi_edma
driver, the upper 8 bits always match the bottom 8 bits. This is most of the time what you want, but why not let the user change it?This PR fixes this by widening the dummy data variable to 16 bits. If the old-style
DSPI_SetDummyData
version is used, the upper 8 bits are set to match the lower 8 bits. This means that the non-DMA driver now matches the DMA version's behavior. If the newDSPI_SetDummyData16Bit
function is called instead, the entire 16-bit dummy word can be set at once.Type of change
Tests
Currently I have tested this in-tree with Mbed CE. I verified with a logic analyzer that, for
fsl_dspi
transfers, 16-bit dummy data is sent. I still need to test this with the DMA version of the code. If this testing is not sufficient, please advise on what other manual tests I should do / test programs I should add!