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 Flow Chart<br />

4.2.1 Main Function<br />

main()<br />

Set the main clock to XIN<br />

PRCR ← 0x02<br />

PM10 ← 1<br />

PRCR ← 0x00<br />

fmr4 ← 0x00<br />

Write address initial process<br />

write_address_init()<br />

Protect released<br />

The PM10 bit in the PM1 register is set to “1” and<br />

access in the data flash is enabled<br />

Protect set<br />

Reset the fmr40 bit to “0” (Erase suspend function<br />

disabled)<br />

Search the rewritable record from the data flash and set<br />

the write address (write_addr)<br />

Write data creation process<br />

Create the write data (write_data) in the data flash<br />

make_data(write_data)<br />

Data write control<br />

flash_write(write_data)<br />

Program error occurs?<br />

Execute the write control to the data flash<br />

The return value indicates whether the write process is<br />

completed (completed successfully / program error /<br />

erase error )<br />

Yes<br />

No<br />

Program error processed (1)<br />

Erase error occurs?<br />

Yes<br />

No<br />

Erase error processed (1)<br />

<strong>NOTE</strong>S:<br />

In this application note, error processes are not performed. Process errors if neede.<br />

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

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

Saved successfully!

Ooh no, something went wrong!