cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 JTAG debugging with ULINK-ME acts weird

jani
Associate II
Posted on February 02, 2009 at 12:57

STM32 JTAG debugging with ULINK-ME acts weird

6 REPLIES 6
jani
Associate II
Posted on May 17, 2011 at 13:01

I have Keil compiler with MicroVision IDE, and ULINK-ME USB JTAG adapter for debugging STM32 (Cortex-M3 ARM core).

Everything worked fine until last time I tried JTAG debugging.

I can download software to internal flash without problems, but starting the debugging session gives an error:

Quote:

Cannot access Memory

*** error 57: illegal address (0x08000000)

After this I can only debug and run the software by looking at the disassembly window, it does not track C code.

The address itself is valid, it is the start address of internal flash.

I think I may have a configuration problem, but I've tried all the different options for resetting the micro and downloading software before debugging.

Has anyone else had this problem?

It seems that reset vector at 0x08000004 points to 0x08000165. The program counter at reset points to 0x08000164. The code at PC seems valid, but why the reset vector points to an odd location?

Note that it does not have any chance of running any software before the error appears.

jj
Associate II
Posted on May 17, 2011 at 13:01

Quote:

Everything worked fine until last time

I'm betting that your last code ''liberated'' 1 or more of the JTAG pins. Less likely - you or another altered the settings of boot 0/1 pins.

Assume you have some ''official'' eval board - kindly indicate board & STM32 device.

If you have ''locked out'' JTAG - there are methods for recovery. To prevent this from happening again - suggest that you/others write a simple ''JTAG-GPIO'' recovery routine - which executes very early in your code. Much easier to restore JTAG this way as opposed to: change boot settings, download/execute ''correct code'' into Ram - change boot settings and ''finally/maybe'' - be back into normal Flash debug/program mode.

jani
Associate II
Posted on May 17, 2011 at 13:01

No change of code regarding IO pin configuration or BOOT pin states.

And the CPU had no chance of running any code, the error was already on screen after Reset vector had been fetched to program counter.

This happened on every board I tried on - but the boards were custom with STM32F101RBT6. Although I do have MCBSTM32 board, I did not try JTAG on it.

But however the problem seems to be solved.

I first installed the newest version of Keil ARM suite. It did not solve the JTAG problem, it just created new problems, as the STM32 library version had updated, so my code had to be modified accordingly.

After retrying all JTAG debugger settings again, I unchecked three checkboxes:

-Cache data memory

-Cache code memory

-Download to flash

and the problem magically disappeared. I know the code still gets downloaded to flash, as the STM32 does not have enough SRAM to run the code.

jj
Associate II
Posted on May 17, 2011 at 13:01

???

You, I, all others have ''no clue'' just WHAT caused your issue.

Quote:

Everything worked fine until last time

Silent is ''what/why'' this happened. Not knowing the cause - the post has little value and you have not innoculated yourself against a recurrence...

jani
Associate II
Posted on May 17, 2011 at 13:01

Point was that I don't know what happened and I wanted to know if anyone knows any settings that could cause this. What happeneded and why was not important and now left as an academic exercise for those who like to analyze causality.

Now I know the project settings went wrong somewhere - maybe I changed them, maybe they go wrong when creating a new project.

infoinfo996
Associate II
Posted on May 17, 2011 at 13:01

Hi,

I had the same problem last week after having updated the Keil IDE version to the last v3.40.I don't know why , but I had the same error57 message when I entered debug mode , I can only debug in assembly window.The only way to remove this message was uncheck the checkbox ''Download to flash'' in the Debug window.Note that I don't change any project settings or my software before the problem appear.