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.

MSPM0C1104: Pin on the fly input / output switching

Part Number: MSPM0C1104
Other Parts Discussed in Thread: MSPM0C1103

Can GPIO pins on the MSPM0C1104 be switched dynamically between input (true high-Z) and output (push-pull) without reconfiguring the IOMUX? If so, which driverlib function guarantees that the pin is fully high-impedance (no keeper, no pull, no leakage)?

  • Hi Rob,
    No, you will need to switch the IOMUX every time you want to switch from one state to the other. Please refer to the IOMUX diagram for reference (found in the IOMUX chapter in the TRM)

    Best Regards,

    Diego Abad

  • I try that with this test code but PA27 switch not to input :

    #include "ti_msp_dl_config.h"
    #include <stdint.h>
    
    #define PORTA     GPIO_GRP_0_PORT
    #define CP0_PIN   GPIO_GRP_0_CP0_PIN     // PA26 (anode LED1)
    #define CP1_IOMUX GPIO_GRP_0_CP1_IOMUX   // PA27 (vrije pin)
    #define CP2_PIN   GPIO_GRP_0_CP2_PIN     // PA28 (cathode LED1)
    #define CP0_IOMUX GPIO_GRP_0_CP0_IOMUX
    #define CP2_IOMUX GPIO_GRP_0_CP2_IOMUX
    
    static inline void dly(volatile uint32_t n){ while(n--) __NOP(); }
    
    int main(void)
    {
        SYSCFG_DL_init();
    
        for(;;)
        {
            /* ---------- ON: wissel IOMUX INPUT -> OUTPUT (glitchvrij) ---------- */
    
            // 0) vrije pin echt vrij (kies 1 van de 2 regels)
            DL_GPIO_initDigitalInput(CP1_IOMUX);      // PA27 = input, no pull (SysCfg)
            // DL_GPIO_initAnalog(CP1_IOMUX);         // (alternatief) PA27 = Analog (zeker high-Z)
    
            // 1) PRELOAD OUT-latch (pads nog géén output!)
            DL_GPIO_clearPins(PORTA, CP2_PIN);        // PA28 latch = LOW (cathode)
            DL_GPIO_setPins  (PORTA, CP0_PIN);        // PA26 latch = HIGH (anode)
            dly(50);                                   // korte guard
    
            // 2) IOMUX → DigitalOutput (runtime switch)
            DL_GPIO_initDigitalOutput(CP2_IOMUX);     // PA28 wordt nu echt LOW
            DL_GPIO_initDigitalOutput(CP0_IOMUX);     // PA26 wordt nu echt HIGH
    
            dly(600000);                               // ~0.6 s AAN (LED1 zou nu alleen moeten branden)
    
            /* ---------- OFF: terug naar INPUT (IOMUX terug) ---------- */
    
            DL_GPIO_initDigitalInput(CP0_IOMUX);      // PA26 terug naar input
            DL_GPIO_initDigitalInput(CP2_IOMUX);      // PA28 terug naar input
            // (optioneel) latches wissen, heeft geen effect op inputs:
            DL_GPIO_clearPins(PORTA, CP0_PIN);
            DL_GPIO_clearPins(PORTA, CP2_PIN);
    
            dly(300000);                               // ~0.3 s UIT
        }
    }
    



  • Diego,

    Thanks for the info, if I look to figure 9-1  I can leave the pin to output and need to
    activate the shutdown ti switch the pin to Hi Z.
    I have to look for the shutdown command.

    best regards,

    rob Keij

  • Hi Rob,
    You are correct. However, the MSPM0C1103/4 devices don't support wake from SHUTDOWN mode. I would recommend any other mode like STANDBY0/1.

    Best Regards,

    Diego Abad

  • Hi Diego,

    Ok I try and you right for every function change of the pin and change via IOMUX  needs a complete restart.
    So the simple design with the charlieplex led is unusable. I was hoping to use the MSPM0C1104.
    I stil not understand that there is no possibility to switch a pin from output to input or floating.
    I was sure this should be possible and produce 100 pcba's :(

    I mark you first answer as "This resolved my issue"    (This answered my issue)

    Thanks,

    best regards,

    Rob keij


  • Hi Rob,
    Let me see if I can get a deeper explanation on the topic.

    Best Regards,

    Diego Abad

  • Hi Rob,

    Actually, after talking with my team, I confirmed that as long as the functionality remains within GPIO functions (low, high, high-impedance,) the IOMUX should remain the same. However, if you want to switch from having no internal pull-ups/pull-downs to having them, that's when the IOMUX changes.

    Best Regards,

    Diego Abad

  • #include "ti_msp_dl_config.h"
    #include <stdint.h>
    
    #define PA26_MASK  DL_GPIO_PIN_26
    #define PA27_MASK  DL_GPIO_PIN_27
    #define PA28_MASK  DL_GPIO_PIN_28
    
    static inline void dly(volatile uint32_t n){ while(n--) __NOP(); }
    
    /* -------------------------------------------------------------- */
    /* Tri-state en output helpers – alléén GPIO-registers             */
    /* -------------------------------------------------------------- */
    
    static inline void make_input_hiz(uint32_t mask)
    {
        // maak pin input (DOE bit = 0)
        GPIOA->DOE31_0 &= ~mask;
    }
    
    static inline void make_output(uint32_t mask)
    {
        // maak pin output (DOE bit = 1)
        GPIOA->DOE31_0 |= mask;
    }
    
    /* -------------------------------------------------------------- */
    /* Eén LED aansturen: A=anode, C=kathode, F=vrije pin             */
    /* -------------------------------------------------------------- */
    
    static void drive_one(uint32_t A_mask, uint32_t C_mask, uint32_t F_mask, uint32_t on_ticks)
    {
        // alles los
        make_input_hiz(PA26_MASK | PA27_MASK | PA28_MASK);
    
        // vrije pin blijft input (high-Z)
        make_input_hiz(F_mask);
    
        // vooraf: kathode laag, anode hoog
        GPIOA->DOUT31_0 &= ~C_mask;
        GPIOA->DOUT31_0 |=  A_mask;
    
        // outputs activeren
        make_output(C_mask);
        make_output(A_mask);
    
        dly(on_ticks);
    
        // terug los
        make_input_hiz(A_mask | C_mask);
    }
    
    /* -------------------------------------------------------------- */
    /* main – sequentieel alle zes LED-combinaties                    */
    /* -------------------------------------------------------------- */
    
    int main(void)
    {
        SYSCFG_DL_init();
    
        while (1)
        {
            drive_one(PA26_MASK, PA28_MASK, PA27_MASK, 500000); // L1
            drive_one(PA27_MASK, PA28_MASK, PA26_MASK, 500000); // L2
            drive_one(PA26_MASK, PA27_MASK, PA28_MASK, 500000); // L3
            drive_one(PA28_MASK, PA26_MASK, PA27_MASK, 500000); // L5
            drive_one(PA28_MASK, PA27_MASK, PA26_MASK, 500000); // L6
            drive_one(PA27_MASK, PA26_MASK, PA28_MASK, 500000); // L7
            dly(300000);
        }
    }
    



    Thanks Diego