Skip to main content
Visitor II
January 5, 2008
Question

F276 Error on write IFlash

  • January 5, 2008
  • 1 reply
  • 589 views
Posted on January 05, 2008 at 13:46

F276 Error on write IFlash

    This topic has been closed for replies.

    1 reply

    post2sdfAuthor
    Visitor II
    January 5, 2008
    Posted on January 05, 2008 at 13:46

    I have a following problem. There is a program which located in to 0xE000 address. The given program accepts the new program on ASC0 and writes down it to 0x0F0000 address. Then he should write down it in IFLASH to 0x0000 address.

    The code for erasing IFLASH looks as follows:

    ...

    FCR0H = 0x0080; //Set the Select Module bit to work on the IFlash

    FCR0H = FCR0H | 0x0800; //Set the Sector Erase Bit

    FCR1L = 0x0001; //Set the specified Bank Status Bit

    FCR1H = 0x0000;

    FCR0H = FCR0H | 0x8000; //Set the Write Mode Start Bit

    //some delay

    if (! (FCR0L & 0x0010))

    {

    if (! (FCR0L & 0x0020))

    {

    err = get_flash_error ();

    if (err)

    {

    putchar (0xE1);

    putword (err);

    return FALSE;

    }

    else

    return TRUE;

    }

    }

    ...

    After erase I check IFLASH on a template 0xFF. All passes successfully. Then I start to write down in IFLASH And here I have an error 10ER in to 0x0002 address.

    The writing code in to IFLASH looks as follows:

    ...

    dest = dest | 0x010000;

    while (size)

    {

    FCR0H = 0x0080;//Set the Select Module bit to work on the IFlash

    FCR0H = FCR0H | 0x2000;//Set the Word Programming Bit

    FAR = dest;//Load the Address

    FDR0 = * ((WORD xhuge *) src);//Load the Data

    FCR0H = FCR0H | 0x8000;//Set the Write Mode Start Bit

    delay500us ();

    while (FCR0L & 0x0010);

    while (FCR0L & 0x0020);

    err = get_flash_error ();

    if (err || flash_is_busy ())

    {

    putchar (0xE3);

    putword ((WORD) src);

    putword (err);

    return FALSE;

    }

    src + = sizeof (WORD);

    dest + = sizeof (WORD);

    size - = sizeof (WORD);

    }

    ...

    Where I can have an error?