Author Topic: FRDM-K64F mbed loader version  (Read 3095 times)

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3188
    • View Profile
    • uTasker
FRDM-K64F mbed loader version
« on: April 07, 2015, 08:25:10 PM »
Hi All

It seems like there are still some FRDM-K64F boards floating around with an old mbed loader installed which won't load software if the flash configiration area is not set to a certain pattern - see http://developer.mbed.org/questions/3323/Loader-crashing-when-flash-configuration/

In case you find yourself affected it can be resolved by installing the latest mdeb loader version.
How to do this is aso explained at http://developer.mbed.org/handbook/Firmware-FRDM-K64F and sumarised here (also the latest SW can be found at that link):


1. Disconnect the board
2. Hold the reset button down and connect the OpenSDA USB cable - the board now appears as BOOT_LOADER hard disk
3. Drag and drop the attached file to it [20140530_k20dx128_k64f_if_mbed.bin]
4. Disconnect and reconnect the USB cable (power cycle - without holding the RESET button down)
Now the new debugger is installed and will allow loading any code.


For anyone interested in how the Flash Configuration settings are defined in the project you can look in the app_hw_kinetis.h file in the corresponding project to find the original workaround to this (commented out and possibly deleted entirely at some point)

//#if defined FRDM_K64F                                                  // (removed since mbed bootloader has been corrected) since this board may be used with the MBED loader the flash configuration settings are left with all bits apart from security disable set at '1' - otherwise the MBED loader tends to crash
//  #define KINETIS_FLASH_CONFIGURATION_BACKDOOR_KEY       {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
//  #define KINETIS_FLASH_CONFIGURATION_PROGRAM_PROTECTION {0xff, 0xff, 0xff, 0xff}
//  #define KINETIS_FLASH_CONFIGURATION_SECURITY           (0xfe)
//  #define KINETIS_FLASH_CONFIGURATION_NONVOL_OPTION      (0xff)
//#endif



    #define KINETIS_FLASH_CONFIGURATION_BACKDOOR_KEY       {BACKDOOR_KEY_0, BACKDOOR_KEY_1, BACKDOOR_KEY_2, BACKDOOR_KEY_3, BACKDOOR_KEY_4, BACKDOOR_KEY_5, BACKDOOR_KEY_6, BACKDOOR_KEY_7}
    #define KINETIS_FLASH_CONFIGURATION_PROGRAM_PROTECTION {PROTECTION_0, PROTECTION_1, PROTECTION_2, PROTECTION_3}
    #define KINETIS_FLASH_CONFIGURATION_SECURITY           (FTFL_FSEC_SEC_UNSECURE | FTFL_FSEC_FSLACC_GRANTED | FTFL_FSEC_MEEN_ENABLED | FTFL_FSEC_KEYEN_ENABLED)
    #if defined KINETIS_KL || defined KINETIS_KV
        #if defined KINETIS_KL03 || defined KINETIS_KL43
...
        #else
            #define KINETIS_FLASH_CONFIGURATION_NONVOL_OPTION  (FTFL_FOPT_LPBOOT_CLK_DIV_8 | FTFL_FOPT_RESET_PIN_ENABLED)
        #endif
    #else
        #if defined KINETIS_REVISION_2
            #if defined FRDM_K64F
                #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 with requiring an NMI handler or moving to EzPort mode
            #else
                #define KINETIS_FLASH_CONFIGURATION_NONVOL_OPTION  (FTFL_FOPT_EZPORT_ENABLED | FTFL_FOPT_LPBOOT_NORMAL | FTFL_FOPT_NMI_DISABLED)
            #endif
        #else
            #define KINETIS_FLASH_CONFIGURATION_NONVOL_OPTION  (FTFL_FOPT_EZPORT_ENABLED | FTFL_FOPT_LPBOOT_NORMAL | FTFL_FOPT_NMI_ENABLED)
        #endif
    #endif
#endif



You can also see that the NMI input is disabled since there is a big capacitor on the input which otherwise causes problems with starting when the OpenSDA is not powered.


Regards

Mark