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.
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,
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
Hello Sayali,
I am glad that you have resolved the issue. Please note that the Priority numbers you used would mean the following:
Thanks,
Sai
**Attention** This is a public forum