(Solved) Unable to program MK22FX512AVLQ12 controller

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

(Solved) Unable to program MK22FX512AVLQ12 controller

Jump to solution
8,314 Views
gauravmore
Contributor III

Hi ,

I am using MK22FX512AVLQ12 controller in one of my product. I have made the development board for the same. But after assembly I am not able to programm the controller. i am using PE MICRO FX debugger. Before going for the development board design I first evaluated  FREEDOM K22F evaluation board. 

I used MCU Xpresso for the evaluation and PE MICRO (Rev B, D, FX Rev D) All these wer able to programme. Also i used LPC11U68 Eval board Debugger for programming . I was able to programm and debug using all these debuger.

But now when i made the development board of MK22FX512AVLQ12 controller and tried to programme then it is showing error.

I have attached the schematic and also made the modification in the hardware like pull up to EZ_CS pin as per the input from one of the forum. 

I am facing this issue from last 3-4 days but still no sucess, please check the schematic and suggest the solution for the same.

jeremyzhouconverse

Thanks 

Gaurav More 

Labels (1)
0 Kudos
1 Solution
6,735 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More

   It doesn't matter, Jeremy is my colleague :smileyhappy:

   If your question is solved, please help to mark the correct answer, thank you!

-------------------------------------------------------------------------------
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

47 Replies
2,399 Views
gauravmore
Contributor III

Hi  Kerry,

Thanks for the reply.

We are able to download the bin file in the board and also checked the LED toggling. We can see it toggling as well,

pastedImage_1.png

 

Also one more observation is that, When we erase using erase_all_Pin.JLK command we were able to erase it  then after that for some time I did not put any code in the controller . The development board was on . We just tried to load the code again assuming that it is already erased, but again it got locked. This behaviour is not clear.

Trying to understand the reason for the same.

Thanks 

Gaurav More

0 Kudos
2,399 Views
gauravmore
Contributor III

Hi Kerry,

I have posted the log you can check. Also I have updated the firmware of Jlink which I downloaded  is OpenSDA_V2_1.bin instead of  01_OpenSDA_FRDM-K22F.bin

Regarding the PE Micro I have already checked and also taken care regarding the  VCC, GND, SWD_DIO, SWD_clk, reset_B pins 

But no success. It is not connecting. However we verified the connection of the FRDM and PEMICRO both are same. 

One question can we make the Jlink to PE Micro by downloading  the firmware of PE Micro?

Thanks

Gaurav More.

0 Kudos
2,405 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

   Thank you for your interest in the NXP kinetis product, I am the kinetis engieer, and would like to help you.

   I have review your schematic, some points you need to note:

1. NMI pin need to add external 4.7K to 10K pull up in the practical application

  Your PTA4 NMI pin is floating, I suggest you add the external pull up resistor.

2. SWD_DIO add the external 10K pull up resistor.

3. Vout33 pin need to add this circuit:

pastedImage_1.png

About your problem can't program the customer MK22FX512AVLQ12  board.

I suggest you find a JLINK, then use the JLINK commander to check, whether you can find the ARM cortex M4 core or not? If you don't have the JLINK, you can use the FRDM-K22 board, this board has the onboard debugger, you can firmware it as the JLINK, then connect it to the external K22 chip, but you need to disconnect your FRDM on board SWD_CLK to on board chip, J7!

Please double check the above points and test it again.

Wish it helps you!

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
2,405 Views
gauravmore
Contributor III

Hi Jeremy,

Thanks for your reply,

I will follow the instructions suggested by you. Out of that, 1st 2 points we have already modified at our side . Will check after modifying the 3rd point.

Regarding the FRDM board I am facing issue of Driver installation after connecting the FRDM board it starts the installation but it is unable to install some drivers.

Screenshot attached.

pastedImage_1.png

But I have evaluation board of LPC11U68 and PE MIcro FX Rev D. Can i use LPC11u68 Evaluation board? I tried to programm the FRDM eval board using LPC11U68 since i was facing the issue with the drivers installation.

Is it necessary to use Jlink only for this controller? I do not have rigth now and will take time to get after ordered.

Please confirm the above reagrding the usage of the debugger i mentioned apart from JLink.

Thanks 

Gaurav More

