Hi there, this is my first post here on the forum (hopefully the first of many).
Instead of asking a question, I'd like to share something that might be useful to other users.
I was needing to use some of the alternate functions of the Teensy 3.0's pins, and ended up locating the following comment from Paul:
I created the following generic process (via macros) which seems to work for redefining the pins' functions:
Note: Edited based on updated information.
The benefit of this is that you can define your pins in the typical way (using the Teensy 3.0 pin numbers) without needing to worry about their obscure port designations.
For example, if we have a Teensy pin defined like this:
We can then simply switch to it's alternate function like this:
Information about the alternate functions of each pin can be found in the data sheet (K20 Sub-Family Data Sheet, Rev. 4 5/2012) in Section 8.1 (K20 Signal Multiplexing and Pin Assignments) which is located on pages 56-58.
Please let me know if I'm missing a more recent or elegant solution to this particular issue. I'm relatively new to embedded development, so I'm learning this stuff as I go.
-Dan
Instead of asking a question, I'd like to share something that might be useful to other users.
I was needing to use some of the alternate functions of the Teensy 3.0's pins, and ended up locating the following comment from Paul:
Currently there isn't software support to enable the alternates, but it is possible to make the signals appear on those pins with some direct register writes.
I created the following generic process (via macros) which seems to work for redefining the pins' functions:
Code:
#define CORE_PIN_CONFIG(pin) (CORE_PIN##pin##_CONFIG)
#define pinAlt(pin, alt) {CORE_PIN_CONFIG(pin) = PORT_PCR_DSE | PORT_PCR_MUX(alt);}
The benefit of this is that you can define your pins in the typical way (using the Teensy 3.0 pin numbers) without needing to worry about their obscure port designations.
For example, if we have a Teensy pin defined like this:
Code:
#define I2S_MCLK_PIN 28
We can then simply switch to it's alternate function like this:
Code:
pinAlt(I2S_MCLK_PIN, 4);
Information about the alternate functions of each pin can be found in the data sheet (K20 Sub-Family Data Sheet, Rev. 4 5/2012) in Section 8.1 (K20 Signal Multiplexing and Pin Assignments) which is located on pages 56-58.
Please let me know if I'm missing a more recent or elegant solution to this particular issue. I'm relatively new to embedded development, so I'm learning this stuff as I go.
-Dan
Last edited: