debugging troubles!

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

debugging troubles!

1,974 Views
taha-yassineelh
Contributor II

hy ;

Help please, while debugging it jumps always to " kinetis_sysinit.c " and stays at :

 

/**===========================================================================

**  Default interrupt handler

**===========================================================================

*/

void Default_Handler()

{

  __asm("bkpt");

}

 

 

/**

Labels (1)
6 Replies

1,791 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

I ever met the similar problem if i select the wrong part number. can you please also check this?

0 Kudos
Reply

1,791 Views
taha-yassineelh
Contributor II

if you mean the chip, yes I selected the correct one which is MKL46Z4

0 Kudos
Reply

1,791 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Taha-Yassine:

Maybe you can run your code step-by-step and verify the exact offending instruction.

One possible cause is that you are writing to a register of some module which has clock gate not enabled. Or maybe you enabled an interrupt but did not declare the proper interrupt service routine.

Please provide more details about your project/setup/code so we can help.

Regards!

Jorge Gonzalez

0 Kudos
Reply

1,791 Views
taha-yassineelh
Contributor II

First of all I realy appreciate your help. I try to write a code that make bilink the both LEDs (green and red) of the FRDM-KL46Z and I think that my startup routine handles all configs needed to make the code work, such as clock gating, pins direction....

I dont wont want bother you by the entire code so this is juste the start-up routing and some defines:

#include "derivative.h"

#define RED_LED_LOC (1<<27)

#define GREEN_LED_LOC (1<<5)

void delay(int a)

{

  int i;

  for(i=0;i<a;i++)

  {  

  

  }

}

int main(void)

{

  SIM_COPC = 0x00;          /* Disable the watchdog timer */

  SIM_SCGC5 |= (SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTD_MASK);   /*clock gating*/

  PORTD_PCR5 = (PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK) ;  /*module selection*/

  PORTE_PCR27 = (PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK) ;   /*module selection*/

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  GPIOD_PDDR |= RED_LED_LOC; /*Pins direction*/                  | it jumps just before executing this line

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  GPIOE_PDDR |= GREEN_LED_LOC; /*Pins direction*/

thank you, and sorry for the english :smileyhappy:

0 Kudos
Reply

1,791 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Well, your code shows that you enable PORTB and PORTD, but then you are writing to PORTD and PORTE registers, so do not seems like you are enabling clock gate for PORTE. In that case debugger would jump to default handler when trying to execute next instruction:

PORTE_PCR27 = (PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK) ;   /*module selection*/


Hope this helps :smileyhappy:

Regards!

Jorge Gonzalez

1,791 Views
taha-yassineelh
Contributor II

I was about to lose my mind, you're a lifesaver man! :smileyhappy:

thank you so much

0 Kudos
Reply