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.

MSPM0L1106: Question on GPIO settings :

Part Number: MSPM0L1106
Other Parts Discussed in Thread: LP-MSPM0L1306, SYSCONFIG

Tool/software:

Hi Teams,

During testing on my MSPM0L1106 PCBA, I had the following questions and please help to provide me suggestion and solution :

Question 1 :
- MCU VDD = 1.8V
- A protential divider with upper R1=220K and lower R2=100K to GND.
- MCU PA2 is connected to the connection between R1 and R2.
- PA2 is configured as input without any pull resistor.

By using software and multi-meter to measure on PA2, the result are 0 and 0V respectively. When 5V is applied to R1, the same result is obtained. The expected result should be 1 and ~1.56V.

When R1 is changed to 22K, the measured result will be 1 and ~1.6V respectively. What is the cause of the problem? (Remark: this circuit is working with other MCU, 8051 core.)

Question 2 :
With the same software in Q1 above, I tested on LP-MSPM0L1306 LaunchPad.
Added 220K resistor to 5V and R6 on the board. Although the VDD is 3.3V on LaunchPad, but the voltage on R6 is 0V too.
- By using the original LaunchPad and the firmware in Q1, I added following code to setup PA2 as input with pull up resistor after system initialized and measure the voltage on R6. The voltage is close to 0 too and I was expecting certain voltage. What is the cause of it?
     DL_GPIO_initDigitalInput(GPIO_PA_PA2_IOMUX);
     DL_GPIO_initDigitalInputFeatures( GPIO_PA_PA2_IOMUX, DL_GPIO_INVERSION_DISABLE, DL_GPIO_RESISTOR_PULL_UP, DL_GPIO_HYSTERESIS_DISABLE, DL_GPIO_WAKEUP_DISABLE );
- If the code is changed to setup PA2 as output high after system initialised adn measure the voltage on R6. The voltage is close to 0 too and I was expecting 3.3V, What is the cause of it?
     DL_GPIO_initDigitalOutput(GPIO_PA_PA2_IOMUX);
     DL_GPIO_setPins(GPIO_PA_PORT, GPIO_PA_PA2_PIN);

Question 3 :
Based on Q2, I test on PA3 again. PA3 is configured as output low in .syscfg.
- PA3 is setup as input with pull up resistor after system initialized and measure the voltage on PA3 (header J2). The voltage is close to 0 too and I was expecting 3.3V. What is the cause of it?
     DL_GPIO_initDigitalInput(GPIO_PA_PA3_IOMUX);
     DL_GPIO_initDigitalInputFeatures( GPIO_PA_PA3_IOMUX, DL_GPIO_INVERSION_DISABLE, DL_GPIO_RESISTOR_PULL_UP, DL_GPIO_HYSTERESIS_DISABLE, DL_GPIO_WAKEUP_DISABLE );
- PA3 is setup as output high, 3.3V can be meaured.

Question 4 :
I notice that the generated function, SYSCFG_DL_GPIO_init(), do not have the code, "DL_GPIO_initDigitalInput(GPIO_PA_PA2_IOMUX);" for PA2 as an input. Is this correct? (Remark: Other input GPIOs have the corresponding lines.)

