TWR-KV46F150M: The flash loader program reported an error

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

TWR-KV46F150M: The flash loader program reported an error

Jump to solution
5,326 Views
mvrlee
Contributor II

Hi,

I am programming the TWR-KV46F150M board using IAR-Embedded Workbench 8.40.2 and debugging with PEmicro.

Recently, I was writing a uart_putString() function based on the uart_putchar() from the TWR-KV46F150M QSP. After I have downloaded the code to the board and try to test the uart_putString() function, I encountered an exception and then I quitted the debug mode. Ever since then, I cannot download any program to the board, including those which used to work fine from the QSP, like the LED Demo program. The error message was "The flashloader program reported an error. A fatal error has occurred, the debugger will now terminate". I experience the same error message whether or not I check the "Override default .board file" options under the "use flashloader" option. 

I have been researching for a solution and one is to disable the flash loader. I followed the suggestion but then the program will get stuck in some disassembly code, showing that a hard fault exception has occurred, but i dont know what caused it or how can i fix it. This has nothing to deal with the software because it is LED demo program in the QSP, which used to work fine. 

Below are some screen captures of the problems i mentioned.

1) Use Flashloader (with or without "Override default .board file)

flashloader error 1.pngflashloader error 2.png

flashloader error 3.png

2) Flashloader disabled

without flashloader error 2.png

without flashloader error 1.png

without flashloader error 3.png

3) The uart_putString() function that called all the problems at first place

uart_putString 1.png

uart_putString 2.png

1 Solution
4,938 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Raymond Lee,

  Let's take the sdk helloworld project as an example:

\SDK_2.6.0_TWR-KV46F150M\boards\twrkv46f150m\demo_apps\hello_world\iar

  I have tested it on my side with the opensda debugger, it works OK.

pastedImage_1.png

My flashloader configuration is:

pastedImage_2.png

Even choose the .board, it the the same:

pastedImage_3.png

Now, I suggest you change your on board debugger to the JLINK:

1) power off the board

2) press SW5 and hold on it, don't release it, then plug the usb cable

  You will find the board is the device named as BOOTLOADER, release the SW5 button.

3) Download the JLINK software install it

  https://www.segger.com/downloads/jlink/JLink_Windows.exe 

Download the JLINK firmware:

https://www.segger.com/downloads/jlink/OpenSDA_TWR-KV46F150M 

Send "37_OpenSDA_TWR-KV46F150M.bin" to your "BOOTLOADER"

4) Power off and power on the board again.

pastedImage_6.png

You will find the on board debugger is already JLINK.

5) open the JLINK commander, check the connection

pastedImage_7.png

Can you find the ARM cortex-M4 core?

If you can't find the ARM core, you can input: unlock kinetis

Just do the mass erase.

If yes, then you can use the JLINK to debug the helloworld again.

pastedImage_8.png

JLINK test result:

pastedImage_9.png

Please try it on your side again.

 

Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

12 Replies
4,938 Views
kerryzhou
NXP TechSupport
NXP TechSupport

What's the updated information, I can't see your updated content.

0 Kudos
Reply
4,938 Views
mvrlee
Contributor II

Hi kerryzhou‌,

Thank you so much Kerrry! I followed your suggestion and switched to using the JLink debugger. Everything was going smooth, I could successfully identify the board in the JLink commander, then i changed my project to use JLink as the debugger. Now I can successfully use flash loader to download the program to the board.

0 Kudos
Reply
4,938 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Raymond Lee,

  That's good to hear you also make it works.

  If you have the question in the future, welcome to create the new question post.

Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

0 Kudos
Reply
4,938 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Raymond Lee,

   Thanks a lot for your trust and the interest in the NXP kinetis products, I have received your question reply request from the message, so I reply you directly in your question post!

   About your problems, I suggest you try another way, please download the TWR-KV46F150M related newest SDK code from this link:

  https://mcuxpresso.nxp.com/en/select 

  Find the TWR-KV46F150M board, generate the code and download it.

   You will find the SDK package already contains the IAR project, you can try the sdk iar project directly, whether you still have problems or not? SDK code has been tested in the NXP side.

  If you still have questions about it after you testing the SDK code, please let me know.

Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

4,938 Views
mvrlee
Contributor II

Hi Kerry,

I just followed your suggesting to download the latest SDK of my board but the same situation occurred. If I disable the flash loader, the hard fault occurs and if I use flash loader, I could not even start the debugging session because the flash loader reported an error.

Below are the steps of how i downloaded the latest SDK.

1) I chose my board and selected the tool chain to be IAR Embedded Workbench.

SDK 1.png

2) I downloaded the SDK archive file

SDK2.png

3) I opened one of the IAR workspace. The one I used is listed below.

SDK_2.6.0_TWR-KV46F150M\boards\twrkv46f150m\driver_examples\uart\interrupt\iar

The project builds fine with 0 warnings and errors, but when i download it to the board, same situation occurs just as above mentioned.

