SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By DeniTCH
#124735
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
By DeniTCH
#124774
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
By DeniTCH
#124780
I might do so, it would just be nice if some of you guys had experience something simialar and had a quick hint. :)

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.
User avatar
By leon_heller
#124783
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.
By DeniTCH
#124787
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.
By frame
#128796
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.
By frame
#128951
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...