Selecting Alternative Functions of a Pin

Status
Not open for further replies.

FAlameda

Active member
Hello

I am drawing a PCB that uses a Teensy 3.6 but I have not yet got the physical board to do the tests.

I need Serial 1 and also SPI1 working but SPI1 uses pins 0 and 1, which are also used by Serial1. I think the Serial 1 pins can move up to Pin 27 and Pin 26 but I'm not sure how to do it or even if it can be done.

Would something like this work?

Code:
*portConfigRegister(0)  = PORT_PCR_MUX(2);	// Pin 0  >> SPI1_MOSI
*portConfigRegister(1)  = PORT_PCR_MUX(2);	// Pin 1  >> SPI1_MISO
*portConfigRegister(26) = PORT_PCR_MUX(3);	// Pin 26 >> Serial1_TX
*portConfigRegister(27) = PORT_PCR_MUX(3);	// Pin 27 >> Serial1_RX

For basic use, is it necessary to configure pin pull-up, pin filter and that stuff?

Code:
*portConfigRegister(X) = PORT_PCR_MUX(Y) ) | PORT_PCR_PFE;

Is there any tutorial for beginners on how to configure the alternative functions of the pins?

Thanks and sorry for my awful English.
 
you could also use the alternate SPI1 pins 5,20,21 as well

dont forget to *.begin AFTER you set the pins
 
you could also use the alternate SPI1 pins 5,20,21 as well

dont forget to *.begin AFTER you set the pins

That would be a good thing to demonstrate on the PJRC page for proper function as one could wrongly intuit it as sensible to have it work the other way.
 
The latest versions of SPI, Wire and Serial# are all designed to allow changing the pins before or after you call begin().

Of course, if you call something like SD.begin(), you must configure the pins before, since it actually does communication on the pins. Hopefully that's obvious? (and it's in many of the examples....)
 
The latest versions of SPI, Wire and Serial# are all designed to allow changing the pins before or after you call begin().

Of course, if you call something like SD.begin(), you must configure the pins before, since it actually does communication on the pins. Hopefully that's obvious? (and it's in many of the examples....)

Nice .......
 
Status
Not open for further replies.
Back
Top