Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > Writing to ROM

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Writing to ROM
Moderator:
ANCY

Post Reply
Follow this topic



Writing to ROM

bkphat posted on 15 Jan 2013 10:07 PM PST
Senior Member
13 Forum Posts

 

Hi, I'm designing a data logger that samples at a given interval. This interval is user-set, so I want it to be recalled when the devices is reset or after power-down. I imagine I would do this by writing a byte to ROM, and then reading it upon bootup. How can I do this? 

Thank you,

b




Re: Writing to ROM

Bob Marlowe posted on 15 Jan 2013 10:53 PM PST
Top Contributor
1768 Forum Posts

Normally the ROM is not writable (ROM = Read Only Memory) but you'll find an EPROM usermodule which allows you to store data whivh will be kept between power-offs.

Have a look into its datasheet to find out how to use it.

 

Bob



Re: Writing to ROM

bkphat posted on 15 Jan 2013 11:49 PM PST
Senior Member
13 Forum Posts

 Got it. Thank you! Now I have a new problem though. EEPROM seems to write to memory fine. I have 2K of EEPROM on my chip, so I write some parameters to row 126, which is towards the end. Then I try to read from it and store it in an array.

uint8 romParamaters[SIZEOF_EEPROM_ROW];

reg8 * RegPointer = (reg8 *) (126*CYDEV_EEPROM_ROW_SIZE + CYDEV_EE_BASE);

uint16 i = 0;

    for(i=0u;i<CYDEV_EEPROM_ROW_SIZE;i++){

        romParamaters[i] = RegPointer[i];

}

 

If I put a breakpoint at the for loop, I see that the EEPROM wrote the right data to memory. The next line, where I do the assignment, crashes however. Not sure why. Any clues? Thanks again.

b

 

 



Re: Writing to ROM

Bob Marlowe posted on 15 Jan 2013 02:36 AM PST
Top Contributor
1768 Forum Posts

When you turn off optimization for your project and rebuild it, debugging will work, I cannot see any error in your code.

 

Bob



Re: Writing to ROM

danaaknight posted on 15 Jan 2013 03:27 AM PST
Top Contributor
1773 Forum Posts

I assume when you stated write to ROM you meant FLASH.

 

Seems like your project lends itself to EEPROM, but if you find yourself needing

more storage than the 2KB you can also write to FLASH. Number erase cycles drops

from 1,000,000 to 100,000 however.

 

Regardsm Dana.

 

 



Re: Writing to ROM

bkphat posted on 17 Jan 2013 04:11 PM PST
Senior Member
13 Forum Posts

 Hi Dana - Thank your for your help. This is still not workign for me. It's driving me absolutely crazy. I put a breakpoint before I do the assignment to my local array from EEPROM. I have a pointer to memory:

uint8 * RegPointer = (uint8 *) (STARTING_PARAMETER_ROW*CYDEV_EEPROM_ROW_SIZE + CYDEV_EE_BASE)

I break, and can see the contents of memory in the debugger. Everything looks right, until I try to read from these addresses. Then thigns crash completely and the debugger freezes. Where do I turn off optimization? Looks like GCC is aloready not using it in build settings. Any help would be appreciated. Basically, reading from ROM is crashing my stuff. 

 

thanks!



Re: Writing to ROM

bkphat posted on 17 Jan 2013 04:43 PM PST
Senior Member
13 Forum Posts

 Sorry, but I figured it out. I never wrote a fully initilized 16 bytes to EEPROM at once. Once I wrote a full array, it worked. Thanks!



Re: Writing to ROM

bkphat posted on 17 Jan 2013 05:30 PM PST
Senior Member
13 Forum Posts

 I take it back. It's doing it again. Jsut plain freezing. I'm back to taking advice. thanks






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20