0 Kudos
2,405 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

  What's the windows system you are using?

  If you are using win10 with FRDM-K22, please refer to this link:

OpenSDA Serial and Debug Adapter | NXP  

   You need to update the on board K20 debugger firmware at first.

   If you are using win7, it should don't have problems.

   Do you try the JLINK firmware for FRDM-K22 ?

  1, You need to install the JLINK driver at first:

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

  2. Enter bootloader mode

     Power off the board, press the reset button and hold on it, power on the board, you will find the board is the device named as "BOOTLOADER". Then release the reset button.

     Then you can send this firmware to the BOOTLOADER:

   https://www.segger.com/downloads/jlink/OpenSDA_FRDM-K22F 

    Power off and power on the board again, your FRDM-K22 on board debugger should be the JLINK.

About the LPC11U68 EVK, in my memory, this on board debugger can't debug the external MCU, I suggest you use JLINK, just used to check whether you can find the ARM core, your P&E tool also can try to debug the K22 chip, you can try it, then check the log, can you use the P&E micro tool find the ARM core? If you can't find the ARM core, it means your hardware have problems.

 You can share your P&E Micro debug tool log or the test result with me, then I will help you to check it.

Wish it helps you!

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
2,405 Views
gauravmore
Contributor III

Hi Kerry,

Sorry I used name Jeremy :smileyhappy: Instead. Thanks for the reply.

I tried all the procedures mentioned by you and able to successfully programm the development board.

Thanks a lot. After so many tries we got the solution. Thank as lot.

Thanks 

Gaurav More

0 Kudos
6,736 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More

   It doesn't matter, Jeremy is my colleague :smileyhappy:

   If your question is solved, please help to mark the correct answer, thank you!

-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------

2,405 Views
gauravmore
Contributor III

Hi Kerry,

After trying the procedures I am able to programm the code but now when i teied it multiple times then it gives me the error mentioned below.

When i tried to mass erase the controller and when I connect the board through SWD with J link the  FRDMK22F board's small red LED (D2) is turned on.

 

Executing flash operation 'Erase' (Erase flash) - Fri Nov 29 15:25:57 IST 2019
Checking MCU info...
Scanning for targets...
Executing flash action...
SEGGER J-Link Commander V6.42b (Compiled Feb 5 2019 17:33:07)
DLL version V6.42b, compiled Feb 5 2019 17:31:40
J-Link Command File read successfully.
Processing script file...
J-Link Commander will now exit on Error
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link OpenSDA 2 compiled May 27 2019 11:01:03
Hardware version: V1.00
S/N: 621000000
VTref=3.300V
Target connection not established yet but required for command.
Device "MK22FX512AXXX12" selected.
Connecting to target via SWD
InitTarget()
Connect Under Reset
Communication error while accessing MDM-AP.
Connect Under Reset
InitTarget()
Connect Under Reset
Communication error while accessing MDM-AP.
Connect Under Reset
****** Error: InitTarget(): PCode returned with error code -1
InitTarget()
Connect Under Reset
Communication error while accessing MDM-AP.
Connect Under Reset
InitTarget()
Connect Under Reset
Communication error while accessing MDM-AP.
Connect Under Reset
****** Error: InitTarget(): PCode returned with error code -1
Cannot connect to target.
Script processing completed.
Unable to perform operation!
Command failed with exit code 1

 

What would be the reason for the same. since the code is the same with LED Toggling only. 

This issue is similar with the issue mentioned in  below link

https://community.nxp.com/thread/378870 

But here i am using FRDM_K22F board for programming and debugging my development board,

Please check for the same and let us know . It seems like the controller is in reset wihile Jlink is trying to connect. So no core is found. 

Need to know the exact procedure for removing the controller form unlock mode other wise once it is unlocked the we programmed then againg it behaves the same way. This is waht is observed in most of the forums related to FRRDM K22F.

Awaiting reply.

Thanks 

Gaurav More

0 Kudos
2,405 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

 Sorry for my later reply!

 What's the PC operation system you are using now? If you are using the win10, your on board old K20 opensda may be corrupted:

