AnsweredAssumed Answered

I get stuck programming a timer register in DefaultISR loop with kl46z

Question asked by Florian DJAMBAZIAN on Oct 28, 2016
Latest reply on Oct 30, 2016 by Florian DJAMBAZIAN

Hi everybody.

I'am developing with a freedom-kl46z board. I have been to the forum but I didn't find something which could help me.

In fact I'am programming the TPM0 but when the debugger arrive to this line :

TPM0_SC |= TPM_SC_PS(5);

The program go to the startup_MKL46Z4.S and stay to this loop :

ldr r0, =DefaultISR
bx r0

I really don't know what to do. I've read this post :

The Debugger hangs in startup_MK60D10.S, line "b     DefaultISR" 

But I'am sure I use the right component. 

If somebody have the same problem, could you help me ?


Here is the code I use to program my Tpm0 :

//ENable clk for timer 0
SIM_SOPT4 |= 01000000;
//Enable MCGIRCLK p126
MCG_C1 |= 0x2;
//CHoose MCGIRCLK for TPM p132
SIM_SOPT2 = 0x03000000;

//32 prescaler 4MHZ/32 = 125 khz
TPM0_SC |= TPM_SC_PS(5);
//125KHz/125 = 1 Khz
TPM0_MOD = 125;

//Enable interrupt
TPM0_SC |= 1<<6;

//Module clock for timer 0
TPM0_SC |= 0x08;

Best regards