DSPI: Improve support for dummy data larger than 8 bits #204
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.
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
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
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!