OpenSDA Serial and Debug Adapter | NXP 

  But, I suggest you switch to the FRDM-K22 on board K22 chip at first, then use the JLINK to detect the on board chip, whether it can find the ARM core or not?

  If the on board JLINK can find the on board K22, just can't detect your external K22 chip, it means your external K22 maybe locked, you can try this commander: unlock kinetis

  Please try it on your side.

  Any updated information, please kindly 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.
-------------------------------------------------------------------------------

0 Kudos
2,405 Views
gauravmore
Contributor III

Hi Kerry,

Thanks for the reply, 

We are using Windos 7 Professional. As per your input I created JLink using FRDM-K22F Evaluation board and I was able to program, but then I started facing the issue as I already metioned earlier,  Also we  have already followed the procedure you sugegested.

It may possible that the Chip may get locked but then for other  boards also the same behaviour is repeated. While refering the forums , we came across one forum link   Communication error while accessing MDM-AP. based on the error we get.

After refering this forum and downloading the documents and following the instructions we are  again able to bring back the controller and reprogram and debug . But again after debug for arougn 2 times the same behaviour is repeated. then we again repeated the same process then after some time we get success, This is happening consistently. 

Due to this behaviour of the controller we are not able to conclude that whether the problem is related to Jlink which is created or with the hardware. Also reason is we tried to programm one FRDM-K22F evaluation board with the other FRDM-K22F evaluation board in whihc Jlink is created and there we are not facing any issue. 

The controller in the Evaluation board MK22FN512VLH12.

We are not able to debug the board and proceed for our development and it is comming under our critical path as it  has been around 3 weeks we are struggling.

Based on your input we moved one step ahead  but again  facing the issue mentioned above. Please let us know whether any thing elle we are missing in hardware ot  in the Jlink creating process.

Awaiting your reply.

CC: vaibhavi.padwal@lntebg.com

Thanks,

Gaurav More

0 Kudos
2,405 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

  Do you read the document: Kinetis Lock issue analysis and unlock way.pdf in the link which you shared?

Communication error while accessing MDM-AP. 

  This document is the classic kinetis lock document.

  Please check it in details.

  BTW, check your firmware, whether you lock the code in the firmware, 0X40C, check it,

pastedImage_2.png

Do you lock it in the code?

 Now, if you use the FRDM-K22 with the on board K22 chip, you also enter the lock problems? You can download the official SDK code for FRDM-K22 , whether it still have problems?

Any updated information, 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.
-------------------------------------------------------------------------------

0 Kudos
2,405 Views
gauravmore
Contributor III

Hi Kerry,

Yes I refered the document and followed the procedure. 

Yes I was able to program and debug the othere FRDMK22 board and yes the project created is using the SDK and I am not facing any issue.  Now I will check with the Official SDK code and alos is upgraded the OpenSDA Ver 2.1 as per the link provided by you  in the above reply.

Regarding the Lock in the firmware that need to check but,  How to check or compare whether the lock is enable in the SDK and My firmware?

Thanks 

Gaurav More

0 Kudos
2,405 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

  If you are using the SDK in default, the code didn't lock the secure byte.

  Abou your own firmware, you can generate the .hex file, then check flash address 0X40C data, and compare with the the FSEC register which I post you in the last reply.

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
2,405 Views
gauravmore
Contributor III

Hi Kerry,

I check the flash settings in 0x40C in the project that we created. 

pastedImage_2.png

The values of the  FSEC registor in the SDK  based project.

pastedImage_3.png

You can see both are same but when we project the development board after once we program then we are not able to connect . But same thing when we did with the FRDM K22F board then there its working fine for multiple times . please find attached project for bothe the controllers for your reference i order to find the difference between the code w.r.t to JLink or Jtag access

CC:vaibhavi.padwal@lntebg.com

Thanks 

Gaurav More

0 Kudos
2,405 Views
kerryzhou
NXP TechSupport
NXP TechSupport

I will test your attachment on my side tomorrow on my FRDM-K22 board, then give you feedback.

Please wait patient.

Best Regards,

kerry

0 Kudos
2,405 Views
gauravmore
Contributor III

Hi Kerry,

Any Update regarding the issue.?

Thanks 

Gaurav More

