This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Debug mode, program halts by itself right after being started

Hello, first please kindly understand that I know perfectly well that Engineering problems are usually very comprehensive issues which may not be the caused by one single IDE, hardware or software alone but I really don't have a better idea of where to turn to for solutions or suggestions. And at least on face value, this whole situation that I'm facing right now looks like I can get some very constructive pieces of advice from this forum than any other.

So, here goes the description of this problem:

I'm working on a project using my custom built development board. The MCU I'm using is a Cortex-M3 one, STM32F105RB series to be more precise. I download program using JTAG method via a Jlink.

Everything seems to be fine except that after I hit the magnifying glass icon and entered debug mode (the program would usually be burned into the MCU smoothly and rapidly, by that I mean well within 15 seconds, at 1000KHz JTAG clock rate, which suggests there isn't major connection problem), and I hit the F5 key, expecting the program to run until it encounters a break-point, it doesn't. It stops all by itself without any notable warning or error message.

If I load up the Jlink graphical interface, the status bar at the bottom would usually reads:

JLINK_Go
JLINK_IsHalted (running)
JLINK_ReadingMemory
JLINK_ReadReg (Done)

Of course I can see all that by lowering the JTAG clock to 5kHz.Or else everything would just go super fast.

So I'm here looking for clues, but besides that, here is some more input, a possible cause if you will.

The program I wrote kinda interfered with the JTAG connection by possibly initializing the alternative function clock of those JTAG pins (so the interference happens after the MCU was booted up, not when downloading of course). I verified that by downloading it to another development board manufactured by certain company . It turned out that it has exactly the same issue after I downloaded the program, entered debug mode and hitted F5. If I download another program that I wrote earlier of which I am sure has no interference whatsoever with the JTAG connection, everything went just fine in debugging mode.

But here is the most frustrating part: I tried to download the aforementioned "non-interfering" program into my custom built board, hoping this "self-stopping" problem could be eliminated which would rule out a hardware fault, and it turned out the problem remains! In other words, my earlier, "non-interfering" program also stops all by itself right after F5 being pressed in debugging mode.

Somehow, it seems, the problem is both hardware and software and they are "collaborating" with each other, almost pure coincidentally (I certainly have no intention of causing the problem myself). To concisely put it:

Not my board + my problematic software = problem.
My board + my non-problematic software = problem.
Not my board + my non-problematic software = everything is fine.

I've checkboxed and optioned the whole chip to be wiped clean every time before a new program to be downloaded instead of just erasing sectors, and the purpose of that is to rule out "residue" code from last time, which of course would be a logical thing to do.

So, can please some one be kind enough to give me some advices or clues? I'm completely at my wits' end, I don't know where to begin.

Thank you for your time and attention.