Not applicable
May 29, 2014
06:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 29, 2014
06:16 AM
Searching through this forum and the datasheet for the XMC4500, I am confused as to what my memory options are for the XMC4500. If I need to edit variables on the XMC4500 (in this case a matrix of values) and have those changes remain after the next power cycle, do I need to add an SD card or is there internal memory I can read and write to?
Thanks in advance,
Adam
Thanks in advance,
Adam
8 Replies
Not applicable
May 29, 2014
06:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 29, 2014
06:41 PM
Hi Adam,
There is internal Flash memory in XMC4500 microcontroller.
Depending on the device variant, the flash memory size is up to 1MB.
You could write your data into the flash area that are not used by your application code.
Of course, you would need to use flash command sequence for any flash operation including writing data to the flash.
For more information, please refers to the Reference Manual, Program Flash (PFLASH) chapter.
You could also use our tool chain, DAVE3 where flash driver is provided for any flash operation.
There is internal Flash memory in XMC4500 microcontroller.
Depending on the device variant, the flash memory size is up to 1MB.
You could write your data into the flash area that are not used by your application code.
Of course, you would need to use flash command sequence for any flash operation including writing data to the flash.
For more information, please refers to the Reference Manual, Program Flash (PFLASH) chapter.
You could also use our tool chain, DAVE3 where flash driver is provided for any flash operation.
Not applicable
May 29, 2014
07:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 29, 2014
07:30 PM
Jackson,
Is there a Dave app that will help me to read and write to the flash?
Thanks for the response.
-Adam
Is there a Dave app that will help me to read and write to the flash?
Thanks for the response.
-Adam
Not applicable
Jun 02, 2014
06:43 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 02, 2014
06:43 PM
Hi Adam,
The DAVE App that provide Flash driver is Flash002.
Please check out the App document on how to use the Flash002 APIs.
To access to the App document, go to Help > Help Content > DAVE Apps > FLASH002
The DAVE App that provide Flash driver is Flash002.
Please check out the App document on how to use the Flash002 APIs.
To access to the App document, go to Help > Help Content > DAVE Apps > FLASH002
Not applicable
Jun 03, 2014
08:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 03, 2014
08:00 AM
Jackson,
After reading through the reference manual and app documentation i am confused as to how I am supposed to "read" from the memory. I am looking to be able to overwrite variables (in my case arrays of 8-bit numbers) and have these numbers remain after power cycles. Any ideas how I can achieve this?
Thanks,
Adam
After reading through the reference manual and app documentation i am confused as to how I am supposed to "read" from the memory. I am looking to be able to overwrite variables (in my case arrays of 8-bit numbers) and have these numbers remain after power cycles. Any ideas how I can achieve this?
Thanks,
Adam
Attachments are accessible only for community members.
Not applicable
Jun 04, 2014
02:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 04, 2014
02:04 PM
I have tried learning the Flash002 commands to little avail. I am attaching a project I have been working on to try and learn to use the Flash memory.
It is supposed to update a matrix via CAN (which it does) and then write that data to the flash memory upon button push, however I have no idea how to read back what I stored after a power cycle.
Any help is greatly appreciated.
Regards,
Adam
It is supposed to update a matrix via CAN (which it does) and then write that data to the flash memory upon button push, however I have no idea how to read back what I stored after a power cycle.
Any help is greatly appreciated.
Regards,
Adam
/*
* Main.c
*
* Created on: Jun 2, 2014
* Author: aambriz
*/
uint32_t StartAddr = FLASH002_SECTOR10_BASE; //Page-0 of sector 11
uint32_t StartAddr2 = FLASH002_SECTOR11_BASE; //Page-0 of sector 11
status_t status;
uint32_t i;
int readbutton1;
int readbutton2;
int readbutton3;
CAN001_MessageHandleType CanRecMsgObj;
uint8_t compression_Value[11]; //compression duty cycle settings
uint8_t rebound_Value[11]; //rebound duty cycle settings
uint8_t shock_Settings[8]; //current shock settings
uint8_t current_DutyCycles[8]; //current shock duty cycles
uint8_t shock_DutyCycles[8]; //current shock duty cycles
uint8_t keypad_Presets[4][8];
uint32_t Buffer1[4];
//uint32_t Buffer2[4];
#include
int main(void)
{
DAVE_Init(); // FLASH002_Init() will be called within DAVE_Init()
IO004_SetOutputValue(IO004_Handle2,0);
while(1)
{
readbutton1 = IO004_ReadPin(IO004_Handle0);
readbutton1 = IO004_ReadPin(IO004_Handle0);
if(CAN_SET == CAN001_GetMOFlagStatus(&CAN001_Handle0,1,RECEIVE_PENDING))
{
CAN001_ClearMOFlagStatus(&CAN001_Handle0,1,RECEIVE_PENDING);
CAN001_ReadMsgObj(&CAN001_Handle0,&CanRecMsgObj,1);
switch(CanRecMsgObj.data[0])
{
case 0x01:
compression_Value[CanRecMsgObj.data[1]] = CanRecMsgObj.data[2];
for( int a = 0; a < 11; a++)
{
UART001_WriteData(UART001_Handle0, compression_Value);
}
UART001_ClearFlag(&UART001_Handle0,UART001_FIFO_STD_RECV_BUF_FLAG);
readbutton3 = 0;
...
Not applicable
Jun 04, 2014
08:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 04, 2014
08:08 PM
Hi Adam,
To read from Flash, you can use a pointer to read out the data from the flash address directly.
You don't need to use command sequence when reading from flash.
An example of reading 8-bit data from FLASH002_SECTOR10_BASE:
To read from Flash, you can use a pointer to read out the data from the flash address directly.
You don't need to use command sequence when reading from flash.
An example of reading 8-bit data from FLASH002_SECTOR10_BASE:
uint32_t StartAddr = FLASH002_SECTOR10_BASE;
unsigned char *ptrByte;
uint8_t ReadByte[50];
uint8_t j=0;
ptrByte = StartAddr;
for(j=0; j<50; j++)
{
ReadByte= *ptrByte;
ptrByte++;
}
Not applicable
Jun 05, 2014
08:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 05, 2014
08:39 AM
Thanks Jackson,
That is exactly what I was looking for.
Last question: if I am understanding how this works correctly, I have to erase the entire sector and write a page every time I want to save, so I am unable to erase and overwrite one array value at a time, correct?
In other words if one of my arrays is {0,0,0,0,1,1,1,1} and I want to make it {1,0,0,0,1,1,1,1} I need to erase and rewrite the whole sector?
Thanks again for all your support. You have helped me immensely.
Regards,
Adam
That is exactly what I was looking for.
Last question: if I am understanding how this works correctly, I have to erase the entire sector and write a page every time I want to save, so I am unable to erase and overwrite one array value at a time, correct?
In other words if one of my arrays is {0,0,0,0,1,1,1,1} and I want to make it {1,0,0,0,1,1,1,1} I need to erase and rewrite the whole sector?
Thanks again for all your support. You have helped me immensely.
Regards,
Adam
Not applicable
Jun 05, 2014
08:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 05, 2014
08:34 PM
Hi Adam,
Yes, basically you need to erase the whole sector first then only to write it page by page.
To answer your example case, I would recommended you to write it to a new page whenever you need to update a new data instead of erasing the whole flash sector just to update a single page.
This is because the erase operation is the one that reduce the Flash endurance.
So, is it better to fill up the whole flash sector before you perform the erase operation.
Furthermore, the time taken is lesser if you just write to a single page than you perform an erase and then a write operation.
Of course, if you implemented this way, you need an algorithm to check which is your latest data in the flash.
And basically this is how EEPROM emulation algorithm works (of course much more to be consider when you implement EEPROM emulation algorithm).
Unfortunately, currently we do not have EEPROM emulation algorithm for XMC4500 device yet.
Yes, basically you need to erase the whole sector first then only to write it page by page.
To answer your example case, I would recommended you to write it to a new page whenever you need to update a new data instead of erasing the whole flash sector just to update a single page.
This is because the erase operation is the one that reduce the Flash endurance.
So, is it better to fill up the whole flash sector before you perform the erase operation.
Furthermore, the time taken is lesser if you just write to a single page than you perform an erase and then a write operation.
Of course, if you implemented this way, you need an algorithm to check which is your latest data in the flash.
And basically this is how EEPROM emulation algorithm works (of course much more to be consider when you implement EEPROM emulation algorithm).
Unfortunately, currently we do not have EEPROM emulation algorithm for XMC4500 device yet.