k22f - no longer connects to SWD

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

k22f - no longer connects to SWD

Jump to solution
2,063 Views
mjg8t
Contributor IV

Hi There,

I am having a very odd issue with a custom design using the k22f.  I have built a number of 4 prototypes with all having the same behavior.

I can initially connect to the K22F just fine load firmware, debug etc.  The board has an onboard FPGA and flash (flash pins are shared with the FPGA).  After using the FPGA to load the flash with the FPGA configuration memory the K22F can no longer be accessed through SWD, infact the MCU no longer runs at all and seems to be in reset.

On a problematic board I have since removed any possibly conflicting parts (fpga, flash, etc)  and I can still not connect to the MCU.

I have tested:

- removed potential conflicting parts from the board (fpga, flash)

- verified the power supply 3.3V

- checked voltage on all bypass caps

- verified SWD continuity from the JTAG connector to the MCU

- replaced power supply with external bench power to ensure proper power

- monitored the reset pin while the debugger is trying to connect.  Reset @3.3V unless pulled low by debugger

- monitored SWD clk, dio signals are good during connection attempt

- removed the MCU and put on an freedom board and able to connect via SWD (the mcu is fine)

- put brand new MCU on problem PCB and still does not connect

I have a working board where the FPGA flash has not been programmed which is running fine for comparison.  No differences found in critical voltage levels on pins.

All that I can figure is that I have the K22F wired incorrectly on the PCB.  Attached is a schematic for review. I am at a loss and have spent a lot of time trying to debug, but cannot find any direct answers.  Thank you for any feedback you might provide!

Edit:

Questions:

- What would failure to access the SWD interface of the MCU indicate about the state of the MCU?

     - The MCU is in reset?

- What pins/conditions(other than reset pin) could be responsible for holding the MCU in reset or keep from booting?

1 Solution
1,624 Views
mjg8t
Contributor IV

Update.  I have found that the Issue is with the NMI interrupt  on PTA4 - It appears that this interrupt is enabled even before the chip has been programmed and therefore SWD cannot be entered if PTA4 is low on startup (tested and found to be the issue).

I have using processor expert for the K22FDN512LH12 and there appears to be no options to disable the NMI under the CPU properties.  Am I missing something or should have disable this in my PE independent code?

View solution in original post

0 Kudos
Reply
6 Replies
1,625 Views
mjg8t
Contributor IV

Update.  I have found that the Issue is with the NMI interrupt  on PTA4 - It appears that this interrupt is enabled even before the chip has been programmed and therefore SWD cannot be entered if PTA4 is low on startup (tested and found to be the issue).

I have using processor expert for the K22FDN512LH12 and there appears to be no options to disable the NMI under the CPU properties.  Am I missing something or should have disable this in my PE independent code?

0 Kudos
Reply
1,624 Views
santiago_gonzal
NXP Employee
NXP Employee

Hello,

Apparently this option to disable NMI is not available if you select to create a project that uses SDK.

The NMI pin can be enabled/disabled only by Reset, after modifying the FOPT section of the Flash (More info in the image attached and in the RM)

2015-05-04 18_42_23-K22P121M120SF7RM.pdf - Adobe Reader.png

This section is defined in startup_MK22F51212.s as you can see in the image:

2015-05-04 18_42_04-C_C   - test_SDK_platform_devices_MK22F51212_startup_gcc_startup_MK22F51212.S - .png

But if you create a project that does not use the SDK, the NMI disable option is still there:

2015-05-04 18_43_52-C_C   - test_SDK_platform_devices_MK22F51212_startup_gcc_startup_MK22F51212.S - .png

Hope it helps!

Regards,

Santiago

1,624 Views
mjg8t
Contributor IV

Hi All,

I ran into this same issue 3 years later and had to try figure out the issue all over again - some people don't learn.  I ended up back at this post.  This time around I found the bit location of nmi_dis confusing to decipher relative to the way that the .flashconfig was written in the assembly file.  For my own future reference I'm putting the disable nmi code here - hope it helps someone else too.

/* Flash Configuration */
.section .FlashConfig, "a"
.long 0xFFFFFFFF
.long 0xFFFFFFFF
.long 0xFFFFFFFF
//.long 0xFFFFFFFE //!nmi enabled
.long 0xFFFFFBFE //!nmi disabled

0 Kudos
Reply
1,624 Views
mjg8t
Contributor IV

Here is a nice thread which give some different options to disable the the NMI in the FOPT registers, note that the same process applies for applying security settings.

https://community.freescale.com/message/498496#498496

0 Kudos
Reply
1,624 Views
vicentegomez
NXP TechSupport
NXP TechSupport

Hi MJ

Please let us know if you have more questions

have a good day.

Regards

Vicente

0 Kudos
Reply
1,624 Views
mjg8t
Contributor IV

Thanks Vicente.  I am hoping to be in the clear now - thanks!

0 Kudos
Reply