AlanC.

  • On the Launchpad there is a resistor connected to PA2 for Rosc. I don't know why they don't put a jumper:

  • Hi Alan,
    Can you share your sysconfig file? I want to check if there may be something wrong with it. Also, the way to set up the output will be to add the "DL_GPIO_enableOutput" function after the initDigitalOutput & setPins. Also keep in mind Keith's comment on the pin having a pull-down resistor in the launchpad.

    Best Regards,

    Diego Abad

  • Hi Diego Abad,

    I noticed that there is a R6 pull-down resistor in the launchpad and it has the same value in my product. The following is the connection of my testing with lauchpad.

    I created empty project and configured PA2 as input without any internal pull resistor. I attached the whole project to you for your reference.empty_new.zip

    In my testing, when the switch is closed, PA2 should have ~1.5V. But my measurement is 0V.

    Inside the main() function, I added the codes that I set PA2 and PA3 to input and output. (Remark: they are disabled by default by #if and #endif.) I am locking forward on your analysis result. Thank you for your support.

    AlanC.

  • Hi Alan,
    It seems to me that the problem relies on the fact that if the pin is not experiencing any voltage input when connected to the pull-down resistor, likely, the resistor's value is impeding doing a reading in the pin, AKA the pull-down value should be reduced. As for your other questions:
    2. PA2 seems to have a little voltage when initialized as an input with the pull-up resistor (around 100mv). This is most likely due to the pull-down resistor connected to it (also, it's hard to prove a value out of the small R6 resistor.) However, I do see regular I/O behavior from this pin when configured to output high (3.3V.) Remember that by default, the input reading values should be high impedance, AKA it doesn't really output a signal. For more information, I recommend looking over Figure 9-1. Superset IO Slice in the TRM.
    3. I did both tests (input + pull-up & output high,) and both give me around 3.3V. The configuration was done in SYSCONFIG, and the code runs an empty loop.
    4. You probably use this function when switching back from another mode, aka output mode. The default functionality for I/Os is input, so the only thing SYSCONFIG has to do is set up its configuration.
    Best Regards,
    Diego Abad

  • Hi Diego Abad,

    "3. I did both tests (input + pull-up & output high,) and both give me around 3.3V. The configuration was done in SYSCONFIG, and the code runs an empty loop."
    With the launchpad itself, I got the same result as you. However my question is when I am set PA2 as input without any pull resistor in SYSCONFIG and added 220K 5V potential divider to it. The voltage on that pin will become 0. The theoretically voltage should be ~1.5xV. Is it caused by the clamping diode on the GPIO? (I'm sorry to tell you that I'm a software guy and not much familiar with the electronic.)

    "4. You probably use this function when switching back from another mode, aka output mode. The default functionality for I/Os is input, so the only thing SYSCONFIG has to do is set up its configuration."
    No. I am not switching the IO from other mode, just switch between input and output. In my project provided above, PA2 and PA3 are set to input without pull resistor in SYSCONFIG. Before the main loop, if the code that switching PA2 and PA3 to output high by removing the #if and #endif. I found that I cannot measure 3.3V on the pins. If PA2 and PA3 are set to output high in SYSCONFIG directly, it is able to do so. Is there anything wrong in that code?

    AlanC.

  • Hi Alan,
    3. Let me consult about this

    4.  The configuration you are doing seems good to me (except for the resetGPIO.) However, the if else define statement is weird to me since it seems it runs all codes at the same time (makes it input, then output low, and then output high.) I will try just configuring one at a time, and see what addition of your code makes it break. Something like this:

    #if 0
        DL_GPIO_initDigitalInput(GPIO_GRP_0_PIN_0_IOMUX);
        DL_GPIO_initDigitalInputFeatures( GPIO_GRP_0_PIN_0_IOMUX,
            DL_GPIO_INVERSION_DISABLE, DL_GPIO_RESISTOR_NONE, DL_GPIO_HYSTERESIS_DISABLE, DL_GPIO_WAKEUP_DISABLE );
        DL_GPIO_initDigitalInput(GPIO_GRP_0_PIN_1_IOMUX);
        DL_GPIO_initDigitalInputFeatures( GPIO_GRP_0_PIN_1_IOMUX,
            DL_GPIO_INVERSION_DISABLE, DL_GPIO_RESISTOR_PULL_UP, DL_GPIO_HYSTERESIS_DISABLE, DL_GPIO_WAKEUP_DISABLE );
    #endif

    #if 1
        DL_GPIO_initDigitalOutput(GPIO_GRP_0_PIN_0_IOMUX);
        DL_GPIO_initDigitalOutput(GPIO_GRP_0_PIN_1_IOMUX);
        DL_GPIO_enableOutput(GPIOA, DL_GPIO_PIN_2);
        DL_GPIO_enableOutput(GPIOA, DL_GPIO_PIN_3);
        DL_GPIO_clearPins(GPIOA, DL_GPIO_PIN_2);
        DL_GPIO_clearPins(GPIOA, DL_GPIO_PIN_3);
    #endif

    #if 2
        DL_GPIO_setPins(GPIOA, DL_GPIO_PIN_2);
        DL_GPIO_setPins(GPIOA, DL_GPIO_PIN_3);
    #endif
    Best Regards,
    Diego Abad
  • Hi Diego Abad,

    As my understanding, the code above within "#if 0" will not be executed. The others will not be executed.

    It just like that value 0 in unsigned char variables will be considered as False and other values are True.

    AlanC.

  • Hi Alan,
    I thought the intention was to make the GPIOs change between one functionality and the other. If that's the case, then the I/Os should be configured on whatever SYSCONFIG had configured. Based on the code you sent, this will be PA2 & PA3 as inputs. I think that if you are trying to make them an output and being high, the code bellow should do the trick:

       DL_GPIO_initDigitalOutput(GPIO_GRP_0_PIN_0_IOMUX);
       DL_GPIO_initDigitalOutput(GPIO_GRP_0_PIN_1_IOMUX);
       DL_GPIO_setPins(GPIOA, DL_GPIO_PIN_2);
       DL_GPIO_setPins(GPIOA, DL_GPIO_PIN_3);
       DL_GPIO_enableOutput(GPIOA, DL_GPIO_PIN_2);
       DL_GPIO_enableOutput(GPIOA, DL_GPIO_PIN_3);
    As for the voltage divider question you were asking, you are correct. The voltage there should be around 1 to 1.5V. There might be the possibility that the input is sinking some current going through the pin, so I'll test this out on my own and I'll let you know if I can replicate it.  
    Best Regards,
    Diego Abad
  • Hi Diego Abad,

    Thank you very much on your support. Yes, you are correct. I really want to switch GPIO between input and output in run time.

    For the voltage divider question, I am looking forward on your test result.

    FYI, there is exactly the same voltage divider on PA17 in our product. The configuration of PA2 and PA17 are same in SYSCFG. But the voltage measured on PA17 is correct. Both our hardware team and I cannot explain it.

    AlanC.

  • Hi Alan,
    Sounds good. The code I provided before should make the pins become output. I'll need more time to test this out. I should have an update on this by tomorrow or Monday next week.

    Best Regards,

    Diego Abad

  • Hi Alan,
    I replicated the setup and noticed a similar behavior to what you mentioned. When R1 is 220K, I get a value of around 22.588mV, while when using 22K, I get a value of 1.158V. The MCU could be draining some of the power at PA2. This could be because of how PA2/ROSC is connected to the FCL circuit of the MCU. My advice for now is to use another pin or a resistor value that gives the voltage you want.
    Best Regards,
    Diego Abad

  • Hi Diego Abad,

    Thank you again for your support. I'm sorry to tell you that all the IOs are used up. Even, PA18 (BSL Invoke), PA19 and PA20 (debug ports) are shared as application usage. Your message was passed to our hardware team and they will handle it.

    AlanC.