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.
2 copies also of this file: startup_MK22F51212.S
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 */
__IO uint8_t CONTROL; /**< USB OTG Control register, offset: 0x108 */
__IO uint8_t USBTRC0; /**< USB Transceiver Control register 0, offset: 0x10C */
__IO uint8_t USBFRMADJUST; /**< Frame Adjust Register, offset: 0x114 */
__IO uint8_t CLK_RECOVER_CTRL; /**< USB Clock recovery control, offset: 0x140 */
__IO uint8_t CLK_RECOVER_IRC_EN; /**< IRC48M oscillator enable register, offset: 0x144 */
__IO uint8_t CLK_RECOVER_INT_STATUS; /**< Clock recovery separated interrupt status, offset: 0x15C */
} 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).
P.S: I'm using either IAR or KDS.