Author Topic: Support device with off chip ROM? (LPC1830 with SPIFI)  (Read 18440 times)

chuckp

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Support device with off chip ROM? (LPC1830 with SPIFI)
« on: September 09, 2012, 07:53:23 am »
We've used FlashMagic on the LPC17xx in the past.  These devices have on chip ROM.  We now have an LPC1830 system with off chip SPIFI ROM.  I see the the LPC1850 is in the supported list.  It has on chip ROM.  Is there any way to use FlashMagic with off chip ROM on a device like this?  I assume I will have to build code in to my image, and I don't expect it to work until the device is initially programmed with appropriate code.  But is it reasonable to make FlashMagic work in this sort of system?  If not, I'll be writing something from scratch.

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #1 on: September 10, 2012, 12:43:24 am »
The current version of Flash Magic comes with an example external flash bootloader for the Hitex LPC1850 board using the S25FL129P connected via SPIFI.

You will need to adapt the flash programming routines in the example to your specific hardware and it should then work. If you have Keil uVision then it already comes with a library of code for programming external flash which can be trivially reused. Details can be found in the external flash section of the Flash Magic manual.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

chuckp

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #2 on: September 10, 2012, 06:34:50 am »
Thank you, this sounds promising.
I use the IAR tools, so I will look into adapting things.  I know that NXP releases a SPIFI library with which  I have experimented.

chuckp

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #3 on: September 13, 2012, 04:23:49 pm »
Your example downloads over the serial port.  I see that you support Ethernet download on the LPC17xx.  I'd like to bring up something similar on my LPC18xx system.  I have Ethernet support in my program.  If I create this loader, how do I tell FlashMagic that the download should be by Ethernet, not by serial port?  Is there information somewhere about adding support for a device/method?  I don't see it in the user manual, and I did not find a file listing the characteristics of various devices...

Cusko

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #4 on: December 05, 2012, 04:06:53 am »
I have HITEX LPC1850 and I have successfuly uploaded hex file for SPIFI bootloader (from example). But from here on, I don't know what to do. If I want to start bootloader It says : Operation Failed (... no '.' echoed). How can I proceed from there to upload my hex file in to the SPIFI memory  ???
Thanks!

Bostjan

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #5 on: December 05, 2012, 07:20:49 am »
You don't manually send the bootloader hexfile - Flash Magic does that for you.

Choose the External Flash / "S25FL129P LPC1850 Hitex" device in Flash Magic.

Follow the instructions shown to connect SV5 and SV1 and set the BOOTn pins.

Then in the main window choose the hex file for your firmware and click on "Start".
Embedded Systems Academy, Inc.
support at esacademy dot com

Cusko

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #6 on: December 06, 2012, 03:37:22 am »
Great. Thank you. This works now. I totally missed this.
But another question. How can I add my own bootloader into this menu?

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #7 on: December 06, 2012, 05:36:03 am »
Take one of the examples, copy it and rename it.

Edit the Descriptor structure in FlashPrg.c. You must use a unique name.

Edit FlashPrg.c to support your desired memory devices.

Build and copy the hex file into C:\Program Files (x86)\Flash Magic\Bootloaders

Restart Flash Magic.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Cusko

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #8 on: December 07, 2012, 01:36:53 am »
OK, thx. I tried and it worked. I changed from USART3 to USART0. But I had to use ISP button to load the bootloader and then I had to click the start button again to load the rest of the program??? I will now try on my board with LPC1857.
Thanks again.
« Last Edit: December 07, 2012, 01:46:01 am by Cusko »

Cusko

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #9 on: January 17, 2013, 06:28:54 am »
I tried now with LPC1857 and UART0 but it doesn't work. It always writes: failed to autoband. Is problem maybe in bootloader? LPC1850 has v11.1 and LPC1857 has v12.1.
Maybe program loads to RAM but then resets? Can you help me?
If I use Ulink debugger to run bootloader ESAFLASHOS from RAM, I can then load program to spifi using FlashMagic. But this isn't final solution obviously. 

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #10 on: January 17, 2013, 08:24:42 am »
In your December 6th posting above you had it working. I presume that is the bootloader that we supply. Now you have modified it and it doesn't work, correct?

Can you program any hex file into the RAM of the device? Autobauding is only for the initial stage of loading the bootloader into RAM. After that autobauding is not required as the external flash bootloader uses a fixed 115200 baud.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Cusko

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #11 on: January 21, 2013, 01:19:01 am »
I changed your program before from UART3 to UART0 and it worked for LPC1850 on Hitex board but only if you click start twice. Look in my December 7th posting.
Now I tried with the LPC1857 and UART0. Naturally a program starts from an internal flash if you don't Reset with the ISP pin. If you Reset with the ISP pin a processor go to a bootlaoder mode (I checked with a terminal where I send '?' and I get 'Synchronized');
I can program this processor flash if I select 'LPC1857'.

Maybe I must change some ID numbers or something in your supplied bootloader?
Is it maybe possible to watch data between a processor and the Flash Magic?

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #12 on: January 21, 2013, 02:17:01 am »
Please generate and send a debug file. Instructions are here: http://www.flashmagictool.com/debugfile.html

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Cusko

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #13 on: January 21, 2013, 03:36:32 am »
I attached the debug file.
But I also looked with serial port monitor what is happening and I think I found the problem.
On my board I have DTR line for reset and RTS line for ISP. And with normal operation the Flash Magic controls this lines to Synchronize.
But when I select an external memory bootloader the 'Hardware Config' option is empty. So I manually Reset with ISP pin high.
Then I clicked Start and device restarted. And in the Serial Monitor I saw the problem. The Flash Magic sets RTS and DTR and then clear first RTS and then DTR. Which is the wrong sequence. So the question is how to set the right sequence?

Cusko

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
    • Email
Re: Support device with off chip ROM? (LPC1830 with SPIFI)
« Reply #14 on: January 21, 2013, 04:55:27 am »
...new tests:
I disable the RTS and DTR lines on my board and I manually RESET with ISP pin high. Then I start the procedure again. The Flash M. sent '?', processor reply 'Synchronized..' then FM raise error for autoband.
I attached the debug log.