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

SPI1 multiple byte transfer on Teensy LC #10

Open
wjszlachta opened this issue May 21, 2016 · 0 comments
Open

SPI1 multiple byte transfer on Teensy LC #10

wjszlachta opened this issue May 21, 2016 · 0 comments

Comments

@wjszlachta
Copy link

Hi there, I have been trying to benchmark the SPI bus on my Teensy LC and reproduce some of the results in:

https://forum.pjrc.com/threads/27689-Teensy-LC-Beta-Testing/page3
https://github.com/manitou48/DUEZoo/blob/master/SPIperf.txt

I switched from SPI to SPI1 to get 24 MHz clock, but I couldn't get SPI1 transfer(void *buf, size_t count) to work with my code - the function hangs on the last line in SPI.h:

inline static void transfer(void *buf, size_t count) {
  ...
  *p = SPDR;
}

Looking at the sources in benchmark:

https://github.com/manitou48/teensy3/blob/master/spi1perf.ino

the implementation of spi1_transfer(void *buf, size_t count) is identical to transfer(void *buf, size_t count) apart from the last line, where:

inline static void transfer(void *buf, size_t count) {
  ...
  *p = SPI1_DL;
}

I replaced *p = SPDR with *p = SPI1_DL in transfer(void *buf, size_t count) of SPI1Class and everything seems to be working correctly as far as I can tell.

Many thanks!

P.S.
If that helps, I seem to recall that transfer(void *buf, size_t count) in SPIClass (not SPI1Class) works correctly.

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

No branches or pull requests

1 participant