Unable to debug S32k311 mcu using Segger j-link V9 debugger

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

Unable to debug S32k311 mcu using Segger j-link V9 debugger

Jump to solution
1,407 Views
ce_ritesh
Contributor II
I have been working with an eval board by Elekronika India for 18s BMS solution based on S32k311 MCU. The Segger j-link V9-G JTAG debugger is being used for flashing and debugging.
But when we debug the sample code, after flashing, the PC goes to random RAM locations and not to the main function. Enclosed image for your reference. There are no breakpoints except main. But PC does not halt at the main and goes to random RAM locations and halts there. I tried with another example code for S32k311 and it gave the same output. 
 
Kindly suggest a solution.
 
image001.png
0 Kudos
Reply
1 Solution
1,028 Views
ce_ritesh
Contributor II

Issue was with the Segger connector to JTAG adapter board. It wasn't able to reset the controller before debug session. It is resolved now.

View solution in original post

0 Kudos
Reply
3 Replies
1,029 Views
ce_ritesh
Contributor II

Issue was with the Segger connector to JTAG adapter board. It wasn't able to reset the controller before debug session. It is resolved now.

0 Kudos
Reply
1,391 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

But when we debug the sample code, after flashing, the PC goes to random RAM locations and not to the main function

Ok, seems to me weird. The core will execute the instruction loaded in it. Not some random ones.

There must be executed in your SW some branch (jump) to that RAM location. And the RAM location must be defined in your core registers, to perform branch.

If you do step by step debug, you will see exactly where the branch to RAM is happening, and also its preconditions.

 

But PC does not halt at the main and goes to random RAM locations and halts there. I tried with another example code for S32k311 and it gave the same output.

Yes, if the main is not reached, it wont halt at main breakpoint.

Since the another example gives you the same result, it could be some jumper settings on the board if you use our EVB.

We supply the EVBs with getting started guide, where all necessary HW settings are described.

But debugging of startup will simply tell you where the issue lie.

Best regards,

Peter

0 Kudos
Reply
1,400 Views
ce_ritesh
Contributor II

Please find gdb server log for your reference

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2105838%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EUnable%20to%20debug%20S32k311%20mcu%20using%20Segger%20j-link%20V9%20debugger%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2105838%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%3EI%20have%20been%20working%20with%20an%20eval%20board%20by%20Elekronika%20India%20for%2018s%20BMS%20solution%20based%20on%20S32k311%20MCU.%20The%20Segger%20j-link%20V9-G%20JTAG%20debugger%20is%20being%20used%20for%20flashing%20and%20debugging.%3C%2FDIV%3E%3CDIV%3EBut%20when%20we%20debug%20the%20sample%20code%2C%20after%20flashing%2C%20the%20PC%20goes%20to%20random%20RAM%20locations%20and%20not%20to%20the%20main%20function.%20Enclosed%20image%20for%20your%20reference.%20There%20are%20no%20breakpoints%20except%20main.%20But%20PC%20does%20not%20halt%20at%20the%20main%20and%20goes%20to%20random%20RAM%20locations%20and%20halts%20there.%20I%20tried%20with%20another%20example%20code%20for%20S32k311%20and%20it%20gave%20the%20same%20output.%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EKindly%20suggest%20a%20solution.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image001.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image001.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F340094i79305759E11053BE%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image001.png%22%20alt%3D%22image001.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2160945%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Unable%20to%20debug%20S32k311%20mcu%20using%20Segger%20j-link%20V9%20debugger%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2160945%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EIssue%20was%20with%20the%20Segger%20connector%20to%20JTAG%20adapter%20board.%20It%20wasn't%20able%20to%20reset%20the%20controller%20before%20debug%20session.%20It%20is%20resolved%20now.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2105897%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Unable%20to%20debug%20S32k311%20mcu%20using%20Segger%20j-link%20V9%20debugger%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2105897%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3EBut%20when%20we%20debug%20the%20sample%20code%2C%20after%20flashing%2C%20the%20PC%20goes%20to%20random%20RAM%20locations%20and%20not%20to%20the%20main%20function%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3EOk%2C%20seems%20to%20me%20weird.%20The%20core%20will%20execute%20the%20instruction%20loaded%20in%20it.%20Not%20some%20random%20ones.%3C%2FP%3E%0A%3CP%3EThere%20must%20be%20executed%20in%20your%20SW%20some%20branch%20(jump)%20to%20that%20RAM%20location.%20And%20the%20RAM%20location%20must%20be%20defined%20in%20your%20core%20registers%2C%20to%20perform%20branch.%3C%2FP%3E%0A%3CP%3EIf%20you%20do%20step%20by%20step%20debug%2C%20you%20will%20see%20exactly%20where%20the%20branch%20to%20RAM%20is%20happening%2C%20and%20also%20its%20preconditions.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3EBut%20PC%20does%20not%20halt%20at%20the%20main%20and%20goes%20to%20random%20RAM%20locations%20and%20halts%20there.%20I%20tried%20with%20another%20example%20code%20for%20S32k311%20and%20it%20gave%20the%20same%20output.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3EYes%2C%20if%20the%20main%20is%20not%20reached%2C%20it%20wont%20halt%20at%20main%20breakpoint.%3C%2FP%3E%0A%3CP%3ESince%20the%20another%20example%20gives%20you%20the%20same%20result%2C%20it%20could%20be%20some%20jumper%20settings%20on%20the%20board%20if%20you%20use%20our%20EVB.%3C%2FP%3E%0A%3CP%3EWe%20supply%20the%20EVBs%20with%20getting%20started%20guide%2C%20where%20all%20necessary%20HW%20settings%20are%20described.%3C%2FP%3E%0A%3CP%3EBut%20debugging%20of%20startup%20will%20simply%20tell%20you%20where%20the%20issue%20lie.%3C%2FP%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3EPeter%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2105868%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Unable%20to%20debug%20S32k311%20mcu%20using%20Segger%20j-link%20V9%20debugger%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2105868%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EPlease%20find%20gdb%20server%20log%20for%20your%20reference%3C%2FP%3E%3C%2FLINGO-BODY%3E