How to make MKL26Z128 be recognized by KBOOT Flash Tool Utility?

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

How to make MKL26Z128 be recognized by KBOOT Flash Tool Utility?

Jump to solution
2,778 Views
MAPC
Senior Contributor I

Hello!

I want to use KBOOT v. 2 to update my application in a MKL26Z128VLH4. As far as I saw, KBOOT v. 2 supports KL25, but it doesn't support KL26, although both have similar Flash memory map.

As I open Kinetis Flash Tool with my FRDM-KL26Z connected to PC USB port, Open SDA CDC COM Port is automatically recognized and baud rate is set to 57600, but if I click on Connect button, I get a message saying it can't connect to the board:

pastedImage_1.png

Theoretically, if it can recognize FRDM-KL25Z, it should recognize FRDM-KL26Z, that has a MCU with similar Flash memory map. Shoudn't it?

How can we fix this?

Thanks!

Marco Coelho

Applications Engineer

Siletec Eletronica

0 Kudos
Reply
1 Solution
2,175 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Marco Aurelio P. Coelho,

   Ok, good test result.

   It means your application code can work, software have no problem.

   Did you add any other component in the NMI pin(PTA4, J1_10)?

   Because I don't have your board, and my FRDM-KL26 don't have this problem, then I can't reflect the problem.

   But I think it is relate to the hardware.

  As you know,  our KL series design normally recommend the customer to add the external 4.7K to 10K pull up resistor in the NMI pin, because the internal pull up resistor is weak.

   So, I recommend you find an external 4.7K to 10K pull up resistor, and add it between pin J1_10 and J3_4, then try again.

   If the NMI pin have interference during power on, the code will be enter NMI directly, and you didn't write the NMI ISR, it will cause the problem, so we can do it from the hardware directly.

Wish it helps you!


Have a great day,
Kerry

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

View solution in original post

0 Kudos
Reply
16 Replies
2,175 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Marco Aurelio P.Coelho,

   Unfortunately, I don't have the B1 version board on my side, but it should be the same with B version.

  You said: If I disconnect and reconnect USB cable to the board, without pressing the reset button, the application never starts.

  After you reconnect the USB cable to the board, if the application code is not work,did you tried the reset button, if you press the Reset button, whether it works?

  Beside, you can try many time reconnect the USB cable, for example, try 10 times, whether the 10 times all didn't work? Each time, you need to wait about 10 seconds.

  I think this is not the bootloader problem, at least the flash bootloader can work in the KL26 chip.

  If you try 10 times, no one is working, and press the reset button it is working, you can try to find a external 10K resistor, try to add it in the NMI pin, and try again.

Wish it helps you!

Any updated information, please let me know.


Have a great day,
Kerry

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

0 Kudos
Reply
2,175 Views
MAPC
Senior Contributor I

Hello, Dear Kerry Zhou

Following your tips, after three times, it starts the application without the need for reset button pressing.

Can you explain me why this happens?

Thanks and regards,

Marco Coelho

0 Kudos
Reply
2,176 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Marco Aurelio P. Coelho,

   Ok, good test result.

   It means your application code can work, software have no problem.

   Did you add any other component in the NMI pin(PTA4, J1_10)?

   Because I don't have your board, and my FRDM-KL26 don't have this problem, then I can't reflect the problem.

   But I think it is relate to the hardware.

  As you know,  our KL series design normally recommend the customer to add the external 4.7K to 10K pull up resistor in the NMI pin, because the internal pull up resistor is weak.

   So, I recommend you find an external 4.7K to 10K pull up resistor, and add it between pin J1_10 and J3_4, then try again.

   If the NMI pin have interference during power on, the code will be enter NMI directly, and you didn't write the NMI ISR, it will cause the problem, so we can do it from the hardware directly.

Wish it helps you!


Have a great day,
Kerry

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

0 Kudos
Reply
2,175 Views
MAPC
Senior Contributor I

