Skip to content

SPI1 multiple byte transfer on Teensy LC #10

Description

@wjszlachta

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions