Antonio
The issue that you are having is due to the NMI line on the FRDM-K64F. There is quite a large capacitor connected to it so the input is held low for some time after powering on the board, which causes the processor to start in EzPort mode.
This can be avoided by configuring the device to disable EzPort and also default the input to GPIO (rather than NMI, which would then also require a default NMI handler to be installed in Flash).
This means that you need to correctly configure the non-volatile option in the Flash configuration area (byte at address 0x40b).
The following is the standard setting for the FRDM-K64F in the uTasker project which allows problem-free power-up operation:
#define KINETIS_FLASH_CONFIGURATION_NONVOL_OPTION (FTFL_FOPT_EZPORT_DISABLED | FTFL_FOPT_LPBOOT_NORMAL | FTFL_FOPT_NMI_DISABLED) // there is a large capacitor on the NMI/EzP_CS input so these are disabled to allow it to start without requiring an NMI handler or moving to EzPort mode
Regards
Mark
P.S. It may look strange that I have answered 'after' you have already sorted the issue out but I did post it earlier but my contributions are moderated by Freescale and so at the weekend they can get delayed quite a bit. Possibly the moderator could delete this one and explain how I could possibly get off the moderation list....? If not, please remove the INBOX watch and add the EMAIL watch each time it is approved since the INBOX watch is very annoying.
Kinetis: µTasker Kinetis support
K64: µTasker Kinetis FRDM-K64F support / µTasker Kinetis TWR-K64F120M support / µTasker Kinetis TWR-K65F180M support
For the complete "out-of-the-box" Kinetis experience and faster time to market