Saint Chablo
Member
Hello, im Darren and im new to this community and teensy.
Im trying to switch the primary i2c pins(18 and 19) to (16 and 17) on my teensy 4.0 board because i didnt realize only one set of 12c can be used at a time. im trying to connect some 12c devices but the 18 and 19 pins are being used for something else for a project. ive searched through some threads and the code that people use to do this is this:
#include <Wire.h>
void setup() {
Wire.begin();
CORE_PIN18_CONFIG = 0; // turn off primary pins before enable alternates
CORE_PIN19_CONFIG = 0;
CORE_PIN16_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
CORE_PIN17_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
}
void loop() {
}
However, when i compile on arduino IDE, it says:
Arduino: 1.8.9 (Windows 10), TD: 1.51, Board: "Teensy 4.0, Serial, 600 MHz, Faster, US English"
pinchange: In function 'void setup()':
pinchange:9: error: 'PORT_PCR_MUX' was not declared in this scope
CORE_PIN16_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
^
pinchange:9: error: 'PORT_PCR_ODE' was not declared in this scope
CORE_PIN16_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
^
pinchange:9: error: 'PORT_PCR_SRE' was not declared in this scope
CORE_PIN16_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
^
pinchange:9: error: 'PORT_PCR_DSE' was not declared in this scope
CORE_PIN16_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
^
'PORT_PCR_MUX' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Now this is where i need your help. Am i missing something? Do i need to define something or include some libraries specific to this code because ive never seen this before ever.
Im trying to switch the primary i2c pins(18 and 19) to (16 and 17) on my teensy 4.0 board because i didnt realize only one set of 12c can be used at a time. im trying to connect some 12c devices but the 18 and 19 pins are being used for something else for a project. ive searched through some threads and the code that people use to do this is this:
#include <Wire.h>
void setup() {
Wire.begin();
CORE_PIN18_CONFIG = 0; // turn off primary pins before enable alternates
CORE_PIN19_CONFIG = 0;
CORE_PIN16_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
CORE_PIN17_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
}
void loop() {
}
However, when i compile on arduino IDE, it says:
Arduino: 1.8.9 (Windows 10), TD: 1.51, Board: "Teensy 4.0, Serial, 600 MHz, Faster, US English"
pinchange: In function 'void setup()':
pinchange:9: error: 'PORT_PCR_MUX' was not declared in this scope
CORE_PIN16_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
^
pinchange:9: error: 'PORT_PCR_ODE' was not declared in this scope
CORE_PIN16_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
^
pinchange:9: error: 'PORT_PCR_SRE' was not declared in this scope
CORE_PIN16_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
^
pinchange:9: error: 'PORT_PCR_DSE' was not declared in this scope
CORE_PIN16_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_ODE|PORT_PCR_SRE|PORT_PCR_DSE;
^
'PORT_PCR_MUX' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Now this is where i need your help. Am i missing something? Do i need to define something or include some libraries specific to this code because ive never seen this before ever.