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.

MSP432P401R: MSP432: INTERRUPT PRIORITY ISSUE

Part Number: MSP432P401R

Hello Everyone,

           I am working on MSP432P401M controller board(own design board) which is interfaced with PC using serial communication and we measure encoder pulses on GPIO pin, when high to low interrupt is triggered.

I want to transmit encoder count and load cell data  to PC in timer  interrupt after receiving 01 0F 07 FF FF FF command.

***So, I set the priority as per follows:-

 MAP_Interrupt_setPriority(INT_EUSCIA3,0x06);               // Serial communication with pc has highest priority
 MAP_Interrupt_setPriority(INT_T32_INT1,0x08);              // Timer1
 MAP_Interrupt_setPriority(INT_T32_INT2,0x10);              // Timer2
 MAP_Interrupt_setPriority(INT_PORT6,0x15);                  // Encoder has highest priority
 MAP_Interrupt_setPriority(INT_TA0_0,0x30);                    // Timer
 MAP_Interrupt_setPriority(INT_EUSCIA0,0x32);               // Serial communication with motor(RS-485) has lowest priority

when i set priority like this the encoder count is missing. T32_INT1  is used to calculate time between receiving 2 bytes from PC  and T32_INT2  is used to calculate time between receiving 2 bytes from motor drive.

*** If I  changed the priority as per follow :-

 MAP_Interrupt_setPriority(INT_EUSCIA3,0x06);               // Serial communication with pc has highest priority
 MAP_Interrupt_setPriority(INT_T32_INT1,0x08);              // Timer1
 MAP_Interrupt_setPriority(INT_T32_INT2,0x10);              // Timer2
 MAP_Interrupt_setPriority(INT_PORT6,0x15);                  // Encoder has highest priority
 MAP_Interrupt_setPriority(INT_TA0_0,0x16 );                    // Timer
 MAP_Interrupt_setPriority(INT_EUSCIA0,0x32);               // Serial communication with motor(RS-485) has lowest priority

if i set the priority for TA0_0 as 16 that is after encoder priority which is 15 ,then we are unable to receive data bytes from PC that is  data bytes are missing.

Please tell me how to set priority for my particular application??

  • Hello Sayali,

    I will look into this and get back.

    Thanks,
    Sai
  • Hello Sayali,

    On MSP432P4 devices, only the 3 most significant bits are used to prioritize interrupts.

    Based on the code snippet you provided the following lines mean that INT_EUSCIA3, INT_T32_INT1, INT_T32_INT2 and  INT_PORT6 all have the same priority of '0' (highest):

    MAP_Interrupt_setPriority(INT_EUSCIA3,0x06);               // Serial communication with pc has highest priority
    MAP_Interrupt_setPriority(INT_T32_INT1,0x08);              // Timer1
    MAP_Interrupt_setPriority(INT_T32_INT2,0x10);              // Timer2
    MAP_Interrupt_setPriority(INT_PORT6,0x15);                  // Encoder has highest priority

    And INT_TA0_0 and INT_EUSCIA0 have priority of '1'.

    MAP_Interrupt_setPriority(INT_TA0_0,0x30);                    // Timer
    MAP_Interrupt_setPriority(INT_EUSCIA0,0x32);               // Serial communication with motor(RS-485) has lowest priority

    The right way to assign interrupts is:

    MAP_Interrupt_setPriority(INT_EUSCIA3, (0 << 5));       // Serial communication with pc has highest priority
    MAP_Interrupt_setPriority(INT_T32_INT1, (1 << 5));      // Timer1
    MAP_Interrupt_setPriority(INT_T32_INT2, (2 << 5));      // Timer2
    MAP_Interrupt_setPriority(INT_PORT6, (3 << 5));         // Encoder has highest priority
    MAP_Interrupt_setPriority(INT_TA0_0, (4 << 5));         // Timer
    MAP_Interrupt_setPriority(INT_EUSCIA0, (5 << 5));       // Serial communication with motor(RS-485) has lowest priority

    Hope this helps!

    Regards,

    Sai

  • Hi Sai,
    Thanks for reply. i tried as per your suggestion (using shift operation) but i got the same problem that is encoder count is missing
    So, I tried to set interrupt priority as per below and My issue has been resolved.:
    MAP_Interrupt_setPriority(INT_EUSCIA3,0x10); // Serial communication with pc
    MAP_Interrupt_setPriority(INT_T32_INT1,0x15); // Timer1
    MAP_Interrupt_setPriority(INT_PORT6,0x30); // Encoder has highest priority
    MAP_Interrupt_setPriority(INT_TA0_0,0x32); // Timer
    MAP_Interrupt_setPriority(INT_EUSCIA0,0x60); // Serial communication with motor(RS-485) has lowest priority
    MAP_Interrupt_setPriority(INT_T32_INT2,0x68); // Timer2
  • Hello Sayali,

    I am glad that you have resolved the issue. Please note that the Priority numbers you used would mean the following:

    • INT_EUSCIA3 and INT_T32_INT1 are at priority 0 (highest possible)
    • INT_PORT6 and INT_TA0_0 are at priority 1
    • INT_EUSCIA0 and INT_T32_INT2 are at priority 3

    Thanks,

    Sai

**Attention** This is a public forum