Hi,
I currently meet a problem about disable interrupt in using MPC5748G only run on Core0, and all data and instruction cache are disabled.
When I try to disable the global interrupt, call the vPortMaskInterrupts, which raise the priority of INTC.CPR0, and set it to configMAX_API_CALL_INTERRUPT_PRIORITY, which is defined 8, the source code is following:
static portFORCE_INLINE void vPortMaskInterrupts( void )
{
#ifndef CODE_ANALYSIS
BaseType_t msr;
uint8_t i = 0;
// See MPC5746C RM Rev 3 section 21.8.5.2 "Ensuring coherency" (most restrictive rules)
// See MPC5646C RM Rev 5 section 19.10.4.2 "Ensuring coherency"
// See MPC5607B RM Rev 7.2 section 18.7.5.2 "Ensuring coherency"
// See MPC5604B RM Rev 8.2 section 16.7.5.2 "Ensuring coherency"
__asm__ volatile
(
"mfmsr %0 \n\t"
"wrteei 0 \n\t" // disable interrupts
: "=r" (msr)
);
/* Set current interrupt priority to max API priority */
portINTC_CPR = configMAX_API_CALL_INTERRUPT_PRIORITY;
i += 1; //just for test
__asm__ volatile
(
"mbar \n\t" // ensure INTC_CPR write completes before re-enabling interrupts
"wrtee %0 \n\t" // re-enable interrupts if they were previously enabled
"se_isync \n\t" // re-fetch Processor pipeline
: : "r" (msr)
);
#endif
}
The problem is when disable global interrupt and the after executes
portINTC_CPR = configMAX_API_CALL_INTERRUPT_PRIORITY,
the INTC.CPR really become 8, but after the next one step executed, it become 0 again whatever the code is.
The result is that it can't prevent the interrupts with priority below configMAX_API_CALL_INTERRUPT_PRIORITY happens.
As I know when set INTC.CPR0 to 8 before reset it to 0, any interrupts with priority below or equal to 8 should not happen.
Can anyone explain why this happens?
Thanks very much.
Hi,
For the start, disable all interrupts except one with priority 8 which you want to call.
To exclude any other interrupt being processed in that time.
Ale do the test without debugger to see if the debugger execution has no influence on the interrupt execution.
best regards,
Peter