nxp-mcuxpresso / mcux-sdk

MCUXpresso SDK
BSD 3-Clause "New" or "Revised" License
339 stars 148 forks source link

DSPI: Improve support for dummy data larger than 8 bits #204

Open multiplemonomials opened 4 months ago

multiplemonomials commented 4 months ago

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:

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

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!