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.

MSPM0G3507: How to coding BOR related interrupt subroutine

Part Number: MSPM0G3507
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hi expert

1.

when detect low power, before the BOR i need do something like flash write, gpio on/off etc., so i will do these works

in interrupt subroutine, but i don't know how to coding, because i can't find example in SDK example project.

2.

i set BOR3(P2) in sysconfig(P1), in my understanding if VDD lower 2.93V(P3), the program will enter interrupt(if i enable interrupt related to BOR) ,

am i right?

thanks for your help.

  

  • Hi,

    BOR interrupt will be handled in NMI interrupt handler. Please refer to below code example.

    #include "ti_msp_dl_config.h"
    
    int main(void)
    {
        SYSCFG_DL_init();
        DL_SYSCTL_activateBORThreshold();
    //    DL_SYSCTL_setBORThreshold(DL_SYSCTL_BOR_THRESHOLD_LEVEL_1);
        DL_GPIO_clearPins(GPIO_GRP_0_PORT, GPIO_GRP_0_PIN_0_PIN);
        while (1) {
    
        }
    }
    
    void NMI_Handler(void)
    {
        switch(DL_SYSCTL_getPendingNonMaskableInterrupt()){
        case DL_SYSCTL_NMI_IIDX_BORLVL:
            DL_GPIO_togglePins(GPIO_GRP_0_PORT, GPIO_GRP_0_PIN_0_PIN);
            delay_cycles(200000);
            DL_SYSCTL_activateBORThreshold();
    //        DL_SYSCTL_clearNonMaskableInterruptStatus(SYSCTL_NMIICLR_BORLVL_CLR);
    //        __BKPT(0);
            break;
        default:
            break;
        }
    }
    

    i set BOR3(P2) in sysconfig(P1), in my understanding if VDD lower 2.93V(P3), the program will enter interrupt(if i enable interrupt related to BOR) ,

    am i right?

    Yes, you're right/

    Regards,

    Zoey

  • Hi zoey

    thanks for your help, do i need make any setting in sysconfig to enable interrupt?

    or just run DL_SYSCTL_activateBORThreshold(); then the interrupt will enable automatically?

  • Hi,

    The DL_SYSCTL_activateBORThreshold(); will make the BOR level you set active, and NMI can always cause interrupt without any enable action. Only IRQ should be managed by NVIC(that you might enable NVIC).

    Regards,

    Zoey

  • Hi Zoey

    thanks for your help, it's done.