(Solved) Unable to program MK22FX512AVLQ12 controller

cancel
Showing results for 
Search instead for 
Did you mean: 

(Solved) Unable to program MK22FX512AVLQ12 controller

Jump to solution
1,620 Views
Contributor II

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
41 Views
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
25 Views
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

   It's good to hear that my new .bin code works on your side.

   Now, it seems your problem still be caused by the hardware instability!

   Please do these following things checking:

1. After you download the gpio toggle firmware, then use the JLINK to connect your board again, you will find it can't connect, please use the oscilloscope to check reset pin wave, then send it to me!

2. Do you solder any other board with the same schematic? Still the same problem?

   Don't just test one board, try more boards, whether have the same problem?

3. When you sold the board, please note the temperature can't exceed 260 degree.

4. When you connect the JLINK, please note the power on and power off sequence.

   Power on: connect Debugger, power on the target board

   Power off: Power off the target board, disconnect debugger

  Just don't do the hot plug

5. Please check your power

   Whether it is stable or not? You can also try to use the FRDM-K22 on board VDD to power on your target board.

6. You can add refer to Marceli Firlej, add 1nf capacitor to SWD_CLK pin, just make sure your debugger signal is stable and no glitch.

7. debugger wire should be smaller than 15cm.

Please check the above points.

Any updated information, just kindly let me know.

  

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
25 Views
Contributor II

Hi Kerry,

Thanks for the reply. 

We will  check and update you soon. But  there is one query regarding the controller we ae using.  We have selected MK22FX512AVLQ12 but we also have MK22FX512AVL12 . What is the difference in these controllers? 

We tried with MK22FX512VLQ12 as well . 

For MK22FX512VLQ12 NXP says not recommended for furture design. What if used the code of MK22FX512AVLQ12 and programmed in MK22FX512VLQ12 controller?

Also reagrding the firmware you sent we downloaded it and checked it is working but the we tried to reconnect the board to debug our firmware, but we are not able to connected. Then we tried to erase using erase_all_pins.jlk command and then tried to downliad you code again then we re getting this error

pastedImage_1.png

then onwards we tried to erase but now it is not erasing instead it is giving this error

pastedImage_2.png

We are trying to eraase but still nort able erase.  Not able to find the reason for the same.

 

Thanks 

Gaurav More

0 Kudos
25 Views
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

   About the K22 series, you can refer to :

Kinetis K22_120 MHz devices 

  k22A has the difference with K22 series, the UART register is not the same, K22A has more register than K22, so if you download the K22A code to the K22, when access the register which the K22 don't have, it will have the hardfault problems

  MK22FX512VLQ12 is not recommended, but MK22FX512AVLQ12 is recommended. I don't recommend you download the MK22FX512AVLQ12 code directly to the MK22FX512VLQ12 , just as I have said, the register has the difference.

pastedImage_2.png

pastedImage_3.png

So, I don't recommend you download A version code to none A version K22 chip, it will have problems.

About your lock problems, I still think it is related to your hardware stability problem, not just the software.

Please still check the hardware points which I have mentioned. Try more boards, not just one.

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
25 Views
Contributor II

Hi Kerry,

Thanks for the reply,

One mistake from our side , we were trying to program MK22FX512VLQ12  using MK22FX512AVLQ12  Project. 

So we made the modification and created a new project for MK22FX512VLQ12 and made the modification suggested by marceli@controldevices.net .  

As a result we were able to program the code multiple times. But in between we are facing certain issues like 

1. while trying for multiple times debugg by terminating and relaunching in gives follwing error

ERROR: Could not connect to target.

  SEGGER J-Link GDB Server V6.42b Command Line Version

  JLinkARM.dll V6.42b (DLL compiled Feb  5 2019 17:31:40)

  Command line: -nosilent -swoport 2337 -select USB=123456 -telnetport 2338 -singlerun -endian little -noir -speed auto -port 2339 -vd -device MK22FX512xxx12 -if SWD -halt -reportuseraction

  -----GDB Server start settings-----

  GDBInit file:                  none

  GDB Server Listening port:     2339

  SWO raw output listening port: 2337

  Terminal I/O port:             2338

  Accept remote connection:      localhost only

  Generate logfile:              off

  Verify download:               on

  Init regs on start:            off

  Silent mode:                   off

  Single run mode:               on

  Target connection timeout:     0 ms

  ------J-Link related settings------

  J-Link Host interface:         USB

  J-Link script:                 none

  J-Link settings file:          none

  ------Target related settings------

  Target device:                 MK22FX512xxx12

  Target interface:              SWD

  Target interface speed:        auto

  Target endian:                 little

  Connecting to J-Link...

  $$UserActionStart$$: Terms of use

  $$UserActionEnd$$: Terms of use

  J-Link is connected.

  Device "MK22FX512XXX12" selected.

  Firmware: J-Link OpenSDA 2 compiled May 27 2019 11:01:03

  Hardware: V1.00

  S/N: 621000000

  Checking target voltage...

  Target voltage: 3.30 V

  Listening on TCP/IP port 2339

  Connecting to target...InitTarget()

  Connect Under Reset

  Device will be unsecured now.

  Found SW-DP with ID 0x2BA01477

  InitTarget()

  Connect Under Reset

  Device will be unsecured now.

  Found SW-DP with ID 0x2BA01477

  ERROR: DAP error while reading DP-Ctrl-Stat register.

  ERROR: Could not connect to target.

