1
\$\begingroup\$

I'm having a real hardtime programming my LPC1343 with the method mentioned in this question (Can an LPC1343 accept its initial program over USB?).

I am using a Linux machine and arm-none-eabi-gcc. I sucessfully compiled my code to blink a led, and then I get my .elf file and use arm-none-eabi-objcopy to convert it to the final format. Then I get that file in a USB stick and into a windows machine, and there I copy it to my LPC1343 thru the USB interface.

My problem is that after I turn off the chip and go into run mode it automatically goes again back into USB bootloader mode, meaning it didn't recognise the file. I have tried the following formats:

  • elf32-littlearm
  • elf32-bigarm
  • elf32-little
  • elf32-big
  • plugin
  • srec
  • symbolsrec
  • verilog
  • tekhex
  • binary
  • ihex.

Has anyone successfuly preogramed this chip thru USB? If so, what file format was used?

\$\endgroup\$
  • \$\begingroup\$ Not intended as an "answer" to your question, but while the process you describe could make sense for final deployment, surely there is a more efficient scheme for development - such as doing it natively from linux, using SWD or a UART bootloader, or even running windows in a virtual machine with shared folders? \$\endgroup\$ – Chris Stratton Mar 26 '14 at 14:35
  • \$\begingroup\$ I was too annoyed by that USB dance (it worked, but was rather unreliable), so I added a serial interface to mine (olimex.com/Products/ARM/NXP/LPC-P1343). \$\endgroup\$ – starblue Mar 27 '14 at 21:10
  • \$\begingroup\$ Muito Obrigado @Ricardo . \$\endgroup\$ – Electropepper Mar 29 '14 at 10:42
  • \$\begingroup\$ @Electropepper - For the editing? Not a problem! I see that you got your answer. Cool! \$\endgroup\$ – Ricardo Mar 29 '14 at 12:13
  • \$\begingroup\$ @starblue we defenitly need to talk, but serial interface doesnt let program the ROM of chip anyway, or does it ? \$\endgroup\$ – Electropepper Mar 29 '14 at 12:39
5
\$\begingroup\$

The file is a straight binary file. So, the first four bytes are the initial stack pointer value, the next four bytes are the initial program counter, and the interrupt vectors follow. As an example, here are the first 32 bytes of a known-good file:

00 08 00 10 99 3c 00 00 21 40 00 00 25 40 00 00
29 40 00 00 2d 40 00 00 31 40 00 00 9a 7a fe ef

The word stored at address 0x1C (seventh word) is a checksum of the first six words. See section 21.7 in the LPC13xx User's Manual for details. For the LPC1343 the file is exactly the same size as the flash: 32768 bytes.

\$\endgroup\$
  • 1
    \$\begingroup\$ [Shameless plug] I have written a trivial C program for this: bitbucket.org/jpc/nxpsum . You may find it useful. \$\endgroup\$ – jpc Mar 27 '14 at 0:55
  • \$\begingroup\$ I bought this board from olimex, and i have only USB bootloader or SWD, but according to what i have read i cant program it with SWD. So what is after all, the format i need to convert the file to be able to dump it into the USB folder ? Is maybe not the format but rather my code that is not working ? P.s - I am using a virtual machine with share folders to move the file to windows system. \$\endgroup\$ – Electropepper Mar 27 '14 at 8:00
  • \$\begingroup\$ @Electropepper I don't understand your follow-up question about the format. The format is plain binary and jpc has offered a program to generate it. I don't believe that you can't use SWD, but it is true that you can't use JTAG with an LPC1343. What board are you using? \$\endgroup\$ – Joe Hass Mar 27 '14 at 10:39
  • \$\begingroup\$ Thank you very much jpc and Joe Hass this checksum was indeed all i was missing, i can now finally star working with this device, even thought i know understand so much what was @starblue was talking about the USB dance. \$\endgroup\$ – Electropepper Mar 31 '14 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.