KL02 has about 1 second delay before it hits main

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

KL02 has about 1 second delay before it hits main

Jump to solution
991 Views
ryanlush
Contributor IV

I started with this example project

KSDK_2_0\boards\frdmkl02z\demo_apps\hello_world

The first thing I do when I get in main() is set a pin but I can see on my scope its about 1 second after power/reset come up before this pin changes state. I can't see anything in the IAR startup code that's causing this delay. Am I missing something obvious here?

1 Solution
690 Views
ryanlush
Contributor IV

The problem was I had the NMI enabled. Once I got that straightened out the device booted in a few microseconds.

View solution in original post

0 Kudos
8 Replies
691 Views
ryanlush
Contributor IV

The problem was I had the NMI enabled. Once I got that straightened out the device booted in a few microseconds.

0 Kudos
690 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Ryan Lush

Glad to hear that you could resolve your issue, and thanks for sharing your workaround. Please tell us with any others questions that you could have.


Have a great day,
Jorge Alcala

690 Views
ryanlush
Contributor IV

I just realized I didn't answer all your questions. I'm measuring time by monitoring Vdd, reset and the IO with my scope. I trigger on Vdd, reset comes up with it and a second later I see my IO go low (I have an external pullup and I'm pulling it low with the processor). Or if I get rid of the IO and watch the UART data I see roughly the same thing.

Here is my FOPT bits

    SECTION FlashConfig:CODE

__FlashConfig

    DCD 0xFFFFFFFF
    DCD 0xFFFFFFFF
    DCD 0xFFFFFFFF
    DCD 0x7EFBFFFF

__FlashConfig_End

Any ideas? I have a KL17 running the same bootloader coming up in less than 2ms.

0 Kudos
690 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Ryan Lush

I'm testing the KSDK_2_0\boards\frdmkl02z\demo_apps\hello_world in the FRDM-KL02Z, Its close to 500 ms after power comes up before I see UART data. How are you measuring times? Where are you taking the power supply measurement?

There is a byte that can apply a slower initialization in the flashConfig in your starup_MKL02Z4.s file, could you check it and tell me what you have in there?


Have a great day,
Jorge Alcala

0 Kudos
690 Views
ryanlush
Contributor IV

Does 500ms sound right? I've got a kl15, kl17, STM32F4 and k20 I'm powering up, polling after 10ms and powering down. Even 100 ms seems like an eternity to me for a 48MHz processor. I'll have to rewrite code we've used for a few years all the way up to the C# app if it takes 100ms to boot. The 2 I'm seeing now is insane.

I have the FOPT bits set as they are in the example. Fast boot, clkdiv = 1, can't remember what else is in there right now but I went through it several times over making sure I was setup for the fastest boot.

Thank you,

Ryan

(sent from mobile device)

0 Kudos
690 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Ryan Lush

I made some test in the hello_world project, I didn't get the 1 s delay that you mentioned, How did you configure to set up the pin? Could you share your project to replicate your issue?


Have a great day.
Jorge Alcala

0 Kudos
690 Views
ryanlush
Contributor IV

Can I ask how you tested it? Every example does this for me. Even the application I am trying to load written for GCC does it. My circuit isn't complicated as I explained. I'm starting to lose hair.

0 Kudos
690 Views
ryanlush
Contributor IV

Well even the untouched hello world example is doing this to me. Its close

to 2 seconds after power comes up before I see any UART data. It's also

about the same about of time before I see my 32.768k crystal starts to

oscillate. My chips is an MKL02Z32VFK4.

All I have is a 32.768k crystal and a 3.3V regulator along with a a few

buttons and a CAN tranceiver. I can see 3.3V and reset come up right away.

This is in main()

int main(void)

{

char ch;

/* Init board hardware. */

BOARD_InitPins();

/* CAN_SHDN: 1 = SHUTDOWN / 0 = RUN */

GPIO_PinInit(GPIOB, 0U, &(gpio_pin_config_t){kGPIO_DigitalOutput,

0});

BOARD_BootClockRUN();

BOARD_InitDebugConsole();

PRINTF("UUUUUUUUUU");

while (1);

}

it takes about 800ms before PTB0 goes low (I have an external pull up on

there) and it takes about another 800ms before I see uart data.

On Thu, Jun 16, 2016 at 6:33 PM, jorge_a_vazquez <

0 Kudos