Hi everyone
I'm using MCUXpresso 10.2.1 and a custom board based on MK66F2N0.
To catch a bug about writing on a variable, I'd want to use the debug monitor interrupt. I've configured the DWT peripheral to set the debug monitor interrupt, but I have two problems:
This the code I use:
unsigned long DebugVar = 0;
unsigned long DebugHandler = 0;
void main( void )
{
unsigned long DebugCnt = 0;
...
//init debugmon
CoreDebug->DEMCR = CoreDebug_DEMCR_TRCENA_Msk | CoreDebug_DEMCR_MON_EN_Msk;
DWT->COMP0 = ( uint32_t )&DebugVar;
DWT->MASK0 = 0;
DWT->FUNCTION0 = ( 1 << 11 ) | ( 1 << 2 ) | ( 1 << 0 );
NVIC_SetPriority( DebugMonitor_IRQn, 7 );
EnableIRQ( DebugMonitor_IRQn );
while( 1 )
{
if( DebugCnt++ >= 100 ) //every 10 s
{
DebugCnt = 0;
DebugVar++; //write var
}
...
if( DebugHandler )
{
//debug
PRINTF( "Debug monitor handler executed\n" );
DebugHandler = 0;
}
vTaskDelay( 10 ); //systick = 10 ms: delay 100 ms
}
}
void DebugMon_Handler( void )
{
if( DWT->FUNCTION0 & DWT_FUNCTION_MATCHED_Msk )
DebugHandler = 1;
}
Is there any error? Why is the interrupt never executed? Is it possible to avoid stopping the execution during the debug session?
Many thanks
Biafra
See response in your other thread - https://community.nxp.com/thread/489761#comment-1086499