AnsweredAssumed Answered

LPC5410x SCT0 crashes mcu

Question asked by Sven Savic on Jul 7, 2019
Latest reply on Jul 9, 2019 by Sven Savic

I am trying to get SCT0 working, but my mcu keeps crashing into hardfault handler. This would normally indicate trying to write to the wrong memory address (in this case anyway). So, looking at the memory address for SCT0 in memory mapping table it is stated that SCT0 is starting at 0x1C018000, which seems to be aligning with this part of my code:

LPC_SCT0->CONFIG |= _BV(0) | (1<<17); //set 32bit timer, autolimit on mat0

LPC_SCT0->EVENT[0].STATE = 1;

This part seems to be Ok, from what I can observe in the debugger under SCT registers. It seems that config does change value and event is set.

 

Nothing else was configured between that call and next one that crashes my mcu:

LPC_SCT0->MATCH[1].U = 10; 
LPC_SCT0->MATCHREL[1].U = 10;

LPC_SCT0->EVENT[1].STATE = 1;

I verified the address of MATCH[1].U (32 bit entry) with command: (uint32_t *)&LPC_SCT0->MATCH[1].U

and I am getting value of: 0x1c018104

 

104 from the address I have configured for MATCH[1] does align with the offset in the user manual.

 

What could cause MCU to crash by assigning value to the valid memory address ?

Outcomes