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.

MSPM0L1306: MSPM0L1306 UART0 RX on PA18

Part Number: MSPM0L1306
Other Parts Discussed in Thread: SYSCONFIG

Hello everyone,

I am having some issues with the UART0 module of the MSPM0L1306. 

If I map the UART0 RX pin to PA9 everything works fine. An interrupt is thrown as configured once data is received. But if I reconfigure the UART0_RX pin to be on PA18 nothing is being received anymore. Transmit is still working fine. All registers from the UART are configured exactly the same, the only difference is that the IO MUX 19 is now set to the alternative function 2 (UART0_RX).

Has anyone else experienced the same issue?

PA18 does not work

PA9 works fine

  • Hi Luca,

    I'm sorry for the delay to answer your question. Can you share the portion of your code that configures PA9 and also PA18? (I don't need your entire project, only the lines of code used to setup the UART and IO pins.

  • GPIO code:

    /// Constructor
    ///
    /// @param port   GPIO port struct (e.g. GPIOA)
    /// @param pin    The pin number (e.g. 1 for PA1)
    Gpio(GPIO_Regs* const port, const uint32_t pin)
      : M_PORT{port},
        M_PIN_INDEX{pin},
        M_PIN_MASK{static_cast<uint32_t>(1U) << pin} {
        ASSERT(pin < 32U);
    }
    
    /// Configure the pin as an digital input pin
    ///
    /// @param function           Alternate function selection (0 ... 15)
    /// @param pull               Pull resistor (see #Pull)
    /// @param inversion          Input inversion (see #Inversion)
    /// @param hysteresis         Input hysteresis (see #Hysteresis)
    void ConfigureAsInput(const uint32_t function,
                        const Pull pull = Pull::NONE,
                        const Inversion inversion = Inversion::DISABLE,
                        const Hysteresis hysteresis = Hysteresis::TTL) {
        uint32_t reg{};
        reg |= IOMUX_PINCM_INENA_ENABLE;
        reg |= IOMUX_PINCM_PC_CONNECTED;
        reg |= static_cast<uint32_t>(function);
        reg |= static_cast<uint32_t>(pull);
        reg |= static_cast<uint32_t>(inversion);
        reg |= static_cast<uint32_t>(hysteresis);
        SetMux(reg);
    }
    
    /// Configure the pin as an digital output pin
    ///
    /// @param function           Function selection (0 ... 15)
    /// @param outputType         Output type for pin (see #OutputType)
    /// @param inversion          Output inversion (see #Inversion)
    void ConfigureAsOutput(const uint32_t function,
                         const OutputType outputType = OutputType::PUSH_PULL,
                         const Inversion inversion = Inversion::DISABLE) {
        uint32_t reg{};
        reg |= IOMUX_PINCM_PC_CONNECTED;
        reg |= static_cast<uint32_t>(function);
        reg |= static_cast<uint32_t>(outputType);
        reg |= static_cast<uint32_t>(inversion);
        SetMux(reg);
        EnableOutput();
    }
    
    /// Set the mux register
    ///
    /// @param reg   The value to write to the mux register
    void SetMux(const uint32_t reg) {
        IOMUX->SECCFG.PINCM[M_PIN_INDEX] = reg;
    }

    Initialization:

    mcal:Common::ResetPeripheral(GPIOA);
    
    // Enable power
    mcal::Power::EnableGpioA();
    
    // Wait 16 cycles for the power to be enabled
    mcal::Common::DelayCycles(16U);
    
    // UART Pins
    mcal::Gpio uartTxPin(GPIOA, 17U);
    mcal::Gpio uartRxPin(GPIOA, 18U);
    
    // GPIO MUX Function 2 is UART
    uartTxPin.ConfigureAsOutput(2U);
    uartRxPin.ConfigureAsInput(2U);

    The UART muxed to other pins is not causing any issues, therefore I am pretty sure it is not an UART problem.

  • Hi Luca,

    Not sure what the issue is, but appears to be on your side.  I can switch between PA9 and PA18 for RX pin and receive data with an interrupt as expected.

    The code I used is "uart_external_loopback_interrupt" example project located in the SDK under driverlib examples.

    Using the Sysconfig tool, here is the definitions generated for the project:

    /* Defines for UART_0 RX = PA9 */
    #define UART_0_INST                                                        UART0
    #define UART_0_INST_IRQHandler                                  UART0_IRQHandler
    #define UART_0_INST_INT_IRQN                                      UART0_INT_IRQn
    #define GPIO_UART_0_RX_PORT                                                GPIOA
    #define GPIO_UART_0_TX_PORT                                                GPIOA
    #define GPIO_UART_0_RX_PIN                                         DL_GPIO_PIN_9
    #define GPIO_UART_0_TX_PIN                                         DL_GPIO_PIN_8
    #define GPIO_UART_0_IOMUX_RX                                     (IOMUX_PINCM10)
    #define GPIO_UART_0_IOMUX_TX                                      (IOMUX_PINCM9)
    #define GPIO_UART_0_IOMUX_RX_FUNC                      IOMUX_PINCM10_PF_UART0_RX
    #define GPIO_UART_0_IOMUX_TX_FUNC                       IOMUX_PINCM9_PF_UART0_TX
    
    
    /* Defines for UART_0 RX = PA18*/
    #define UART_0_INST                                                        UART0
    #define UART_0_INST_IRQHandler                                  UART0_IRQHandler
    #define UART_0_INST_INT_IRQN                                      UART0_INT_IRQn
    #define GPIO_UART_0_RX_PORT                                                GPIOA
    #define GPIO_UART_0_TX_PORT                                                GPIOA
    #define GPIO_UART_0_RX_PIN                                        DL_GPIO_PIN_18
    #define GPIO_UART_0_TX_PIN                                         DL_GPIO_PIN_8
    #define GPIO_UART_0_IOMUX_RX                                     (IOMUX_PINCM19)
    #define GPIO_UART_0_IOMUX_TX                                      (IOMUX_PINCM9)
    #define GPIO_UART_0_IOMUX_RX_FUNC                      IOMUX_PINCM19_PF_UART0_RX
    #define GPIO_UART_0_IOMUX_TX_FUNC                       IOMUX_PINCM9_PF_UART0_TX
    

    The only difference I can see in the project when I switch back and forth is:

    #define GPIO_UART_0_IOMUX_RX                                     (IOMUX_PINCM19) // PA18

    #define GPIO_UART_0_IOMUX_RX                                     (IOMUX_PINCM10) // PA9

  • Hello Dennis

    The UART issue has been resolved, thanks for looking into it.

    In the end it was a schematic mistake, the UART0 was marked as UART1. I would like to apologize for that.

    Best regards,

    Luca