Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Odd behaviour when writing to external flash

2006-04-27 by davidbinar

I'm trying to implement CoDeSys SP (http://www.3s-software.com/) on a 
Olimex 2294 Development board but have run into some problems. I've 
got the program up and running and everything works fine as long as I 
don't try to write to external flash.

I have a smaller project with just my own drivers for UART, SPI, LCD 
etc and with this program i can write to flash without problems but 
when I move the same functions into my bigger project with CoDeSys it 
stops working. I use the same init-functions to set up the LPC2294 
the same way and I can see that the BCFG-registers are set up the 
same as for the smaller project. I use the same crt.s-file and both 
my main functions starts:

void main(void)
{
	lpc229x_system_init();
	FlashFileTestSetup();  // This is where I try to write to 
flash
        ...

I use the exact same flash.c-file in both projects but when i try to 
write to flash in the bigger projects I get 0x92 which translates to 
Write State Machine Ready, Error in programming, Prog attempted on a 
locked block. Then the write function try to unlock it without 
success. After trying the program again and again unplugging the 
power to the board etc, etc I use my old program again and it writes 
the data without any problems. There's a couple of things I think 
might perhaps have something to do with it. First: the bigger program 
uses external RAM so some variables are at different addresses but I 
have stepped through the flash write function and every variable 
looks ok. I use newlib in the bigger project.

Any hints on what the problem might be?
Any tips on how to track it down?

/David

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.