You are sure, Kerry!

I just inserted a 10K pull-up resistor on NMI pin and now the application starts in the first connection!

But P&E should mount this resistor on the board with a jumper, don't you think? That would ease the things.

Thank you very much!

Marco Coelho

0 Kudos
Reply
2,175 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Marc Coelho,

    Good! It turns out really the hardware problem.

   P&E won't add the external pull up resistor in NMI pin, because the SWD interface don't have the NMI pin connection, normally, in the MCU smallest system design, should add the external pull up for stable working .

Best Regards,

Kerry

0 Kudos
Reply
2,175 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Marco Aurelio P.Coelho.

    Thank you for your post in the community.

     KBOOT2.0 KL25 flash bootloader also support the FRDM-KL26 board, I already checked it on my side, it works ok.

    Now, please follow my step and try again.

1. open KL25 flash bootloader from folder: \NXP_Kinetis_Bootloader_2_0_0\targets\MKL25Z4

   Please modify the bootloader_config.h, close the I2C, SPI, USB bootloader, like this:

pastedImage_1.png

   Change the debug to release

pastedImage_4.png

Then build the freedom_bootloader, and download it to the FRDM-KL26 board.

2. prepare the app.bin code, you need to relocate the app to 0X8000.

  Take SDK_2.0_FRDM-KL26Z\boards\frdmkl26z\driver_examples\gpio\led_output as an example.

  You need to relocate the code to 0X8000 like this, modify the .icf file:

pastedImage_2.png

Then generate the .bin file and build it.

 I also attached the app bin file:KL26_gpio_led_output_0X8000.bin

3. Open KinetisFlashTool

   1) browse, select KL26_gpio_led_output_0X8000.bin

   2) Target Address:0X8000

   3) Press the FRDM-KL26 on board Reset button, at the same time click the Connect button on KinetisFlashTool.

   You will find it can be connected. Please make sure the port COM number is your board's COM number, you can check it from the device manager

77.jpg

pastedImage_3.png

   4) Click Update button

pastedImage_21.png

Until the update process is completed. Then you will find the on board RED LED is blinking.

Please follow my step and try again on your side.


Have a great day,
Kerry

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

0 Kudos
Reply
2,175 Views
MAPC
Senior Contributor I

Dear Kerry Zhou,

I noticed that you have tested in IAR. Could you please make a try in KDS like me?

Thanks,

Marco Coelho

0 Kudos
Reply
2,175 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Marco Aurelio P.Coelho,

   I have tried the KL25 KDS project on my side, and it works ok with FRDM-KL26, I have attached the KDS KBOOT2.0 flash bootloader project for your reference.

   Please follow my following step try it on your side again:

1.  open bootloader_config.h

   Add code :

#define BL_TARGET_FLASH 1

pastedImage_1.png

  I find the KDS IDE already add this define int he IDE options, but from the code, it seems not defined, you please add the code define like me.

After you add the code, and build the code, you can find the relocate address is BL_APP_VECTOR_TABLE_ADDRESS in vector_table_info.h.

pastedImage_4.png

This is very important, it will relocate the APP to address 0X8000, take care, not 0XA000, your 0XA000 is the K22 flash bootloader code.

2.  Undefine the other peripheral: I2C, SPI, USB_HID, USB_MSC, just to minimize the code size.

   Still the bootloader_config.h:

pastedImage_2.png

3. build the code in release mode, it will save the code size.

   Take care, the bootloader code size can't exceed 0X8000, because 0X8000 already the app address.

   pastedImage_3.png

After build, you can find the code size in console:

pastedImage_5.png

0X496C is not exceed 0X8000, so it can be used.

4. Download it to your FRDM-KL26 chip.

5. Actually, still like the process in my first reply for IAR project.

pastedImage_6.png

pastedImage_7.png

Please try again.


Have a great day,
Kerry

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

