This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-AM263: Changing PIN_MODE dynamically SPI to GPIO

Part Number: LP-AM263
Other Parts Discussed in Thread: SYSCONFIG

Hello,

I need to change all my MCSPI0 pins to GPIOs and back again.

In sysconfig I have initially set up only one GPIO as an interrupt and an instance of MCSPI.

I have tried defining a new Pinmux_PerCfg_t struct and setting it by running Pinmux_config but it doesn't seem to do anything.

I thought maybe it was because I had to close the mcspi instance first but that didn't change anything either.

Below is the auto-generated pinmux from sysconfig and the struct I wanted to change to.

Thank in advance,

Chris

static Pinmux_PerCfg_t gPinMuxMainDomainCfg[] = {
{
    PIN_EPWM0_A,
    ( PIN_MODE(7) | PIN_PULL_UP | PIN_SLEW_RATE_LOW | PIN_QUAL_SYNC | PIN_GPIO_R5SS0_0 )
},
{
    PIN_SPI0_CLK,
    ( PIN_MODE(0) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW )
},
{
    PIN_SPI0_D0,
    ( PIN_MODE(0) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW )
},
{
    PIN_SPI0_D1,
    ( PIN_MODE(0) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW )
},
{
    PIN_SPI0_CS0,
    ( PIN_MODE(0) | PIN_PULL_DISABLE )
},

    {PINMUX_END, PINMUX_END}
};

Pinmux_PerCfg_t pinMuxGpioConfig[] = {
{
    PIN_EPWM0_A,
    ( PIN_MODE(7) | PIN_PULL_UP | PIN_SLEW_RATE_LOW | PIN_QUAL_SYNC | PIN_GPIO_R5SS0_0 )
},
{
    PIN_SPI0_CLK,
    ( PIN_MODE(7) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW )
},
{
    PIN_SPI0_D0,
    ( PIN_MODE(7) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW )
},
{
    PIN_SPI0_D1,
    ( PIN_MODE(7) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW )
},
{
    PIN_SPI0_CS0,
    ( PIN_MODE(7) | PIN_PULL_DISABLE )
},
    {PINMUX_END, PINMUX_END}
};

  • Hi Chris

    To access the Pin mux Configuration, you will have to unlock the MMR and then configure Pin mux as shown below:

    If you are using the Pinmux_config API you are already doing it:

    For Enabling GPIO, along with Pinmux configuration you will also have to set the direction:

    I have assigned the ticket to McSPI expert for further insights.

    Hope it helps.

    Thanks & Regards

    Sri Vidya