[ECOS] Can't program OTP registers in Intel Strata Flash 28F128J3

Nikita Tabatsky iron.coyote@gmail.com
Wed Mar 14 16:21:00 GMT 2007


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



More information about the Ecos-discuss mailing list