MSPM0G3107: How to wake up the Microcontroller Mspm0g3107 using pin PA26 which is used as analog pin

Part Number: MSPM0G3107
Other Parts Discussed in Thread: MSPM0G3507, SYSCONFIG

Tool/software:

Hello Team,

We are using the MSPM0G3107 microcontroller, with pin PA26 configured as an analog battery voltage input. When the voltage on this pin rises above 1 V, the microcontroller should wake up. Conversely, when the voltage on PA26 falls below 1 V, the microcontroller should enter sleep mode. Could you please guide us on how to implement this functionality?

             

  • Hi,

    I will reply to you by tomorrow.

    Best Regards,
    Peter

  • Hi Peter,

    could you please let us know how to make the MSPM0G3107 microcontroller, with pin PA26 configured as an analog battery voltage input. When the voltage on this pin rises above 1 V, the microcontroller should wake up. Conversely, when the voltage on PA26 falls below 1 V, the microcontroller should enter sleep mode.

    Best Regards,

    Pradeep

  • Hi Pradeep,

    I believe you can first refer to the code sample "adc12_triggered_by_timer_event_stop" in our MSPM0 SDK .

    "Your MSPM0_SDK Download Folder\mspm0_sdk_xxxx\examples\nortos\LP_MSPM0G3507\driverlib\”

    Best Regards,
    Peter

  • Hello Peter,

    Thank you for your support.

    I found the below code:-

    #define ADC12_BIT_RESOLUTION (12)
    #define ADC12_REF_VOLTAGE (3.3)
    #define ADC12_MONITOR_VOLTAGE (1.5)
    #define ADC12_MONITOR_VALUE \
        ((1 << ADC12_BIT_RESOLUTION) * (ADC12_MONITOR_VOLTAGE / ADC12_REF_VOLTAGE))

    int main(void)
    {
        SYSCFG_DL_init();

        /* Configure window comparators to detect changes above and below VDDA/2 */
        DL_ADC12_configWinCompHighThld(
            ADC12_0_INST, (uint16_t) ADC12_MONITOR_VALUE);

        DL_ADC12_configWinCompLowThld(
            ADC12_0_INST, (uint16_t) ADC12_MONITOR_VALUE);

        NVIC_EnableIRQ(ADC12_0_INST_INT_IRQN);

        DL_TimerG_startCounter(TIMER_0_INST);

        while (1) {
            __WFI();
        }
    }

    void ADC12_0_INST_IRQHandler(void)
    {
        switch (DL_ADC12_getPendingInterrupt(ADC12_0_INST)) {
            case DL_ADC12_IIDX_WINDOW_COMP_HIGH:
                DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
                break;
            case DL_ADC12_IIDX_WINDOW_COMP_LOW:
                DL_GPIO_setPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
                break;
            default:
                break;
        }
    }
    Here LED is becoming on and off based on the ADC12_MONITOR_VALUE. but i want to make the mcu wake up and sleep .how this can be achieved?
    Best Regards,
    Pradeep
  • Hi Pradeep,

    If you have set the low power mode in the Sysconfig, then you can use "__WFI()" or "__WFE()" to enter the corresponding low power mode.

    Best Regards,
    Peter