0 Kudos
2,405 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

  So the FRDM-K22 SDK project no problems on the FRDM-K22 board, right?

  Just your customer board with the MK22FX512AXX12 project after download the code, the debugger can't be connected, right?

   I have checked my side, I don't have the MK22FX512AVLQ12 board, so I can't test it directly.

   I create an empty project, please download it to your project, whether it works or not? After you download the code with debugger, can you debug it? After disconnect the debugger, then use the JLINK commander connect it through SWD, can you find the ARM core or not?

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
2,405 Views
gauravmore
Contributor III

Hi Kerry,

Thanks for the reply.

I checked the project that you sent.  For the first time after erase we were able to program the controller  and debug the same. then we terminated it and again try to relaunch, then also it was programmed, but when we run the code then we got this behaviour,

pastedImage_1.png

after this we tried to reset the code then it got terminated. Again we tried to relaunch and it failed by giving  error.

Executing flash operation 'Erase' (Erase flash) - Fri Nov 29 15:25:57 IST 2019
Checking MCU info...
Scanning for targets...
Executing flash action...
SEGGER J-Link Commander V6.42b (Compiled Feb 5 2019 17:33:07)
DLL version V6.42b, compiled Feb 5 2019 17:31:40
J-Link Command File read successfully.
Processing script file...
J-Link Commander will now exit on Error
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link OpenSDA 2 compiled May 27 2019 11:01:03
Hardware version: V1.00
S/N: 621000000
VTref=3.300V
Target connection not established yet but required for command.
Device "MK22FX512AXXX12" selected.
Connecting to target via SWD
InitTarget()
Connect Under Reset
Communication error while accessing MDM-AP.
Connect Under Reset
InitTarget()
Connect Under Reset
Communication error while accessing MDM-AP.
Connect Under Reset
****** Error: InitTarget(): PCode returned with error code -1
InitTarget()
Connect Under Reset
Communication error while accessing MDM-AP.
Connect Under Reset
InitTarget()
Connect Under Reset
Communication error while accessing MDM-AP.
Connect Under Reset
****** Error: InitTarget(): PCode returned with error code -1
Cannot connect to target.
Script processing completed.
Unable to perform operation!
Command failed with exit code 1

As result agian we faced the same issue with your project as well. Do we have any SDK similar to FRDMK22F board? or any evaluation board of K22FX series?

Similar behaviour  is observed with your project as well. 

Let me know what to do for this, Is there thing w are missing in the hardware which is required,or also you can check with the people who have used this controller MK22FX512AVLQ12 .

Thanks

Gaurav More

0 Kudos
2,405 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

  When you use my project, if you set a breakpoint in the main, can you enter the main?

  Or you totally can't make the project works?

  About the official board, we don't have the MK22FX512AVLQ12 board, the similar board is TWR-K21F120M board, but it also can't fun the MK22FX512AVLQ12 code.

  I attach a bin file, the code function is toggle PTC18, it is your LED1.

  You can use the JLINK commander to download the .bin file to your board directly, copy MK22FX512AVLQ12 _TEST.bin to your JLINK install path, the JLINK commander is:

 loadfile MK22FX512AVLQ12 _TEST.bin 0x00

  Please try it on your side, after download the code, you can power off and power on the board again, check your PTC18, whether it is working or not?

  I use KDS IDE generate the code, no SDK.

Any updated test result, please kindly 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.
-------------------------------------------------------------------------------

0 Kudos
2,405 Views
gauravmore
Contributor III

Hi Kerry,

Thanks for the reply,

Yes we were able to programm the using your project and was able to run and stop in main but only for the first time. But after terminate and relaunching the same code, it was entering the main , instead it was going to some address

pastedImage_1.png

then we tried to stop and reset te code but still it was not running in main. Now regarding the bin file you sent, did'nt get the purpose of this since if it runs then  what will we conclude? 

Still i will check and let you know immediately. 

Thanks 

Gaurav More.

0 Kudos
2,405 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

   Do you already add the pull up in the PTA4 or not?

  If after erase, when you debug the code, run, not exit, it works all the time, right?

  If you do the reset in the IDE, then run it again, whether it works or not?

  if you toggle a GPIO in the code, then download it, exit the debug mode, power off and power on, whether the app function works or not? Or just the secondary debugger connect problems.

  

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