2. After that we erase the flash using MCU Xpresso GUI flash erase tool. And again we tried to program and debug, Then it gives following error,

   pastedImage_4.png

3. When we click on yes the it gives the same error again and then we click yes and then it goes into the following loop.

pastedImage_5.png

4. After that we terminate it and agian tried to launch and debug. then it again gives the error mentioned in 1st point. after that we shut down the power and also disconnect the Jlink from PC and again powerup both and then tried to program then it got programmed. 

Only diffeence we observed is that it is erassing the flash using MCUXpresso GUI tool. and it is not required any Jlink commander til now,

What is the reason for the same? This behaviour is also not sure need the same sequence which we followed mentioned in 4 the point. Some times it is not allowing to erase the controller and it shows Point no 2 error. and gives the error "ERROR: DAP error while reading DP-Ctrl-Stat register."

Thanks 

Gaurav More

0 Kudos
25 Views
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

  Do you check the hardware which I mentioned in the previous reply?

2. Do you solder any other board with the same schematic? Still the same problem?

   Don't just test one board, try more boards, whether have the same problem?

3. When you sold the board, please note the temperature can't exceed 260 degree.

4. When you connect the JLINK, please note the power on and power off sequence.

   Power on: connect Debugger, power on the target board

   Power off: Power off the target board, disconnect debugger

  Just don't do the hot plug

5. Please check your power

   Whether it is stable or not? You can also try to use the FRDM-K22 on board VDD to power on your target board.

6. Too long debugger cable (such as 40~50cm) can lock the chip and make the debugger working unstable.

 

Just as I said, if you app FSEC is not secured in the code, you lock problem should still caused by the hardware unstable problems. Check your power supply, more boards, debugger wire, etc.

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
25 Views
Contributor II

Hi Kerry,

One observation regarding the code. When we program the controller with GPIO Toggling code then while debugging it is observed that this goes to NMI Handler

pastedImage_1.png

and when we checked the voltage at PTA4 Which is 3.3V pulled up with 10K resistor it is showing 1.2 to 1.6 Volt.

As per the data sheet  controller will go to NMI handler if there is interrupt in the pin. 

pastedImage_2.png

Is it the case that due to this pin it is not allowing Jlink to debug the controller?  We also tried by disabling the pin in the code but still it hangs and when checked it shows that it is in NMI handler

Thanks 

Gaurav More

0 Kudos
25 Views
NXP TechSupport
NXP TechSupport

Hi Gaurav More

  Thanks for your updated information.     Please change your NMI pull up resistor to 4.7k instead of 10K, it seems your 10K still not enough.

   Please try it on your side.

   Any updated information, just let me know.

Best Regards,

Kerry

0 Kudos
25 Views
Contributor II

Hi Kerry,

Thanks for the reply.

I made the change suggested by you and it worked. I also tested it on other boards as well after making following modifications.

1. NMI Pin  with 4.7K Pull up

2. Added the circuit to Vout33 Pin as  you mentioned

3. SWDIO pin  with 10K pullup

4. SWDCLK  with 1nF capacitor

After making all these changes I am able to program the controller multiple times without any error. I have attached the schematic which is modified . Kindly review the same and revert.

There is one query reagarding this issue. Can you send me the document which mention all these changes documented in data sheet or application note or an Erata. Since we were not able to find this information while referring the datasheet and reference manual of the controller.  Since it has taken a long time to find out the issue and resolve.

Thanks 

Gaurav More

0 Kudos
25 Views
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

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

  About the hardware points, you can refer to the kinetis peripheral module quick reference:

https://www.nxp.com/webapp/Download?colCode=KQRUG 

Wish it helps you!

If you meet the new questions, 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
25 Views
Contributor II

Hi Kerry,

Thanks for the reply.

We checked with PE MICRO as well  and it worked with that as well. Also please review the schematic modified as per your inputs. 

Please share the document since we are not able to open that link which you shared.

https://www.nxp.com/webapp/Download?colCode=KQRUG 

Thanks 

Gaurav More

0 Kudos
25 Views
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

  Do you login the NXP account? I have double checked it, if you login it, you will get the download link.

Or you can go to this link:

