414 Views 17 Replies Last post: Jul 27, 2010 8:43 AM by Bolz RSS
iValeria Newbie 20 posts since
Mar 2, 2010
Currently Being Moderated

Mar 8, 2010 3:16 AM

Data memory of R8C/27

Hi guys,

I need to save some data in flash memory to be available after each on-off, but I need to modify them when I receive specific commands (from CANbus).

I read the application note and hardware manual, so I think to work in CPU rewrite mode, in EW1 mode.

How can I do to save default data one time at the first ignition?

In this way, if these data are modify during program execution, I can use the new parameters instead the default ones.

 

Thank for the answers.

Valeria

Tags: memory, flash, dataflash, block, r8c27
ganeshbabu1985 Newbie 12 posts since
Aug 18, 2009
Currently Being Moderated
Mar 8, 2010 3:34 AM in response to: iValeria
Re: Data memory of R8C/27

Hey!

 

First  I dont thing R8C27 will have CAN Interface and as R8C27 will have 2KB of Data Flash why you need to go for Flash storage.

FrankL Apprentice 1,100 posts since
Mar 16, 2009
Currently Being Moderated
Mar 8, 2010 4:36 AM in response to: iValeria
Re: Data memory of R8C/27

Yes, EW1 mode is fine to store some initialisation data in flash. It does not really make a big difference if you use program flash or data flash. Data flash has only frm specification a higher number of program-erase cycles. And of course it is faster to erase small data flash blocks than larger program flash blocks.

And you could include a default data set as constants in your application. Then the default data is already programmed when you write your software to the device.

FrankL Apprentice 1,100 posts since
Mar 16, 2009
Currently Being Moderated
Mar 8, 2010 6:28 AM in response to: iValeria
Re: Data memory of R8C/27

You don't understand what I was talking about. Constants are not #defines. I proposed something like that:

const unsigned char INIT_VALUES[]={0x00, 0x01, 0x02, 0x03, 0x04};

 

If you compile for R8C this const table should be located in rom_NO section.

If this rom_NO section is in data flash, you can go and reprogram in your software the values for INIT_VALUES.

If you reprogram your software you will have the start values for INIT_VALUES in data flash.

FrankL Apprentice 1,100 posts since
Mar 16, 2009
Currently Being Moderated
Mar 8, 2010 7:36 AM in response to: iValeria
Re: Data memory of R8C/27

And I suppose you defined an array of initialised variables,  not a const array.

Initialised data is stored in sections data_XX

Constants are stored in sections rom_XX

ckgrier Apprentice 840 posts since
Mar 16, 2009
Currently Being Moderated
Mar 8, 2010 9:39 AM in response to: iValeria
Re: Data memory of R8C/27

The 27 should have two block of Flash that you can work with. As long as you are running out of Block 0 you can run from Block 1 (and vice versa).

 

Of course you could move your array to the section of Flash that's called DataFlash. It can store data and code just like normal flash.

 

Lots of good message threads cover memory mapping and sections:

http://www.renesasrulz.com/message/6553

http://www.renesasrulz.com/message/3124

http://www.renesasrulz.com/message/2085

http://www.renesasrulz.com/message/5312#5312

FrankL Apprentice 1,100 posts since
Mar 16, 2009
ckgrier Apprentice 840 posts since
Mar 16, 2009
Currently Being Moderated
Mar 9, 2010 6:56 AM in response to: iValeria
Re: Data memory of R8C/27

To help debug, can you dump the data out of a serial port and log it in a PC terminal program? If you have access to an RS232 port this would be easy, and would allow you to see the data that's being flashed to memory.

 

FAR pointers shouldn't be required on the 27. Everything in memory is NEAR for the 27.

Bolz Newbie 2 posts since
Jul 17, 2010
Currently Being Moderated
Jul 26, 2010 8:21 AM in response to: iValeria
Re: Data memory of R8C/27

Hi! I am a new entry in this forum. I hope I find a solution for my problem. I'm working with a R8C/27 and I think I have the same problem of iValeria. I've generated startup files in assembler mode and I'm trying to store during the execution of my code some data in Block A. I'm using the same code posted by iValeria but in read operation I obtain only 0xFF values and I'm not able to erase or write Block A (or Block B). Is it necessary to modify sect30.inc to use data flash? If yes, in what manner?

 

Thank you!!

 

Stefano

FrankL Apprentice 1,100 posts since
Mar 16, 2009
Currently Being Moderated
Jul 27, 2010 12:51 AM in response to: Bolz
Re: Data memory of R8C/27
Bolz Newbie 2 posts since
Jul 17, 2010
Currently Being Moderated
Jul 27, 2010 11:21 AM in response to: FrankL
Re: Data memory of R8C/27

Thank you very much for the code sample. It's been usefull to solve the problem: I could exclude that the problem was in sect30.inc. Finally I solve the problem by resetting OCD0 and OCD1 bits (they were wrongly setted because I'm using high speed on-chip oscillator).

More Like This

  • Retrieving data ...

Bookmarked By (0)