AnsweredAssumed Answered

Kinetis Bootloader for MK22FN1M0XXX12

Question asked by Cecylia Wati on Aug 30, 2016
Latest reply on Jun 16, 2017 by mahendra kumar

Hi there,

 

I'm trying to port Kinetis Bootloader v2.0.0 for this device: MK22FN1M0XXX12 based on the steps in the Kinetis Bootloader v2.0.0 reference manual.

 


I'd appreciate it if you can help me with some of these questions:
1) Is there a similar device I can based this off to jump start?

 


2) During porting I found that in Kinetis Bootloader v2.0.0 there are 2 sets of these files.  Are we really using these 2 or I can ignore one set?  Because, they are different from each other.
NXP_Kinetis_Bootloader_2_0_0\targets\MK22F51212\src\startup\system_*.c/h
NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK22F51212\system_*.c/h

 

2 copies also of this file: startup_MK22F51212.S
\NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK22F51212\gcc\
e\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\MK22F51212\src\startup\gcc

 

2) I tried using MK22F51212 device as a reference (copied these files into a newly created directory MK22FA12), and then copied over the header files from "C:\Freescale\KSDK_1.3.0\platform\devices\MK22FA12" to complete it.
But it seems like there's a fundamental difference in the clocking scheme, where MK22F-512 calls "usb_clock_init" and sets the following:

 

    // need to set the clock_recover_en and irc_en register
    USB0->CLK_RECOVER_CTRL |= USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN_MASK;
    USB0->CLK_RECOVER_IRC_EN |= USB_CLK_RECOVER_IRC_EN_IRC_EN_MASK;

 

Well, MK22FN1M0XXX12 doesn't have those registers.  

 

Specifically in MK22FN1M0XXX12 Reference Manual and header MK22FA12.h, it stops at USBFRMADJUST.

 

....
  __I  uint8_t OBSERVE;                            /**< USB OTG Observe register, offset: 0x104 */
       uint8_t RESERVED_23[3];
  __IO uint8_t CONTROL;                            /**< USB OTG Control register, offset: 0x108 */
       uint8_t RESERVED_24[3];
  __IO uint8_t USBTRC0;                            /**< USB Transceiver Control register 0, offset: 0x10C */
       uint8_t RESERVED_25[7];
  __IO uint8_t USBFRMADJUST;                       /**< Frame Adjust Register, offset: 0x114 */
#if MY_HACK
       uint8_t RESERVED_26[43];
  __IO uint8_t CLK_RECOVER_CTRL;                   /**< USB Clock recovery control, offset: 0x140 */
       uint8_t RESERVED_27[3];
  __IO uint8_t CLK_RECOVER_IRC_EN;                 /**< IRC48M oscillator enable register, offset: 0x144 */
       uint8_t RESERVED_28[23];
  __IO uint8_t CLK_RECOVER_INT_STATUS;             /**< Clock recovery separated interrupt status, offset: 0x15C */
#endif
} USB_Type, *USB_MemMapPtr;

 

When avoiding to set the non-existing USB registers, I could continue to load the project.  But unfortunately the KinetisFlashTool doesn't recognize the device, neither as COM PORT (doesn't come up as something that Windows recognize), nor as HID device (0x15A2,0x0073).

 

Thanks,
Cecylia


P.S: I'm using either IAR or KDS.

Outcomes