Please advise if i followed the steps wrongly. Thanks again Kerry!

0 Kudos
Reply
4,938 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Raymond Lee,

You side:  If I disable the flash loader, the hard fault occurs and if I use flash loader,

Please tell me which flashloader, please give me a screenshot about it, do you mean, your side, also have other TWR-KV46F150M board, but just one TWR-KV46F150M have this problems, right?

Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

4,938 Views
mvrlee
Contributor II

Hi kerryzhou,

Sorry for not being clear enough in my question. The situation now is that if i select "use flash loader" in Project->Options->Debugger->Download in IAR, I cannot even enter debug mode when i download and debug (Ctrl + D), the error messages "The flash loader program reported an error, A fatal error has occurred, the debugger will terminate now" just pops out and ends my debug session. (Note that these error messages come out before i even get into debug mode).

However, If i do not select "use flash loader", I cannot successfully get into debug mode and check on registers and stuff. Its just that the hard fault occurs so that my program is stuck in one location, which can be observed from my screen captures in the post. The important part is that this hard fault occurs way before my main function starts, meaning that i cannot really debug things in my main() or observe any behaviour from the board due to my main().

Now, responding to your question, "do you mean, your side, also have other TWR-KV46F150M board, but just one TWR-KV46F150M have this problems, right?" -> Yes. I have several TWR-KV46F150M boards. But this board that is having the issue is the only one that i have tested the uart_putString() function. As i have said this uart_putString() function caused one exception in the very beginning, (I was not paying attention to what the exception is, I just knows that the uart_putString() function was the source and thats why i ended the debug mode right away to make some changes to the function and hopefully fix the exception). Ever since then, I experience the sitatuion above. 

As to "Please tell me which flashloader, please give me a screenshot about it", I am not very sure what you're meaning, how do i get you a screenshot of the flash loader i use? I will respond as quickly as I can to aid your debugging process.

I hope these clarifications helps. Thank you so much Kerry.

0 Kudos
Reply
4,939 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Raymond Lee,

  Let's take the sdk helloworld project as an example:

\SDK_2.6.0_TWR-KV46F150M\boards\twrkv46f150m\demo_apps\hello_world\iar

  I have tested it on my side with the opensda debugger, it works OK.

pastedImage_1.png

My flashloader configuration is:

pastedImage_2.png

Even choose the .board, it the the same:

pastedImage_3.png

Now, I suggest you change your on board debugger to the JLINK:

1) power off the board

2) press SW5 and hold on it, don't release it, then plug the usb cable

  You will find the board is the device named as BOOTLOADER, release the SW5 button.

3) Download the JLINK software install it

  https://www.segger.com/downloads/jlink/JLink_Windows.exe 

Download the JLINK firmware:

https://www.segger.com/downloads/jlink/OpenSDA_TWR-KV46F150M 

Send "37_OpenSDA_TWR-KV46F150M.bin" to your "BOOTLOADER"

4) Power off and power on the board again.

pastedImage_6.png

You will find the on board debugger is already JLINK.

5) open the JLINK commander, check the connection

pastedImage_7.png

Can you find the ARM cortex-M4 core?

If you can't find the ARM core, you can input: unlock kinetis

Just do the mass erase.

If yes, then you can use the JLINK to debug the helloworld again.

pastedImage_8.png

JLINK test result:

pastedImage_9.png

Please try it on your side again.

 

Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

4,938 Views
mvrlee
Contributor II

Hi kerryzhou‌,

I am afraid I will not be able update you with the results today. I think I will most likely finish testing out your suggestion on Monday. Thanks.

0 Kudos
Reply
4,937 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Raymond Lee,

  It doesn't matter,  any time when you update me, I will give you feedback.

  It's no problem on Monday.

  BTW, if the JLINK works, it perfect, then you also can try back the newest opensda firmware, which can be downloaded from this link:

PEmicro | Experts in Embedded tools for Flash Programming and Development 

Wish it helps you!

Any updated information, just let me know.

Waiting for your updated information.

Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
4,938 Views
mvrlee
Contributor II

Hi kerryzhou‌,

Thank you for your response! If I use PEmicro to debug the hello word project, same situation occurred. I will now try to use JLink to debug my project. Just a thought, if the JLink works, does that mean its PEmicro debugger's problem not my hardware issue? Anyway, I will let you know the results ASAP after I try using JLink. Thank you Kerry!

0 Kudos
Reply
4,938 Views
mvrlee
Contributor II

Hi Kerry,

Thank you so much for your reply and help! I am currently following your suggestion and I will let you know if i get any results. Btw, did you suspect that it was my IAR project software which caused the problems? I have several TWR-KV46F150M boards but the same project works fine. I also tried using another project with another computer to download the code but the same situation occurred. Therefore, I suspect that it is this particular board I have that has some hardware problems. Just voicing this out to see if you find it of any use to sort out the cause. 

0 Kudos
Reply