0 Kudos
Reply
2,175 Views
MAPC
Senior Contributor I

Hello, Dear Kerry Zhou,

I really loaded the wrong bootloader code. Thanks for warning me! Pure distraction!

With the right bootloader, it connected successfully in Kinetis Flash Tool, and I followed your steps and set led_output demo ".ld" file to start from 0x8000:

pastedImage_1.png

Kinetis Flash Tool shows me it could update the application successfully:

pastedImage_2.png

I tried both your .bin and mine and the application doesn't start (the red led doesn't blink). Any idea?

Thanks and regards,

Marco Coelho

0 Kudos
Reply
2,175 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Marco Coelho,

    It's good to hear you can connect and download.

    Now two more point you need to take care:

  1. Board is FRDM-KL26, don't use FRDM-KL25 with my .bin, because the GPIO port is not the same.

  2. Keep patient, as you know, the flash bootloader have the timeout time, when you reset the board, the code enter the bootloader at first, after about 5 seconds, the bootloader code will timeout, then it will enter the application code. So, after reset the board, wait about 5 seconds, you will see the RED LED is blinking in the FRDM-KL26 board. If you still not OK, try to connect and update the application code again, make sure you are using the correct .bin file.

Wish it helps you!


Have a great day,
Kerry

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

0 Kudos
Reply
2,175 Views
MAPC
Senior Contributor I

Hello, Dear Kerry

I don't know why. It seems that if you use debug version of the bootloader code, it doesn't work. After loading the release version, it worked, but I noticed something strange: I have to press Freedom reset button to make it work. If I disconnect and reconnect USB cable to the board, without pressing the reset button, the application never starts.

Thanks!

Marco Coelho

0 Kudos
Reply
2,175 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Marco Aurelio P. Coelho,

    Debug version will caused larger flash size, it may exceed the 0X8000, so when the app put in the 0X8000, it may cause the bootloader code broken. But the release version cause smaller code,   you can find in my above reply, the generated code is smaller than 0X8000. That's why we recommend you to use the release version.

   About the reset problem, please tell me your FRDM-KL26 version, I will try to find the same version board with you, and test it again on my side.

   My FRDM-KL26 version is : 700-27833 REV B, SCH-27833 REV B. You can find the version in the back side of the board.

Wish it helps you!


Have a great day,
Kerry

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

0 Kudos
Reply
2,175 Views
MAPC
Senior Contributor I

Thanks for response, Kerry

My FRDM-KL26Z version is: 700-27833 REV B1, SCH-27833 REV B, the same as yours, except for "1", but I don't know if this make any difference.

Have a great day!

Marco Coelho

0 Kudos
Reply
2,175 Views
MAPC
Senior Contributor I

Dear Kerry Zhou,

I just noticed that in bootloader_config.h file, the baud rate is set to 19200 and the vector table address is set to 0xA000. So,  I supposed I have to change Target Address to 0xA000 and Baud to 19200 in Kinetis Flash Tool, but it keeps faling:

config_boot.png

connection_fail_new.png

Marco Coelho

0 Kudos
Reply
2,175 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Marco Aurelio P. Coelho,

     I find you are using the MK22F51212 bootoader from your attached picture:

pastedImage_1.png

   If you want to use the KL25 bootloader for the KL26, you must choose the KL25 flash bootloader in folder:

\NXP_Kinetis_Bootloader_2_0_0\targets\MKL25Z4\kds\freedom_bootloader

  I find you even can't connect to the UART COM port. Please use the correct target at first.

   I will give you the detail step and bootloader code which works ok on my side for the KDS project  in the next reply.


Have a great day,
Kerry

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

0 Kudos
Reply
2,175 Views
MAPC
Senior Contributor I

Hello, Dear Kerry Zhou

I have carefully followed your steps, but it doesn't work. The same connection failure comes up to me:

connection_fail.png

What should I do now?

Thanks,

Marco Coelho

0 Kudos
Reply