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-Q1: Initializing the GPIO (GPIO_Config)

Part Number: MSPM0L1306-Q1
Other Parts Discussed in Thread: SYSCONFIG

Hello

I'm trying to create a simple program to configure GPIO on our board. I'm planning on creating a bare bones program without using Driver Lib (using it as a sort of a reference though). Looking at the overview for the GPIO module it looks like the starting point is the creation of the GPIO_PinConfig array, with each element corresponding to a pin on the MCU. 

I have some questions on this listed below:

  1. What happens to pins that are multiplexed?
  2. The documentation has no description of IOMUX module and how it interplays with this one. Can you help me with it?
  3. Example GPIO projects in Code composer studio (CCS) always start with configuring the IOMUX module before it actual starts working with GPIO registers. This isn't reflected in driverlib documentation. Am I missing something here?
  4. What happens in case of different pin configurations? Each of them have a different GPIO count now isn't it? Shouldn't this be reflected in the code as well?

Here is a piece of code in one (of many) example projects provided as part of CCS that initializes the GPIO module:

SYSCONFIG_WEAK void SYSCFG_DL_GPIO_init(void)
{

    DL_GPIO_initDigitalOutput(GPIO_LEDS_USER_LED_1_IOMUX);

    DL_GPIO_initDigitalInputFeatures(GPIO_SWITCHES_USER_SWITCH_1_IOMUX,
        DL_GPIO_INVERSION_DISABLE, DL_GPIO_RESISTOR_PULL_UP,
        DL_GPIO_HYSTERESIS_DISABLE, DL_GPIO_WAKEUP_DISABLE);

    DL_GPIO_setPins(GPIOA, GPIO_LEDS_USER_LED_1_PIN);
    DL_GPIO_enableOutput(GPIOA, GPIO_LEDS_USER_LED_1_PIN);
    DL_GPIO_setLowerPinsPolarity(GPIOA, DL_GPIO_PIN_14_EDGE_RISE_FALL);
    DL_GPIO_clearInterruptStatus(GPIOA, GPIO_SWITCHES_USER_SWITCH_1_PIN);
    DL_GPIO_enableInterrupt(GPIOA, GPIO_SWITCHES_USER_SWITCH_1_PIN);

}

Wading into `DL_GPIO_initDigitalOutput`, I see it looks like this:
__STATIC_INLINE void DL_GPIO_initDigitalOutput(uint32_t pincmIndex)
{
    /* GPIO functionality is always a pin function of 0x00000001 */
    IOMUX->SECCFG.PINCM[pincmIndex] =
        (IOMUX_PINCM_PC_CONNECTED | ((uint32_t) 0x00000001));
}
 
Could you expand on this a bit?
  • Are you planning to not use SysConfig either, or just Driverlib?, because obviously SysConfig uses DriverLib.

  • I plan to NOT use DriverLib as a distinct library. I am merely consulting the DriverLib src code to get a feel for the register bank and similar things and then create . Which is why I am not very clear on the approach here regarding IOMUX usage.

    Could you expand a bit on my doubts above please?

  • 1. For the MSPM0, it use PINCMx to reconginze and configure the related IO.

    2. For MSPM0, it use IOMUX to control the IO and select the functions.

    3. Another improtant thing on MSPM0 is that it treat GPIO as a peripheal. It is always Peripheral 01 for output or input mux.

    4. If you want to use register to coding, you need to look deep into the TRM.

  • Thanks a lot  for the reply. I have a few doubts on it as written below:

    For the MSPM0, it use PINCMx to reconginze and configure the related IO

    Can you elaborate a bit on what you mean by "recognize and configure the related IO"? Does it mean identify the corresponding pin? Configure it as Input/Output? 

    You also said:

    For MSPM0, it use IOMUX to control the IO and select the functions

    Again what do we mean by "control the IO" here? Enable/Disable? I do understand that 'functions' here likely means callback functions to trigger on an interrupt on the corresponding pin aka sort of an ISR but what exactly do you mean by "control" I do not understand. 

    I am unable to find a comprehensive guide from TI on using CMSIS in-lieu of DriverLib (and I get it why that would be the case). However if there is such a guide (may or may not be TI endorsed) for TI cortex MCUs, please do let me know. I am specifically looking at integrating the Driver code for specific peripherals with the driver front end from CMSIS.

  • Just that you need to rewrite SysConfig Init, if you want to eliminate driverlib entirely