This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Can't program OTP registers in Intel Strata Flash 28F128J3
- From: "Nikita Tabatsky" <iron dot coyote at gmail dot com>
- To: ecos-discuss <ecos-discuss at ecos dot sourceware dot org>
- Date: Wed, 14 Mar 2007 18:21:00 +0200
- Subject: [ECOS] Can't program OTP registers in Intel Strata Flash 28F128J3
- References: <c503b90a0703140918x5c4a6c95p710a1ce1670afdd7@mail.gmail.com>
Hi All,
I have a problem with writing to OTP registers from redboot.
Reading is ok.
Writing to all four words(user area OTP) always returns ok( stat = 0),
but nothing is written(all data is 0)
Instructions&data cache are switched off.
Here it is my code:
====================================================================
int
flash_otp_write(u16 _pos, u16 *_data) __attribute__ ((section
(".2ram.flash_otp_write")));
int
flash_otp_write(u16 _pos, u16 *_data)
{
flash_t stat = 0;
volatile flash_t *ROM, *addr;
u32 cnt;
// Get base address and map addresses to virtual addresses
ROM = FLASH_P2V(CYGNUM_FLASH_BASE);
addr = FLASH_P2V(CYGNUM_FLASH_BASE + 0x10A +
_pos*sizeof(u16));//set user area address
ROM[0] = FLASH_Clear_Status;
for (cnt = CNT; cnt > 0; cnt-=2) ;
ROM[0] = FLASH_Write_ID; //0xC0
addr[0] = *_data;
for (cnt = CNT; cnt > 0; cnt-=2) ;
ROM[0] = FLASH_Read_Status;
cnt = 5000000;
while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--cnt == 0)
break;
}
ROM[0] = FLASH_Reset;
stat &= ~FLASH_Status_Ready;
return (int)stat;
}
====================================================================
Thanks,
Nikita
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss