LPC2136 refuses to start up without debug from PC

Hi, I have a custom board where I am using a LPC2136.

I am using a JTAG J-link to program the board and it works great, however as soon as I try to run the programmed code by applying power to the board without the debugger attached nothing happens. If I disconnect the debugger while the board is running it continues to operate correctly. I am using the following configuration:

RTCK is pulled down in order to enable the JTAG

P0.14 is pulled up in order to disable the bootloader

P0.31 is pulled up to prevent the mcu in disabling the JTAG port upon reset

The RESET pin is connected to JTAG (with pullup) and to a voltage monitor through an AND gate.

The clock is provided by an external 20MHz crystal.

I would greatly appreciate any ideas or suggestions!

Best regards

DeniTCH

You probably need to compile the code for execution without the debugger. With the CrossWorks tools I have to define STARTUP_FROM_RESET.

Thanks for the quick reply, I have thought about this option. I am using IAR Workbench, and I do not seem to be able to find such an option…

I found the Debug/Release switcher in IAR Workbench, but it doesn’t seem to make any difference. There is a project option under “Options->Linker->Config” to choose a linker configuration file where I can either choose “Flash.icf” or “Ram.icf” which has something to do with code placement inside the device, as there is a matching option in “Options->Debugger->Setup” where I can choose between “Flash.mac” and “Ram.mac” files. The IAR Workbench Still doesn’t have a “Download” button, only “Download and Debug” and “Debug without downloading”. I have tried to generate a .hex file, unsolder the pullup from P0.14 and download it onto the chip manually (flash magic) through a serial connection with the same results.

Does anyone with a bigger insight into IAR Workbench know how to configure it correctly?

Best regards

DeniTCH

Why don’t you ask IAR?

I might do so, it would just be nice if some of you guys had experience something simialar and had a quick hint. :slight_smile:

I thought I had some kind of a hardware bug, but I think I have tracked it down to the workbench settings. I found out that the debugger places the code in the RAM instead of Flash, which means that the code can be ran if I restart the controller manually without deasserting the power. As soon as the power goes the code dissapears. I tried to change the code placement location by using Flash.mac, but somehow it fails. Seems to me that IAR supplied a currupt Flash.mac file.

You need to run from flash, of course.

I found that there might be a linker configuration file called LPC2136_Flash_Standalone.icf, or something like it. I think that is what you need.

As far as I can se there is no .icf file for the LPC2136. The .icf file used in the provided example project is for some other controller from the same family. I have tried to modify the memory ranges in the file to match the device memory map, however without any luck.

I have now written to IAR’s support and asked them for assistance on the matter.

I don’t know IAR internals specifically, but with other toolchains, you have an option

to link with semi-hosted libs. They provide things like printf/scanf as stubs, which

route the output through the debugger to the host (the PC).

Make sure you don’t link with such a lib - the code does not work without debugger.

There is another possible point-of-fail.

In difference to some other ARM controllers, the NXP boot loader computes a checksum on the

interrupt vectors, and only passes control to the flash reset vector if this checksum is deemed

correct. Otherwise the boot loader remains active.

See “A Digression on ARM Reset” on http://www.noicedebugger.com/tour_arm/firstoocd.html

I’m actually a freshman in regard to ARM/Cortex.

I think this only applies if the controller entered the boodloader, which, I assume, he only does,

if he finds the boot-pin pulled low when starting from reset. I would check all those jumpers

on the board and consult the controllers reference manual…