- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can't find function to read from flash or from EEPROM? Whish function can I use to red the data from a particular addresss?
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no API. Datasheet says:
There is no need of APIs to read from the EEPROM. The entire content of the EEPROM is
mapped into memory space and can be read directly. EEPROM allows read access at the byte
level. The following defines are used for reading EEPROM:Sorry, cut and paste does not work correctly with this crippled forum software, look at Datasheet pg. 2.
Some hints: declare a structure for your EEProm data and a pointer to it. Assign CYDEV_EE_BASE to the pointer and access the structire indirectly.
Put two additional datafields for housekeeping into the struct: a "magic number" indicating that EEProm is programmed and contains valid data and a version byte which might come in handy after some time of product evolve.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does Cy_GET_REG8() work. Because the flash has row width of 256bytes. Can we not read just a byte from flash??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cy_GET_REG8() is used to access registers in SRAM.
Bob is correct, use a pointer, init it to CYDEV_EE_BASE,
and supply an offset to get to the particular byte/word/long
you are trying to access.
unsigned int * pTr = CYDEV_EE_BASE //Init point to start of EEPROM
unsigned int getmydata, offset;
........
getmydata = *( pTr + offset ); // Offset is added to pointer to get to specific data
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It has never (not yet) been standarized in C-language how to access a variable directly from which the physical address is known. There is a construct like _at_ in keil, nothing good to work with in GCC so the only thing left is a pointer which is assigned the address to.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know it's an old thread, but I used the search function and this is relevant to my interest.
I want to save the software version in the flash section of the memory (not the eeprom) and I was wondering how I should access it, and where exactly I should put the offset to. I have a bootloader in my project and I don't want my software version to be overwritten by the bootloader or vice-versa.
How should I do this? I started reading on the _at_ keyboard but I still get memory overlapping warnings (which doesn't seem like a good thing to me).
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Easiest would be to declare
static const uint16 VersionNumber = 0xCoffee;
This will be placed into flash and you may access it like any other variable.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This might be useful as well -
Regards, Dana.