- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I'm woring on a project which measure temperature and humidity. The measured data are stored in emulated EEPROM - FLASH (dataloging).
I use two buffers:
static const uint8_t Datalog_vlhkost[MAX_NUM_SAMPLE_DATALOG * 2]; // store MSB and LSB because data are 16bit
static const uint8_t Datalog_teplota[MAX_NUM_SAMPLE_DATALOG * 2]; // store MSB and LSB because data are 16bit
for example MAX_NUM_SAMPLE_DATALOG = 500u
when use : for write data to flash the very very area in RAM is occupied.
status = Em_EEPROM_Write(....);
Is it normal? why is the RAM memory alocated?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't assume from your question what size of RAM is occupied by your program. It is true the Emulated EEPROM requires some buffer on the RAM.
The Emulated EEPROM uses internal Flash ROM to be accessed as an EEPROM. You can write data at any location in any size on EEPROM, but not on Flash ROM. The Flash ROM must be accessed with a data unit. In PSoC 4, the data unit is called as ROW and the ROW size of CY8C4245AXI-483 is 128Bytes.
Because Flash ROM can be write with a ROW size, the Emulated EEPROM executes following procedure when Em_EEPROM_Write() is called to write a data.
- Save a 128Bytes ROW data containing the destination address to a 128Bytes write buffer.
- Put the one byte of data to the write buffer.
- Write the write buffer to the 128Bytes ROW.
In this sequence, a 128Bytes write buffer must be prepared. In the Emulated EEPROM component, the write buffer is assigned to the Stack area as a local variable. This is why the Emulated EEPROM occupies 128Bytes of stack area. In addition, the procedure does not depend on the data size to be written. Even if one byte is written, 128Bytes of buffer is required.
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't assume from your question what size of RAM is occupied by your program. It is true the Emulated EEPROM requires some buffer on the RAM.
The Emulated EEPROM uses internal Flash ROM to be accessed as an EEPROM. You can write data at any location in any size on EEPROM, but not on Flash ROM. The Flash ROM must be accessed with a data unit. In PSoC 4, the data unit is called as ROW and the ROW size of CY8C4245AXI-483 is 128Bytes.
Because Flash ROM can be write with a ROW size, the Emulated EEPROM executes following procedure when Em_EEPROM_Write() is called to write a data.
- Save a 128Bytes ROW data containing the destination address to a 128Bytes write buffer.
- Put the one byte of data to the write buffer.
- Write the write buffer to the 128Bytes ROW.
In this sequence, a 128Bytes write buffer must be prepared. In the Emulated EEPROM component, the write buffer is assigned to the Stack area as a local variable. This is why the Emulated EEPROM occupies 128Bytes of stack area. In addition, the procedure does not depend on the data size to be written. Even if one byte is written, 128Bytes of buffer is required.
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
static const uint8_t Datalog_vlhkost[MAX_NUM_SAMPLE_DATALOG * 2];
will NOT be allocated in flash, You will need to initialize your data with the definition as
static const uint8_t Datalog_vlhkost[MAX_NUM_SAMPLE_DATALOG * 2] = {0,0};
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Bob and Noriaki
thank you very much for your help.
Michal