DEVKIT-ZVL128. LIN Bootloader Master-node, stuck at Clock_init()

cancel
Showing results for 
Search instead for 
Did you mean: 

DEVKIT-ZVL128. LIN Bootloader Master-node, stuck at Clock_init()

Jump to solution
1,104 Views
churyjeong
Contributor II

When I run "S12Z_LIN_MagniVBootloader_Translator" of AN5389SW on DEVKIT-ZVL128, 

PC(program counter) seems to be stuck at Clock_init(CLK_32_MHZ). 

void main(void) {
unsigned char dataCounter,phraseCounter;
CPMUVREGCTL_VREG5VEN = 1; /* 5v regulator */
Clock_init(CLK_32_MHZ); // Never return here. 
SCI1_init(32000000,19200); /* SCI1 is linked to PC communication */
MODRR0_SCI1RR = 1; /* TX ROUTED TO PT5 (white)/ RX ROUTED TO PT4(green) */
LIN_init();

...

in Clock.c, 

void Clock_init(unsigned char bus_clk){

CPMUOSC_OSCE = 0; /* Disable external oscillator */

if(bus_clk==CLK_8_MHZ){
//CPMUREFDIV_REFDIV = 3;
CPMUREFDIV_REFFRQ = 0;
CPMUSYNR_SYNDIV = 15;
CPMUSYNR_VCOFRQ = 1;
CPMUPOSTDIV_POSTDIV = 1;
}
else if(bus_clk == CLK_12_5_MHZ){
CPMUREFDIV_REFDIV = 3;
CPMUREFDIV_REFFRQ = 0;
CPMUSYNR_SYNDIV = 24;
CPMUSYNR_VCOFRQ = 1;
CPMUPOSTDIV_POSTDIV = 1;
}
else if(bus_clk == CLK_24_MHZ){
//CPMUREFDIV_REFDIV = 3;
CPMUREFDIV_REFFRQ = 0;
CPMUSYNR_SYNDIV = 47;
CPMUSYNR_VCOFRQ = 1;
CPMUPOSTDIV_POSTDIV = 1;
}
else{
//CPMUREFDIV_REFDIV = 3;
CPMUREFDIV_REFFRQ = 0;
CPMUSYNR_SYNDIV = 31;
CPMUSYNR_VCOFRQ = 1;
CPMUPOSTDIV_POSTDIV = 0;
}

while(CPMUIFLG_LOCK==0){} // Never return here. 

CPMURFLG = 0x60; /* Clear PORF and LVRF */
}

CPMUIFLG_LOCK seems not to be changed to "1". 

Question #1) 

- I did not changed any strap option on the EVM board since uppack. 

- Do I need to change some strap to make the EVM board work as LIN Master. 

- Why clock is not locked, please let me know the reason. 

1 Solution
418 Views
RadekS
NXP Employee
NXP Employee

Hello Chury,

I suppose that this will be not problem in MCU and code, but rather in debugger.

You probably use OSBDM interface on board. Correct?

When we change bus clock close to the maximum value, the BDM connection may be sometimes lost.

I would like to recommend change BDM clock to 1MHz (from IRC1M clock source).

In debug configuration, go to Target settings-Edit and Uncheck “Use Bus Clock as Debug Controller(SIBDC) Clock Source {default=Checked}”.

1.png2.png

This should help. However, the loading/debugging will be a bit slower.

I hope it helps you.

BR

Radek

View solution in original post

8 Replies
418 Views
churyjeong
Contributor II

Thanks Radek. 

It's a very good comment. So far I didn't understand the operation of debugger fully, I'll ask further in other thread after learning deep further. 

Thanks

Chury 

0 Kudos
419 Views
RadekS
NXP Employee
NXP Employee

Hello Chury,

I suppose that this will be not problem in MCU and code, but rather in debugger.

You probably use OSBDM interface on board. Correct?

When we change bus clock close to the maximum value, the BDM connection may be sometimes lost.

I would like to recommend change BDM clock to 1MHz (from IRC1M clock source).

In debug configuration, go to Target settings-Edit and Uncheck “Use Bus Clock as Debug Controller(SIBDC) Clock Source {default=Checked}”.

1.png2.png

This should help. However, the loading/debugging will be a bit slower.

I hope it helps you.

BR

Radek

View solution in original post

418 Views
ycage0123
Contributor II

Hi Radek,

It is great Uncheck “Use Bus Clock as Debug Controller(SIBDC) Clock Source {default=Checked}”in CodeWarrior.

Anyway can I do the same setting Freemaster, If I use DEVKIT-ZVL128 at 32MHz bus clock?

0 Kudos
418 Views
RadekS
NXP Employee
NXP Employee

Hi ko ik,

Interesting question.

Currently, FreeMASTER (2.0 nor 3.0) doesn’t have such features. The FreeMASTER use a different version of PEmicro library and we cannot see such an option in PEmicro library API.

In fact, I think that the settings for 1MHz IRC as BDM clock is useful only in case when we are stepping through the PLL init code. I didn’t hear about any other typical place where the BDM interface may lose connection with MCU (of course, except resets). If I place a breakpoint after PLL setup and let code run during PLL init, I typically do not detect any issue.

We typically use FreeMASTER for debugging run-time – The FreeMASTER doesn’t stop CPU, it reads registers/memory on the background.

I hope it helps you.

Best regards

Radek

0 Kudos
418 Views
ycage0123
Contributor II

Hello Radek,

Many thanks for your kindness reply.

But I think it is good to mounting the same function in FreeMASTER.

I hope to improve the connection regarding FreeMASTER with DEVKIT-ZVL128 in near version(4.0).

 

Best wishes, ko ik

0 Kudos
418 Views
churyjeong
Contributor II

Thanks Radek. 

I just realized S12Z_LIN_MagniVBootloader_Translator SW has not "OS BDM" debugger. 

(I am not familiar with CodeWarrior too.) 

It has only "PnE U-MultiLink" like the picture below: 

S12Z_LIN_MagniVBootloader_Debugger_setting.JPG

In your picture, there are 3 debugger settings, but in my picture, it has only one debugger setting. 

Could you let me know how to add "OS BDM" debugger into this project ? 

Or if there's a helpful documents of adding  new debugger, please help me to find the document. 

Thanks

Chury 

0 Kudos
418 Views
RadekS
NXP Employee
NXP Employee

Hi Chury,

No problem with debugger options. My screenshots were captured from a different project.

In fact, the PnE U-MultiLink and OSBDM  interfaces use the same PC software driver from P&E. So, you may use this configuration for both Multilink Universal or OSBDM interface types.

 

Anyway, new debugger configuration may be created by right-clicking on CodeWarrior and selection “New” in the context menu.

 3.png

There is also “New…” button for creating new target settings.

 

 

I hope it helps you.

BR

Radek

418 Views
churyjeong
Contributor II

I have tested S12ZVL128_LIN_bootloader (LIN Slave Node) with DEVKIT-ZVL128 EVM. 

And same clock configuration issue occurred too. 

I guess, "LIN Bootloader SW" for S12Z seems to be out-dated, or it did NOT match with the latest HW board. 

Please revise "LIN Bootloader SW" for the latest HW board and release it. 

Here's same error with Master Node. 

void PLL_Init(void)
{
// CPMUCLKS_PLLSEL = 0x1; // FBUS = FPLL/2. FBUS = 32MHz,
//
//#if OSCILLATOR_FREQUENCY == 4
// CPMUREFDIV_REFDIV = 0x0; // FREF = FOSC/(REFDIV+1) = 4/(0+1) = 4MHZ
//#elif OSCILLATOR_FREQUENCY == 8
// CPMUREFDIV_REFDIV = 0x1; // FREF = FOSC/(REFDIV+1) = 8/(1+1) = 4MHZ
//#elif OSCILLATOR_FREQUENCY == 12
// CPMUREFDIV_REFDIV = 0x2; // FREF = FOSC/(REFDIV+1) = 12/(2+1) = 4MHZ
//#elif OSCILLATOR_FREQUENCY == 16
// CPMUREFDIV_REFDIV = 0x3; // FREF = FOSC/(REFDIV+1) = 16/(3+1) = 4MHZ
//#else
// #error Non-Supported Oscillator Frequency Selected
//#endif
//
// CPMUREFDIV_REFFRQ = 0x1; // Reference clock between 2MHZ and 6MHZ.
// CPMUSYNR_SYNDIV = 7; // FVCO = 2xFREFx(SYNDIV+1) = FVCO = 2x4x(7+1) = 64MHZ
// CPMUSYNR_VCOFRQ = 0x1; // FVCO is between 48MHZ and 80MHZ
// CPMUPOSTDIV_POSTDIV = 0x0; // FPLL = FVCO/(POSTDIV+1). FPLL = 64MHZ/(0+1) FPLL = 64MHz
// CPMUOSC_OSCE = 0x1; // External oscillator enable. FREF = FOSC/(REFDIV+1)
//
// while(!CPMUIFLG_LOCK){} // Wait for LOCK.
//
// CPMUIFLG = 0xFF; // Clear CPMU flags

/* Wait for stable supply after power up */
//while (GDUF_GLVLSF)
//GDUF_GLVLSF = 1;

CPMUOSC_OSCE = 0; /* Disable external oscillator */

//CPMUREFDIV_REFDIV = 3;
CPMUREFDIV_REFFRQ = 0;
CPMUSYNR_SYNDIV = 31;
CPMUSYNR_VCOFRQ = 1;
CPMUPOSTDIV_POSTDIV = 0;


//CPMUREFDIV_REFDIV = 3;

while(CPMUIFLG_LOCK==0){}  // Never get out of here. 





CPMURFLG = 0x60; /* Clear PORF and LVRF */

}

0 Kudos