Skip to content
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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

multiplemonomials
Copy link

@multiplemonomials multiplemonomials commented Jul 26, 2024

Prerequisites

  • I have checked latest main branch and the issue still exists.
  • I did not see it is stated as known-issue in release notes.
  • No similar GitHub issue is related to this change.
  • My code follows the commit guidelines of this project.
  • 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant