Add configurable framesize for SPI DMA transactions on T4#70
Open
natecermak wants to merge 1 commit intoPaulStoffregen:masterfrom
Open
Add configurable framesize for SPI DMA transactions on T4#70natecermak wants to merge 1 commit intoPaulStoffregen:masterfrom
natecermak wants to merge 1 commit intoPaulStoffregen:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR makes the asynchronous DMA-driven SPI.transfer() for the Teensy 4.x take an additional argument for the size of the frame to be transmitted, which can range from framesize=7 (8 bit transmit) to framesize=31. If framesize=32 or greater, SPI.transfer() will return false. If the framesize is 7 or smaller, buffers are uint8. If framesize is 8-15, buffers are uint16. If framesize is > 16, buffers should be uint32. This PR does not support frame sizes beyond 32 bits (though theoretically the chip can support it).
This PR does not change the behavior of the library for any other overloaded variant of the
SPIClass::transferfunction, and it does not change the behavior for any other boards other than the Teensy 4.xQuestions:
Tests:
Test 1: running with no additional parameter passed:
Oscilloscope output:

Test 2: 14-bit output
Code is as before, but buffers are uint16_t and SPI.transfer line is:
Output:

Test 3: 24-bit output
Again, same as before but with uint32_t buffers and the SPI.transfer() call is:
Output:
