RX651 cannot self program the same 128 byte page twice without erasing

 Hello

I am using the Renesas 65n1 Flash FIT module to program the code flash on the R6519AxFP.

I can program a page of 128 bytes after an erasure.

I tryed with "HEJ", keeping all the other bytes as 0xFF. This works.

The i tried to program the same page of 128 bytes as

"HEJ MOR" but i get a FLASH_ERR_FAILURE error.

I can however write "Hello World! I like Cake!" to the page if i erase the entire block (32 KiB) first and then write to it.

I can also write to other 128 byte pages without erasing, but i cannot rewrite the same page.

Here is my test code:

    hal_flash_init();

    char test[256];
    memset(test,0xFF,256);

    test[0] = hal_flash_erase(0xFFFE8000, 1); //Erase
    hal_flash_read(test, 0xFFFE8080, 128);     //Check data = ok

    test[0] = 'H';
    test[1] = 'E';
    test[2] = 'J';
    test[0] = hal_flash_write(test, 0xFFFE8080, 128); //Works as intended
    hal_flash_read(test, 0xFFFE8000, 256);

    test[0] = 'H';
    test[1] = 'E';
    test[2] = 'J';
    test[3] = ' ';
    test[4] = 'M';
    test[5] = 'O';
    test[6] = 'R';
    test[0] = hal_flash_write(test, 0xFFFE8080, 128);  //Gives error FLASH_ERR_FAILURE
    hal_flash_read(test, 0xFFFE8000, 256);

    test[0] = 'H';
    test[1] = 'E';
    test[2] = 'J';
    test[0] = hal_flash_write(test, 0xFFFE8000, 128); //Works
    hal_flash_read(test, 0xFFFE8000, 256);

Any ideas?

  • That's specification. Memory cells must only be programmed once. Before reprogramming it must be erased. Reprogramming without erase would put increased stress on the memory cell and is prohibited.

  • In reply to FrankL:

    So it is impossible to change this?
  • In reply to FrankL:

    can you pinpoint this in the manual? just so i can get the clearest image possible

    Best Regards
  • In reply to Worker101:

    Worker101,

    Has your question been answered?

    Mike Clements
    RenesasRulz Moderator
  • In reply to Worker101:

    I'm also curious about where this is in the manual, if you're saying two consecutive writes to the same page of RX65* code flash without an intervening erase will return error. I seem to be running into the same issue. I've written to a page of code flash, keeping one sequence of bytes as 0xFF so I can set them later, but I get the PGMERR bit in flash every time I try to do a 2nd write.

    If this is true, it's contrary to the behavior of most flash memory I've worked with. Is the code flash setting a private bit in the block indicating it's been written to and, if set when another write occurs, fails the write?

    Thanks,
    Anthony

  • In reply to AnthonyJenkins:

    It is stated on page 2599 in the datasheet for the RX65*

    (3) Prohibition of Additional Programming
    Programming a given area of the code flash memory or data flash memory twice is not possible. To program the code flash memory or data flash memory where has been programed, erase the target area. Programming can be added to the option-setting memory. For details, refer to Flash Memory User’s Manual: Hardware Interface.

     

    Best regards

  • In reply to Worker101:

    Thanks Worker101! This morning I finally got my bits of user code moved into the RAM segment that r_flash_rx uses for destructive code flash operations and I can safely rewrite code flash.

    Anthony

  • In reply to Worker101:

    Worker101, and Anthony Jenkins,

    I am glad to hear that your question has been answered and your programming is successfull!

    Mike Clements
    RenesasRulz Moderator