SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By MrScrith
#152913
I have an LPC2103 on a custom board (similar in design to the Olimex lpc2103 board) that I'm trying to flash, unfortunately I can't seem to get it to work right. When I attempt to flash I get the following errors:
Code: Select all
Thu Dec 06, 2012 21:45:51: Download error at 0x00000000: downloading into non-writable memory. 
Thu Dec 06, 2012 21:45:51: Download error at 0x00000200: downloading into non-writable memory. 
Thu Dec 06, 2012 21:45:51: Verification error at 0x00000020: mem = 0x34, file = 0xD4 
If I turn off verification of the program after download it will show those two warnings then continue on as if I had programmed it, with the debugger even showing my code in the dissasembly, however stepping through I can tell it's not my code.

I am currently using an IAR I-Jet with IAR Embedded Workbench for ARM (v6.40) However I have tried programming this with a Segger J-Link, as well as OpenOCD+Eclipse+Olimex USB JTAG TINY. I have even tried using the example project that IAR has for the LPC2103 with no luck.

Does anyone have a clue what might be going on? Is there some sort of flash protection engaged?

I can connect to the processor using the IAR debugger and the I-Jet JTAG, I have confirmed this by manually setting the registers to turn on the test LED, so that part should be working...

Anyone have any ideas?
By stevech
#153029
I use IAR and J-Link with 2106's and Olimex boards. Same basic chip.
No flash protection unless you're using a chip that was programmed with proprietary firmware that someone wanted to protect. Even so, you are able to do a full flash erase; you just cannot read until fully erased if the protection is on.

Sounds to me like JTAG bits aren't wired correctly.
By MrScrith
#153050
Just to rule out my own mistakes, I decided to go for a complete start-to-finish commercial setup to make sure it isn't me.

Windows 7.
IAR Embedded Workbench v6.4 (will be trying v6.5 when I can)
IAR I-Jet JTAG probe
Olimex LPC2103 board (from Sparkfun)
Using the Demo project included in IAR Embedded Workbench specifically for the Olimex LPC2103 board, and I have the same exact issue. Verification of the binary fails. The only difference is that it is not giving me the same errors about "downloading into non-writable memory".

The only change I made in the example project before attempting to run it is to change the debug probe in the project settings from the J-Link to the I-Jet.

At this point I really don't know what's going on or where the fault is. I am going to try the latest version of IAR Embedded Workbench, then I'm going to contact IAR support and find out what they have to say.

At this point I am getting very tired of being so completely unable to get a working environment together.
By MrScrith
#153238
Well, I talked to IAR support and they managed to figure it out, in v6.4 (and v6.5, also tested that version), using the I-Jet JTAG probe, the verification of the flash doesn't work. Download does work however, as does debugging. So don't enable verification of your download (on by default in the example project) and it'll work quite nicely.

I am now running my code on the OLIMEX LPC2103 demo board, and the board I created for the LPC2103!

I am not overly impressed with the IAR Embedded Workbench IDE, but it's usable and once you get past a few quirks here and there it works well enough for me. Looking at the settings I can see options to possibly use Eclipse or something else as the editor and only use IAR EW for compiling/debugging, but I doubt I'm going to bother, it's good enough as it is.

For anyone else planning on working with the LPC2103, IAR EW isn't a bad option once you get past the quirks, as it's free with the only limitation being the code size (with fits perfectly with the LPC2103) and a few other options (MISRA C checking) it's a decent option for the hobbyist.
By stevech
#153287
odd... I used those IAR versions + J-Link with an LPC2106 and it's the same as a 2103 except for memory size and sector sizes. The 2106 has same-sized sectors of flash whereas some others have differing sizes according to location in address space. May be irrelevant.
By MrScrith
#153709
I think it's an issue with the I-jet debugger. I haven't heard anything back yet so I suspect they are still looking into it. They sounded a bit surprised, my suspicion is that it's a combination that they forgot to check when they released the I-Jet debugger.