LPC5410x SCT0 crashes mcu

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC5410x SCT0 crashes mcu

ソリューションへジャンプ
1,273件の閲覧回数
svensavic
Contributor III

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 ?

ラベル(1)
0 件の賞賛
返信
1 解決策
1,188件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi Sven Savic,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
According to the RM, Match registers can be read at any time. Writing to the MATCH_L, MATCH_H, or unified register is only allowed when the corresponding counter is halted (HALT bits are set to 1 in
the CTRL register). So please assure the HALT bit is 1 when writing the Match register.

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

元の投稿で解決策を見る

2 返答(返信)
1,189件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi Sven Savic,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
According to the RM, Match registers can be read at any time. Writing to the MATCH_L, MATCH_H, or unified register is only allowed when the corresponding counter is halted (HALT bits are set to 1 in
the CTRL register). So please assure the HALT bit is 1 when writing the Match register.

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

1,188件の閲覧回数
svensavic
Contributor III

That was it. thanks

0 件の賞賛
返信