Kinetis Bootloader for MK22FN1M0XXX12

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

Kinetis Bootloader for MK22FN1M0XXX12

Jump to solution
39,055 Views
cwati
Contributor III

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.

Labels (1)
0 Kudos
1 Solution
4,885 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Cecylia,

According to statement, I've ported the K64_bootlaode to the K21_120, as the K21_120 doesn't have the following registers.

USB0_CLK_DECOVER_CTRL

USB0_CLK_DECOVER_IRC_EN

USB0_CLK_DECOVER_INT_STATUS

And I've adapted the usb_clock_init() which is illustrated below. When the bootloader demo runs on the TWR-K21F120M board, KinetisFlashTool can recognize the device through the COM port or the HID interface.

bool usb_clock_init(void) {

SIM->SCGC4 &= ~SIM_SCGC4_USBOTG_MASK;

// SIM->CLKDIV2 = (uint32_t)0x00L;

// SIM->SOPT2 |= SIM_SOPT2_USBSRC_MASK | SIM_SOPT2_PLLFLLSEL(0x03);

//

// SIM->SCGC4 |= SIM_SCGC4_USBOTG_MASK;

//

// USB0->CLK_RECOVER_IRC_EN = 0x03;

// USB0->CLK_RECOVER_CTRL |= USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN_MASK;

//

// USB0->CLK_RECOVER_CTRL |= 0x20;

//

// return true;

SIM->CLKDIV2 = (uint32_t)0x00L;

SIM->SOPT2 |= SIM_SOPT2_USBSRC_MASK | SIM_SOPT2_PLLFLLSEL(0x0);

SIM->SCGC4 |= SIM_SCGC4_USBOTG_MASK;

SIM->SOPT1 |= (SIM_SOPT1_USBSSTBY_MASK |SIM_SOPT1_USBREGEN_MASK);

// USB0->CLK_RECOVER_IRC_EN = 0x03;

// USB0->CLK_RECOVER_CTRL |= USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN_MASK;

//

// USB0->CLK_RECOVER_CTRL |= 0x20;

return true; }
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

15 Replies
4,885 Views
mahendrakumar_a
Contributor II

Hi Cecylia,

Have you ported KBOOT for MK22FN1M0XXX12?

If yes, can you please share the code?

It would help me a lot.

Thanks

Mahendra 

0 Kudos
4,885 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Cecylia,

I was wondering if you can upload the ported demo which is based on the IAR, then I can replicate the issue on my site.

And I will appreciate a lot if you can share the particular porting working you do, it can help me to figure out the root cause of the issue.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
4,885 Views
cwati
Contributor III

Hi,

The following zip is the directory (with the and unnecessary targets and  files removed).  Of the targets, I only left MK22FA12 (my intended target), and MK22F51212 and MK64F12 (that I think might be most similar with my intended target).

NXP_Kinetis_Bootloader_2_0_0.zip - Google Drive 

Thanks,
Cecylia

0 Kudos
4,885 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Cecylia,

After install the attachment, it has all target demos, however it doesn't matter.

I'd like to suggest that you'd better to port K64_120 to the target MK22FN1M0XXX12, as flash configuration between K22_512 and K22_1M0 is different.

I was wondering if you can tell me what's going on with the porting working.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
4,885 Views
cwati
Contributor III

Hi Ping,

Here's the complete step. 

The link to the zipped file is the same:

https://drive.google.com/open?id=0BzU22QN_dx0LLUZJT25PcjU0TXc

Porting K64_120 for K22F_1M0.

1) Create new directory:
NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK22FA12_MK64
(The extra MK64 is to indicate that it's ported from MK64 files).

Copy over everything from:
C:\Freescale\KSDK_1.3.0\platform\devices\MK22FA12\include\*
into :
NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK22FA12_MK64

2) Create new directory:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\MK22FA12_MK64

Copy over everything from:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\MK64F12
to
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\MK22FA12_MK64

Then go inside:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\MK22FA12_MK64\src
and rename all the filename that contains the target name from "MK64F12" to "MK22FA12"

3) Copy over:
C:\Freescale\KSDK_1.3.0\platform\devices\MK22FA12\startup\system_MK22FA12.*
to:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK22FA12_MK64

Copy over:
C:\Freescale\KSDK_1.3.0\platform\devices\MK22FA12\linker\* (directories arm,
gcc, iar)
into
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK22FA12_MK64

