LPC55S06_EVK Project crashing on CTIMER_init()

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC55S06_EVK Project crashing on CTIMER_init()

跳至解决方案
1,784 次查看
dougpaulsen
Contributor IV

Hey:

I am really hoping someone can show me the error in my ways here, but in the meantime a quite elementary MCUXpresso 11.3 generated project for the LPC55S06_EVK board crashes when executing CTIMER_init().

A stripped down, just-the-basics project is attached.  I have started with a default '55S06 project and used the clock tool to enable the CTIMER2 clock and the peripheral tool to enable CTIMER2 (no pins used).  In this example (and every other combo I've tried), program execution will go into deep space in the tool generated CTIMER_Init() on this line:

/* Setup the timer prescale value */
base->PR = CTIMER_PR_PRVAL(config->prescale);

This same code generated for the LPC55S16_EVK board works, but not here for the LPC55S06_EVK.  Of course, your example project lpcxpress55s06_ctimer_match_interrupt_example works but find it frustrating what while you promote the pin, clock, and peripheral tools you studiously avoid using them in your examples.  I do find in your example base->PR is assigned 0 whereas the peripheral tool prohibits that value.

I have spent considerable time ever more my simplifying my sample and I think it's about a simple as it can get, yet the code refuses to execute.  I could, of course, adapt your sample and use it in the short term, but I think skating over the issue will come back to haunt the project at a later date.

Thanks for any insights!

 

PS:  When this code crashes, the only way I've found to de-brick my LPC55S06-EVK board is to use a J-Link as an external debugger and chip-erasing with J-Flash.  If anyone knows how to recover with LINK2, please share....

 

0 项奖励
1 解答
1,777 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello dougpaulsen,

You need add  BOARD_BootClockFRO12M(); as below:

int main(void) {

/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_BootClockFRO12M();
BOARD_InitBootPeripherals();

 

...

}

 

 

BR

Alice

在原帖中查看解决方案

0 项奖励
3 回复数
1,778 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello dougpaulsen,

You need add  BOARD_BootClockFRO12M(); as below:

int main(void) {

/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_BootClockFRO12M();
BOARD_InitBootPeripherals();

 

...

}

 

 

BR

Alice

0 项奖励
1,768 次查看
dougpaulsen
Contributor IV

Alice:

Why, this is absolutely excellent and solves the problem.  My oversight, although in my defense I would point out that the MCUXpresso tools for a LPC55S16 project  (where heretofore I spent most of my time) creates the following void BOARD_InitBootClocks(void):

   void BOARD_InitBootClocks(void)
   {
      BOARD_BootClockPLL150M();
   }

In contrast, the MCUXpresso tools for a LPC55S06 project creates this rather less-that-helpful version of BOARD_InitBootClocks():

   void BOARD_InitBootClocks(void)
   {
   }

That is, you've got to manually add your own clock initialization.  The LPC55S06 Clock tool didn't add it for you.  Surprise!  I suffered a classic case of target fixation, trying to understand what's wrong with the LPC55S06 CTimer peripheral and not investigating the rest of the system.

As I like to say: All's well that ends, and I can get on with things.

Thanks again!

doug 

0 项奖励
331 次查看
Kratz
Contributor IV
The solution worked for me as well using what I needed, BOARD_BootClockFRO48M();
0 项奖励