Enable pin

Every pins has a mux that assigns which peripheral is in control of the pin.

If you use I2S2, the audio library automatically configures those muxes to take control of the pins.

The simplest way is to call pinMode() which will configure the mux to give control of the pin to GPIO. Or call analogWrite() which gives control to the timer hardware that creates PWM waveforms. Or if you use FlexIO_t4, its various begin functions will take control of the pin by writing to the mux.

If you want to write to the mux, you can. You'll probably need to use the reference manual. The mux registers you want are on page 400, each with a link to its detailed docs. Look for the red annotations for the mapping of NXP's complicated names to the simple pin numbers we use with Teensy.

The most complicated way, really only needed if you want to assure the audio library never takes control of the pin even for a brief time before you can call pinMode() or analogWrite() is to dive into the audio library source code. Knowing the mux register names from the reference manual can help you find and delete the places the audio library writes to the muxes to take control of those pins.
 
Using CORE_PIN2_CONFIG=0,CORE_PIN3_CONFIG=0,CORE_PIN4_CONFIG=0,CORE_PIN5_CONFIG=0CORE_PIN33_CONFIG=0 I disable my i2s pins,after some operation i want to enable these pin,how to enable them
Every pins has a mux that assigns which peripheral is in control of the pin.

If you use I2S2, the audio library automatically configures those muxes to take control of the pins.

The simplest way is to call pinMode() which will configure the mux to give control of the pin to GPIO. Or call analogWrite() which gives control to the timer hardware that creates PWM waveforms. Or if you use FlexIO_t4, its various begin functions will take control of the pin by writing to the mux.

If you want to write to the mux, you can. You'll probably need to use the reference manual. The mux registers you want are on page 400, each with a link to its detailed docs. Look for the red annotations for the mapping of NXP's complicated names to the simple pin numbers we use with Teensy.

The most complicated way, really only needed if you want to assure the audio library never takes control of the pin even for a brief time before you can call pinMode() or analogWrite() is to dive into the audio library source code. Knowing the mux register names from the reference manual can help you find and delete the places the audio library writes to the muxes to take control of those pins.
 
Enable:
Code:
CORE_PIN2_CONFIG  = 2;  //EMC_04, 2=SAI2_TX_DATA
CORE_PIN3_CONFIG  = 2;  //EMC_05, 2=SAI2_TX_SYNC
CORE_PIN4_CONFIG  = 2;  //EMC_06, 2=SAI2_TX_BCLK
CORE_PIN5_CONFIG = 2;  //EMC_08, 2=SAI2_RX_DATA
CORE_PIN33_CONFIG = 2;  //EMC_07, 2=SAI2_MCLK
 
Back
Top