Copy the assembly startup files startup_MK22FA12.s from:
C:\Freescale\KSDK_1.3.0\platform\devices\MK22FA12\startup\<arm|gcc|iar>\
to
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK22FA12_MK64\<arm|gcc|iar>

4) Copy 'startup' directory from:
C:\Freescale\KSDK_1.3.0\platform\devices\MK22FA12\startup
to:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\MK22FA12_MK64\src\startup

5) For fsl_clock.c/h
I was debating between copying either from:
1st: C:\Freescale\KSDK_1.3.0\platform\system\src\clock\MK22FA12
Or from:
2nd: C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK64F12

But, I found that the one from KSDK_1.3.0 is not compatible (when building),
so I used the 2nd option: MK64F12 from Bootloader 2.0.0 .

6) Linker files
Copy:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\common\linker\iar\MK64F12
To:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\common\linker\iar\MK22FA12_MK64

And rename the files in the new directory to start with K22FN1M0xxx12_*

7) Create a new file:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK22FA12_MK64\fsl_device_registers.h,
whose content is essentially the following:

#if (defined(CPU_MK22FX512AVLH12) || defined(CPU_MK22FN1M0AVLH12) || defined(CPU_MK22FX512AVLK12) || \
defined(CPU_MK22FN1M0AVLK12) || defined(CPU_MK22FX512AVLL12) || defined(CPU_MK22FN1M0AVLL12) || \
defined(CPU_MK22FX512AVLQ12) || defined(CPU_MK22FN1M0AVLQ12) || defined(CPU_MK22FX512AVMC12) || \
defined(CPU_MK22FN1M0AVMC12) || defined(CPU_MK22FX512AVMD12) || defined(CPU_MK22FN1M0AVMD12))

#define K22FA12_SERIES


/* CMSIS-style register definitions */
#include "MK22FA12.h"
/* Extension register definitions */
#include "MK22FA12_extension.h"
/* CPU specific feature definitions */
#include "MK22FA12_features.h"

#else
#error "No valid CPU defined!"
#endif


-------------- PART 2: Modifying the project.
Open:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\MK22FA12_MK64\bootloader.eww

Then remove all projects but the freedom_bootloader project. (This is
optional I guess, but if you leave the other project, then you might hit some
K64F files during search with CTRL+SHIFT+F).

1) Modify the directory name from k64f12 to k22fa12
and change the files
(see image on p .134 reference manual of bootloader 2.0.0)

2) replace
clock_config_*
hardware_init_*
memory_map_*
peripherals_*
with the one from: C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\MK22FA12_MK64\src

3) Change the *.icf file under 'link' folder to the file here:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\common\linker\iar\MK22FA12_MK64\

4) In the project\src\startup, change startup_*.s and system_*.c to these:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\MK22FA12_MK64\src\startup\iar\startup_MK22FA12.s
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\MK22FA12_MK64\src\startup\system_MK22FA12.c

5) Right click on project name and in "General Options" -> Target, change
Device name to "NXP MK22FN1M0xxx12"

In "C/C++ Compiler"-> Preprocessor, change the include path:
$PROJ_DIR$/../../../../src/platform/devices/MK64F12
to:
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK22FA12_MK64

Still in this screen, change the symbol:
CPU_MK64FN1M0VMD12
to
CPU_MK22FN1M0AVMC12

In the project options, go to "Linker" -> Config and change:
$/../../../common/linker/iar/MK64F12/K64FN1Mxxx12_application_0x0000.icf
to
C:\Freescale\NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\common\linker\iar\MK22FA12_MK64\K22FN1M0xxx12_application_0x0000.icf

----------------- PART 3: Building
1) To build successfully I had to completely comment out
CLOCK_SetEnetTime0Clock and CLOCK_SetRmii0Clock in fsl_clock.c
(Based on grep, I don't think they're used).

2) I also decided to remove the directory:
src/drivers/mmcau
from the project when it complained during build.

3) The last complaint I got is about:
CLK_RECOVER_CTRL
and
CLK_RECOVER_IRC_EN

This is what I mentioned in my previous comment, that 64F and 22F1M seem to
differ in this register, i.e., 22F1M doesn't have these fields.
I just disabled this for now.

#if !CWATI
USB0->CLK_RECOVER_IRC_EN = 0x03;
USB0->CLK_RECOVER_CTRL |= USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN_MASK;

USB0->CLK_RECOVER_CTRL |= 0x20;
#endif

---------------------- PART 4: Running
1) I used JLink, so I had to change the Project Properties "Debugger" -> Setup
from "CMSIS DAP" to "J-Link".

