Discussion Forum

LM3S2B93 Flash Download Problem

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Sudarshan Rao
Posted
12-Mar-2010 07:13 GMT
Toolset
ARM
New! LM3S2B93 Flash Download Problem

I am trying to program the Luminary Micro LM3S2B93 in a newly designed board. I am using Keil IDE & Keil ULINK2 JTAG for flash downloading. The erase command works fine ("Full Chip Erase Done" message is displayed). But when I try to program the Flash, it fails with the following message popping up - "ULINK - Cortex-M Error: Flash Timeout. Reset the Target and try again"... I tried to play around with the setting in the utilities section, but the problem remains...
Rgds,
Sudarshan

Read-Only
Author
Thorsten de Buhr
Posted
12-Mar-2010 08:22 GMT
Toolset
ARM
New! RE: LM3S2B93 Flash Download Problem

LMI Devices like to lock themselves up (and you out :-) ) during flash programming.

Did you try the Luminary Flash Tool from http://www.luminary.com ?

That tool is very helpful in resurrecting locked devices.

.
BR,
/th.

Read-Only
Author
Thorsten de Buhr
Posted
12-Mar-2010 08:24 GMT
Toolset
ARM
New! RE: LM3S2B93 Flash Download Problem

With ULINK you may also try different RESET-Methods in the ULINK Debug Adapter Settings Tab (Target Config).

I forgot:
The LMI Flash Tool runs (only?) with the onBoard (LMI Dev Boards) FTDI USB->JTAG/SW chip.

.
BR,
/th.

Read-Only
Author
Sudarshan Rao
Posted
12-Mar-2010 09:57 GMT
Toolset
ARM
New! RE: LM3S2B93 Flash Download Problem

HI Thorsten,
Thanks for the reply...
I dont have UART or SSI on board, so I guess I cannot use the Flash Tool...I have also tried the different Reset in ULINK methods as u pointed out.. it doesn't work...
I have another board using Luminary LM3S2965. I can program that using ULINK without any issues...
So I am wondering if this is some issue regarding this particular part (LM3S2B93). It is one of the newest members of Luminary.. also its the only member in its series..
While trying out other things, I noticed that I could burn small programs (around 500-800 bytes) successfully and even debug them... but when I go for bigger programs then I get the earlier message (Flash Timeout)...

Read-Only
Author
Sudarshan Rao
Posted
15-Mar-2010 05:11 GMT
Toolset
ARM
New! RE: LM3S2B93 Flash Download Problem

I think I found the solution for the above problem... The solution is to keep repeating the Flash Download process till it gets done..
I observed that small programs of upto 600-700 bytes gets flashed at one go.. but above that it needs multiple downloads as per the size... for my program of 4K bytes, it needed around 5 downloads...
Would like to know if anyone else has worked on LM3S2B93 / ULINK and faced a similiar problem...

Read-Only
Author
Drew Barbier
Posted
15-Mar-2010 15:17 GMT
Toolset
ARM
New! RE: LM3S2B93 Flash Download Problem

This is a real issue, please contact TI/Luminary for support.

Read-Only
Author
Dan Nakoneczny
Posted
18-Mar-2010 15:22 GMT
Toolset
ARM
New! RE: LM3S2B93 Flash Download Problem

This is a Keil issue, not a device problem.

The ULINK flash programming algorithm for the newer Stellaris devices was never properly updated by Keil. It does not take advantage of the write buffer, which speeds up the flash programming. The legacy method of programming the flash (one word at a time) like the earlier class devices is much slower than on the previous devices since it is a new flash, in a new technology (ie.. why the write buffer was added). This is why you are getting the flash timeout error. There is also a bit that needs to be cleared in order to properly program devices that are completely erased, otherwise it will fail to verify properly. This has been reported to Keil.

There is a simple way for the user to fix the flash algorithm such that it works in the legacy mode. Keil will have to provide the proper flash algorithms that take full advantage of the write buffer, but for now this should get you going.

1) Open up the flash programming algorithm project file for the Stellaris devices with 256 KB of Flash in the path: C:\Keil\ARM\Flash\LM3S_256\LM3S_256.Uv2

2) In FlashPrg.c, modify Init () to look like the following (bold type has been added):

/*
* Initialize Flash Programming Functions
* Parameter: adr: Device Base Address
* clk: Clock Frequency (Hz)
* fnc: Function Code (1 - Erase, 2 - Program, 3 - Verify)
* Return Value: 0 - OK, 1 - Failed
*/

int Init (unsigned long adr, unsigned long clk, unsigned long fnc) {

// Set the Number of Clocks per microsecond for the Flash Controller
// Approximate division by 1000000 (no Library Code)
HWREG(FLASH_USECRL) = ((1074*(clk >> 10)) >> 20) - 1; // clk / 1000000 - 1;

// Clear the BA bit in RMCTL by writing a 1 to this location.
HWREG(0x400FE0F0) = 0x00000001;

return (0);
}

3) In FlashDev.c, change the Program Page Timeout from 200ms to 500ms. So it should look something like (bold type modified):

struct FlashDevice const FlashDevice = {
FLASH_DRV_VERS, // Driver Version, do not modify!
"LM3Sxxx 256kB Flash", // Device Name
ONCHIP, // Device Type
0x00000000, // Device Start Address
0x00040000, // Device Size in Bytes (256kB)
1024, // Programming Page Size
0, // Reserved, must be 0
0xFF, // Initial Content of Erased Memory
500, // Program Page Timeout 500 mSec
500, // Erase Sector Timeout 500 mSec
// Specify Size and Address of Sectors
0x0400, 0x000000, // Sector Size 1kB (256 Sectors)
SECTOR_END
};

4) Recompile/link the project. This will automatically copy the output LM3S_256.FLM to the correct location.

5) Repeat this for the other flash programming algorithms for Stellaris ( C:\Keil\ARM\Flash\LM3S_nnn\LM3S_nnn.Uv2)

For all of our customers that have had the Flash Timeout error using the Keil ULINK2 and a Tempest class device (LM3S9B92, LM3S9B95, LM3S9B96, etc) this has resolved the issue.

Regards,
Dan Nakoneczny
Texas Instruments Inc.

Read-Only
Author
Allen Moore
Posted
27-May-2010 17:46 GMT
Toolset
ARM
New! RE: LM3S2B93 Flash Download Problem

Thanks Dan. This was a huge help. However I find that programming still fails occasionally. But if I first do a full erase of the flash, then the programming has always succeeded. I'm working with a LM3S9B92.

Read-Only
Author
Steffen Rose
Posted
24-Jun-2010 14:35 GMT
Toolset
ARM
New! RE: LM3S2B93 Flash Download Problem

After changing the Flash Algorithm I get 'Cannot load Flash Programming Algorithm' (Keil v4.11).

http://www.keil.com/forum/docs/thread17109.asp

Read-Only
Author
Steffen Rose
Posted
8-Jul-2010 07:59 GMT
Toolset
ARM
New! RE: LM3S2B93 Flash Download Problem

Keil v4.12 updates the Flash algorithm.

The Flash algorithm cannot compile with the Eval version of the compiler.

Next Thread | Thread List | Previous Thread Start a Thread | Settings