04.01.2014 Views

R8C/13 Group APPLICATION NOTE Flash Rewrite Using EW1 Mode

R8C/13 Group APPLICATION NOTE Flash Rewrite Using EW1 Mode

R8C/13 Group APPLICATION NOTE Flash Rewrite Using EW1 Mode

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>R8C</strong>/<strong>13</strong> <strong>Group</strong><br />

<strong>Flash</strong> <strong>Rewrite</strong> <strong>Using</strong> <strong>EW1</strong> <strong>Mode</strong> (Data "FFh" Search)<br />

4.2.3 Data Write Control Function<br />

flash_write(unsigned char *data)<br />

result(write / erase) is<br />

initialized completely<br />

[Argument]<br />

*data : The starting address of the data which is written<br />

in the record.<br />

Data program process<br />

data_write (data)<br />

Program result<br />

Program error<br />

Set occurrence information of the program<br />

error to the return value<br />

Program<br />

succeeded<br />

result = result | PROGRAM_ERR<br />

Update write address<br />

Set the write address to the starting address in the next<br />

record<br />

The write address is<br />

at the starting address of<br />

the block B ?<br />

Yes (no empty records in the block A)<br />

No<br />

The write address is<br />

at the starting address of<br />

the block A?<br />

Yes (no empty records in the block B)<br />

Block erase process<br />

No<br />

Block erase process<br />

block_erase(BLOCK_A)<br />

block_erase(BLOCK_B)<br />

Erase result<br />

Erase error<br />

Erase<br />

succeeded<br />

Erase result<br />

Erase error<br />

result = result | ERASE_ERR<br />

Erase succeeded<br />

result = result | ERASE_ERR<br />

Block select = Block A<br />

Set the write address to the<br />

starting of the block A<br />

Block select = Block B<br />

Set the write address to the<br />

starting of the block B<br />

return result<br />

REJ05B0444-0110Z/Rev.1.10 August 2004 Page 16 of 25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!