Not applicable
Jan 13, 2016
01:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 13, 2016
01:24 PM
I am attempting to use the XMC_FLASH_WriteBlocks function to save parameters to Flash memory but I get stuck in this default handler in the startup_XMC1300.S file. Here are some code snippets:
// Declare global pointer
const uint32_t *parameter;
// Declare array of parameters in main of main.c
uint8_t defaultParam[7] = {0,0,5,2,3,70,15};
// Assign location of data to save to Flash to the pointer variable
parameter = &defaultParam;
// Address I verified wasn't used by the program, pointer to the location of data, # of blocks, verify
XMC_FLASH_WriteBlocks(10009000, parameter, 1, 1);
As soon as it gets to *address = *data; in the XMC_FLASH_WriteBlocks function, it goes to the default handler. What am I missing here?
// Declare global pointer
const uint32_t *parameter;
// Declare array of parameters in main of main.c
uint8_t defaultParam[7] = {0,0,5,2,3,70,15};
// Assign location of data to save to Flash to the pointer variable
parameter = &defaultParam;
// Address I verified wasn't used by the program, pointer to the location of data, # of blocks, verify
XMC_FLASH_WriteBlocks(10009000, parameter, 1, 1);
As soon as it gets to *address = *data; in the XMC_FLASH_WriteBlocks function, it goes to the default handler. What am I missing here?
1 Reply
Jan 18, 2016
09:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 18, 2016
09:36 PM
Hello,
I suspect that the input address to the function is being read as an integer value and hence, writing to an undefined address.
Better will be to use a #define for the address, or write in the hex format.
Another suggestion is to always erase the Flash page before any programming.
Therefore your code should be:
Regards,
Min Wei
I suspect that the input address to the function is being read as an integer value and hence, writing to an undefined address.
Better will be to use a #define for the address, or write in the hex format.
Another suggestion is to always erase the Flash page before any programming.
Therefore your code should be:
// Erase Flash page before writing to the block
XMC_FLASH_ErasePage(0x10009000);
// Address I verified wasn't used by the program, pointer to the location of data, # of blocks, verify
XMC_FLASH_WriteBlocks(0x10009000, parameter, 1, 1);
Regards,
Min Wei