cancel
Showing results for 
Search instead for 
Did you mean: 

Problem to write/read Flash

macke_a
Associate II
Posted on November 09, 2006 at 10:19

Problem to write/read Flash

5 REPLIES 5
macke_a
Associate II
Posted on October 31, 2006 at 08:11

Hi !

I want to write to the flash with the following source code.

But after this, my programm is crash and I dont know how is the mistake?!

u32 TargetAdd = 0x400C2500;

u32 DataWrite = 0x0000222F;

u32 Read_Data = 0x00000000;

FLASH_Init();

FLASH_WritePrConfig(FLASH_B1F0, DISABLE);

FLASH_SectorErase(FLASH_B1F0);

FLASH_WordWrite(TargetAdd , DataWrite );

Read_Data=FLASH_WordRead(TargetAdd);

printf(''%x\n'',Read_Data);

FLASH_WaitForLastTask();

//FLASH_WritePrConfig (FLASH_B1F0,ENABLE);

I have read the other threads, but they couldn´t help me further.

I use the Keil µVision3 Compiler

Thank you in advance for help !

yvonperr
Associate II
Posted on October 31, 2006 at 09:41

Hi

Use address 0x000C2500 not 0x400C2500. The library automaticaly adds the 0x400000000 to the Flash address.

Also address C2XXX is in Bank B1F1 not Bank B1F0.

Hopes this helps

[ This message was edited by: Yvon on 31-10-2006 14:14 ]

macke_a
Associate II
Posted on October 31, 2006 at 10:07

Thank you for answer!

I have tried the Flash Bank at B1F0 an the Target Address at 0x000C1000,

but nothing changes! Any other concept ?

macke_a
Associate II
Posted on November 02, 2006 at 07:25

Hey.. could nobody help me, about my problem ?

I find no information, so what take me further...

:-[

heribert
Associate II
Posted on November 09, 2006 at 10:19

Hello,

i write and read my flag from flash.

char *flag = ''0000'';

#define DownloadFlag 0x400C3FFC /* adress */

...

flag = (char*) DownloadFlag; /* read */

...

EIC_IRQConfig(DISABLE); /* Disable IRQ interrupts on EIC */

FLASH_SectorErase(0x00020000); //(FLASH_B1F1); Bank1 Sector 1

FLASH_WordWrite (DownloadFlag, *(unsigned int *) FlashBuffer); /*write*/

EIC_IRQConfig(ENABLE); /* Enable IRQ interrupts on EIC */

i hope it will help. Greetings Heribert

Also a Good example is the code from IAP download in the froum