2) When trying to load I got the following, and then the device is not
responsive to JLINK.

Fri Sep 02, 2016 16:00:14: Found 1 JTAG device, Total IRLen = 4:
Fri Sep 02, 2016 16:00:14: 3196 bytes downloaded and verified (18.15 Kbytes/sec)
Fri Sep 02, 2016 16:00:14: Loaded debugee: C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.4\arm\config\flashloader\NXP\FlashK64Fxxx128K.out
Fri Sep 02, 2016 16:00:14: Target reset
Fri Sep 02, 2016 16:00:15: The flash loader program reported an error.

(This definitely messed up the device, to recover I ran Jlink and typed "device
?" then choose the right device. I did it few times.)

Anyways, so I changed the Project Options "Debugger" -> Download:
- uncheck "Verify Download"
- uncheck "Use flash loader(s)"
So in the "Download" view all boxes are unchecked.

---------------------- PART 5: Moment of Truth
1) Plug in USB of the 22F_1M0 device to PC then power on the device. PC will show that "USB is not
recognized".
Then Open KinetisFlashTool and try to connect.

You can't connect via UART because there's no COM Port (USB not recognized by
Windows), and HID connect doesn't work.

Btw I've installed the CDC driver on my PC, so regular project that I have,
using CDC, could be recognized OK by my Windows.

The link to the zipped file is the same:

https://drive.google.com/open?id=0BzU22QN_dx0LLUZJT25PcjU0TXc

Thanks,
Cecylia

0 Kudos
4,886 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Cecylia,

According to statement, I've ported the K64_bootlaode to the K21_120, as the K21_120 doesn't have the following registers.

USB0_CLK_DECOVER_CTRL

USB0_CLK_DECOVER_IRC_EN

USB0_CLK_DECOVER_INT_STATUS

And I've adapted the usb_clock_init() which is illustrated below. When the bootloader demo runs on the TWR-K21F120M board, KinetisFlashTool can recognize the device through the COM port or the HID interface.

bool usb_clock_init(void) {

SIM->SCGC4 &= ~SIM_SCGC4_USBOTG_MASK;

// SIM->CLKDIV2 = (uint32_t)0x00L;

// SIM->SOPT2 |= SIM_SOPT2_USBSRC_MASK | SIM_SOPT2_PLLFLLSEL(0x03);

//

// SIM->SCGC4 |= SIM_SCGC4_USBOTG_MASK;

//

// USB0->CLK_RECOVER_IRC_EN = 0x03;

// USB0->CLK_RECOVER_CTRL |= USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN_MASK;

//

// USB0->CLK_RECOVER_CTRL |= 0x20;

//

// return true;

SIM->CLKDIV2 = (uint32_t)0x00L;

SIM->SOPT2 |= SIM_SOPT2_USBSRC_MASK | SIM_SOPT2_PLLFLLSEL(0x0);

SIM->SCGC4 |= SIM_SCGC4_USBOTG_MASK;

SIM->SOPT1 |= (SIM_SOPT1_USBSSTBY_MASK |SIM_SOPT1_USBREGEN_MASK);

// USB0->CLK_RECOVER_IRC_EN = 0x03;

// USB0->CLK_RECOVER_CTRL |= USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN_MASK;

//

// USB0->CLK_RECOVER_CTRL |= 0x20;

return true; }
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

4,885 Views
cwati
Contributor III

Hi Jeremy,

Great! This works on my USB-HID.

One more question, mine still doesn't show up as a COM port.  Is there a driver I need to install for this to be recognized as a COM port on my Windows?

Cannot find a COM port!
Error: Connect device failed(Error: UartPeripheral() cannot open PC UART port(), speed(57600 Hz).).

Thanks,
Cecylia

0 Kudos
4,885 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Cecylia,

In my demo, I also use the UART0 (PTB16_RXD, PTB17_TXD) to communicate the PC.

And the bootloader code will enter the UART0_RX_GPIO_IRQHandler() function when the PC send the command to MCU.

Regard to your demo, when debugging the demo, you can set a break point in related UARTn_RX_GPIO_IRQHandler() to confirm  whether the UART can receive the command or not.

Hope it helps.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

4,885 Views
cwati
Contributor III

Hi @jeremyzhou,

It seems like the linker file is not working quite properly on this?