Arm® Cortex®-M4|Kinetis K60 100 MHz 32-bit Microcontrollers|NXP | NXP 

You will find the KQRUG under recommended documents.

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
25 Views
Contributor II

Hi Kerry,

Thanks for the reply.

It seems there was a problem with the network at our side. I am able to download the document. I will go through the same and revert if found anything to discuss.

Thanks 

Gaurav More

0 Kudos
25 Views
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

  Ok, you can check it.

  If you still have question, it's better to create the new question post, thank 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
25 Views
Contributor II

Hi Kerry,

1. Do you check the hardware which I mentioned in the previous reply? -- Yes we Followed the same.

2. We assembled other boad as well and now we are trting on the newly assembled board.

3.  When you sold the board, please note the temperature can't exceed 260 degree. --- . Yes we did. But what if it is done with mode that 260 degrees?

4. When you connect the JLINK, please note the power on and power off sequence.

   Power on: connect Debugger, power on the target board  --  In this case when we connect the Jlink of FRDMK22 board the it self it gets power from FRDMK22 Jlink

   Power off: Power off the target board, disconnect debugger -- We are doing the same.

  Just don't do the hot plug -- But when we use the Jlink even if we power off the target board then also it is getting the power from Jlink. 

5. Too long debugger cable (such as 40~50cm) can lock the chip and make the debugger working unstable. -  Now the length is around 20cm.

Just as I said, if you app FSEC is not secured in the code, you lock problem should still caused by the hardware unstable problems. Check your power supply, more boards, debugger wire, etc.

-- As you said we are trying on other boards as well..

Now the controller is not allowing to erase the flash.

Following error occurs frequenctly while debugging. Ince the progamm is loaded then we power off the board and then follow the same sequence then aging try to debug then it gives 

pastedImage_5.png

Thanks 

Gaurav More

0 Kudos
25 Views
Contributor III

Hi,

I always adding 1nF capacitor to SWD_CLK pin and this helps.

Regards,

0 Kudos
25 Views
NXP TechSupport
NXP TechSupport

BTW, do you have any external Segger JLINK? Whether can you try the Segger JLINK directly instead of the FRDM-K22 on board debugger?

Best Regards,

Kerry

0 Kudos
25 Views
Contributor II

Hi Kerry,

I followed the process to suggested like 

1. Copied the file into specified location C:\Program Files (x86)\SEGGER\JLink

2. MAss Erase 

4. Unlock kinetis

5.  usb

6. connect and    After connect, then use the loadfile command to download the code.

See the log below. 

 

pastedImage_1.png

No I donot have the external Seger Jlink that why  I made it using K22FRDM board as per your procedure. But that Jlink is workig fine with FRDM board Programming and Debugging, So i think there is no issue with the Jlink created,

Can you create the Jlink at your side instead of using the seperate Jlink and programm the other FRDM board as we are doing.  See I want to confirm the Jtag to be used then only  I can order. Since PE Mocro and CMSIS-DAP is not working so only Jlink need to tested, but as per the  forum of PEMicro http://www.pemicro.com/forums/forum.cfm?forum_topic_id=6460 

These people are able to program the controller. We ahev PE Micro (Rev B / D) and CMSIS-DAP debugger.

Thanks 

Gaurav More

0 Kudos
25 Views
NXP TechSupport
NXP TechSupport

Hi Gaurav More

 I can't see your log.

 About the FRDM connect to another FRDM, I have test it in the previous time, it works.

  If you have the PR micro, you also can use the SWD pin to connect your own board, and debug it.

  But I suggest you use the JLINK do the mass erase at first.

  About the connection, you can check your P&E Mulitilink, just make sure these pins are connect correctly:

 VCC, GND, SWD_DIO, SWD_clk, reset_B.

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
25 Views
Contributor II

Hi Kerry,

 Any update reagarding the issue? Any inputs from your side for this issue. I am ordering  8.08.90 J-LINK EDU  for the testing and evaluation on my board but till then what is the other way around.

Thanks 

Gaurav More 

0 Kudos
25 Views
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

    I just test the .bin code which I give you before, I find that KDS generated .bin have problems, that's why you can't download it.

    So, I modify the SDK for K22FX chip with IAR IDE, I write the PTD18 toggle code again.

    Please help to test it, I attached the new firmware for you.

     Because I don't have your K22 board, so I just test the .bin in FRDM-K22, check whether I can download or not, this is my result:

pastedImage_1.png

pastedImage_2.png

Please use my new firmware, and use JLINK download it to your own board again.

Any updated information, please let me know.

If you don't have the external JLINK, you don't need to buy it, because your Multilink also have problem, I think it may also related to the hardware stable problem.

You can use the FRDM-K22 on board JLINK test it at first.

Best Regards,

kerry

0 Kudos