Teensy 4.1 and SPI1

Status
Not open for further replies.

Goldfinch

Member
Hello all,

I am using two SPIs for my project. I figured out that the first SPI instance (SPI) corresponds to LPSPI4 and the second (SPI1) corresponds to LPSPI3.

While LPSPI4 works fine (checked on the scope), I am not seeing LPSPI3 MOSI and SCK signals. Here is my code to initialize those:

// LPSPI4
SPI.begin();
SPI.beginTransaction(SPISettings(50000000, MSBFIRST, SPI_MODE0));

// LPSPI3
SPI1.begin();
SPI1.beginTransaction(SPISettings(50000000, MSBFIRST, SPI_MODE0));

Pins used for LPSPI4:
SCK = 13
SOUT(MOSI)= 11


Pins used for LPSPI3:
SCK = 27
SOUT (MOSI) = 26

I tried the SPI1.setSCK() and SPI1.setMOSI() calls, but this changes nothing.

If I manually configure the processor pads like the following, I can see SCK on the scope:

CORE_PIN27_CONFIG = MODE_ALT2; // SCK

I am unable to see the MOSI signal, even if I configure the pad:

CORE_PIN26_CONFIG = MODE_ALT2; // MOSI

So my questions are:
What am I doing wrong?
Why do I have to configure a pad to see the SCK signal? Normally the SPI1 class use it as default.
Why can't I see the MOSI signall?

I am quite lost. Maybe I am doing a stupid mistake.
 
Last edited:
I'm using SPI1 on a Teensy 4.1 - I had to use SPI1.setCS(38) and SPI1.setMISO(39) before calling SPI1.begin() because I was using those alternate pins, but MOSI and CLK are the same as yours and appear to be the default. Your clock speed looks really high, have you tried testing with a slower transfer rate?
 
Status
Not open for further replies.
Back
Top