Flash Magic Forum

In-System Programming Support => ARM Cortex => Topic started by: chuckp on September 09, 2012, 07:53:23 AM

Title: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: chuckp 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.
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Andy Ayre 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
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: chuckp 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.
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: chuckp 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...
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Cusko 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
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Andy Ayre 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".
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Cusko 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?
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Andy Ayre 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
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Cusko 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.
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Cusko 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. 
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Andy Ayre 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
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Cusko 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?
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Andy Ayre 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
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Cusko 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?
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Cusko 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. 
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Andy Ayre on January 22, 2013, 01:46:54 AM
As I mentioned in my December 5th post above, you need to set the BOOTn pins to start the BootROM feature. This is completely different to the ISP UART-based bootloader.

I can't recall if the LPC1857 has that feature, however we are working right now on an improvement to the external flash bootloader system to support the ISP UART-based bootloaders. It should be completed sometime this week or next week.

Andy
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Cusko on January 22, 2013, 03:28:21 AM
Ok, now I get it. These are two different protocols. Thx for help.

If you need any testing or anything else with the new functionality just let me know. I will be glad to help.

And if I may suggest something: The load to the flash Bank0 and Bank1 should be at the same time. You just choose which one you activate.

Bostjan
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Cusko on March 05, 2013, 04:59:13 AM
Quote from: Andy Ayre on January 22, 2013, 01:46:54 AM
As I mentioned in my December 5th post above, you need to set the BOOTn pins to start the BootROM feature. This is completely different to the ISP UART-based bootloader.

I can't recall if the LPC1857 has that feature, however we are working right now on an improvement to the external flash bootloader system to support the ISP UART-based bootloaders. It should be completed sometime this week or next week.

Andy

Any news on that?
Title: Re: Support device with off chip ROM? (LPC1830 with SPIFI)
Post by: Andy Ayre on March 05, 2013, 05:05:57 AM
It was added to version 7.21.

Any