When loading the software I got this warning (that I don't normally get when programming regular binary to the board):
systemsecurity.png

Moreover, flash loading fails on this:

flashprotection.png

But when I try to use the "normal" linker such as:

C:\Freescale\Freescale_MQX_4_1\lib\twrk21f120m.iar\debug\bsp\intflash.icf

C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.4\arm\config\linker\NXP\MK22xN1M_12.icf

I don't get the warning about "Your application image would set the system security of the device".  But it got stuck in Hard Fault.

Can you please suggest the proper linker file to use to complete this porting?

Thanks!

Cecylia

0 Kudos
4,885 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Cecylia,

I was wondering if you can tell which version of bootloader you adapted for MK22FN1M0XXX12.

And I'd highly recommend that you select the [release] version.

The application code would be located at the start address:0xA000 instead of the 0x0000.

So it needs to modify the linker file to be suit for the new localization, and can you show me what the modifying you do?
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
4,885 Views
cwati
Contributor III

Hi Ping jeremyzhou,


I used (copied and renamed) this:

NXP_Kinetis_Bootloader_2_0_0\targets\common\linker\iar\MK64F12\K64FN1Mxxx12_application_0x0000.icf

as the linker for the bootloader project.

Since the bootloader project is built using IAR, it seems like it's by default the release version (i.e., the C/C++ option selects to optimize at highest possible for size consideration).

As for the application, I currently just try to load a sample project:
C:\Freescale\Freescale_MQX_4_1\mqx\examples\flashx\build\iar\flashx_twrk21f120m

So I used that linker and modified the starting address from 0x0 to 0xA000:

   /*-Specials-*/
   define symbol __ICFEDIT_intvec_start__ = 0x00000000; 0x0000A000;
   /*-Memory Regions-*/
   define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;  0x0000A000;

Here's the resulting linker file.

jeremy - Google Drive 

However, I think the problem is happening currently at the bootloader's linker.  If you load the bootloader, you can't even erase.  If you try to Erase all and unsecure, it says:

Current Device doesn't support FlashEraseAllUnsecure.
If you try to erase all, it says:

Error: Erase operation failed(kStatus_FlashProtectionViolation).

Or maybe somewhere in the startup file it writes the security bit wrong?  Like there's a "FlashConfig SECTION" in startup_MK22FA12.s.  

I tried few things like to to modify the FlashConfig SECTION in startup_MK22FA12.s to change the MEEN to enable ('00'), or modify the linker file to separate the Flash Config section from RAM.  But they didn't work.  It seems like the solution should be as simple as finding the right, proper linker file for this processor?

Please let me know if my linker/startup codes are ok.

Thanks,
Cecylia

0 Kudos
4,885 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Cecylia,

Sorry for reply late.

I've illustrated some advice to fix the issue

1. Remove the redundant interrupt vectors, if there will a overlap conflict between the interrupt vector and BCA erea.

    My startup file is attached.

2. The bootloader linker just use the K64FN1Mxxx12_application_0x0000.icf is ok, and the linker file of the application code should be adapted to the new start address 0xA000.

And I think your modification is correct.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

4,885 Views
cwati
Contributor III

Hi Ping,


Thanks for your reply!  I've finally managed to make it work using the KDS project (I was more familiar with the startup files syntax for KDS).  The resulting startup file that I used here is similar with what you had.  In essence I had to replace some unused IRQs with the BCA.

But, I also had to start at 0xF000 instead of 0xA000.  The bootloader Release version's size was still 0xa0f4.  So I decided to move up the application code.

But we have it working here, yay!  Thanks a lot!

Best regards,
Cecylia

0 Kudos
4,885 Views
mahendrakumar_a
Contributor II

Hi Cecylia,

Have you ported KBOOT for MK22FN1M0XXX12?

If yes, can you please share the code?

It would help me a lot.

 

Thanks

Mahendra 

0 Kudos
4,885 Views
cwati
Contributor III

Hi Ping,


Sorry I uploaded the wrong directory.  Yes, I changed the flash size for 1M0 board when porting from 512.

Anyways, I will try to port now from K64_120 now and will write down the exact steps.  In the mean time, can you please look up/comment on how to port the "usb_clock_init" from either hardware_init_MK64F12.c or hardware_init_K22F512.c?  Both of these processors have this *CLK_RECOVER_CTRL* registers on their USB Memory Map.

k64f.png

Whereas the K22F_1M0 doesn't have anything after USBFRMADJUST.  Needless to say, I got a Hard Fault when trying to set this.

1m0.png

Maybe there's another file I can port for this part?

Thanks,
Cecylia

0 Kudos