Part Number: LP-MSPM0G3507
#include "ti_msp_dl_config.h"
/* Address in main memory to write to */
#define MAIN_BASE_ADDRESS (0x00010000)
/* 16-bit data to write to flash */
uint16_t gData16 = 0x2222;
uint16_t gData160 = 0x4444;
/* 32-bit data to write to flash */
uint32_t gData32 = 0x33333333;
/* Array to write 64-bits to flash */
uint32_t gDataArray64[] = {0xABCDEF00, 0x12345678};
/* 32-bit data array to write to flash */
uint32_t gDataArray32[] = {0x00000000, 0x11111111, 0x22222222, 0x33333333,
0x4444, 0x55555, 0x66, 0x77, 0x8, 0x9};
/* 8-bit data to write to flash */
uint8_t gData80 = 0x11;
uint8_t gData81 = 0x03;
uint8_t gData82 = 0xFF;
volatile DL_FLASHCTL_COMMAND_STATUS gCmdStatus;
int main(void)
{
SYSCFG_DL_init();
/* Unprotect sector in main memory with ECC generated by hardware */
DL_FlashCTL_unprotectSector(
FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
/* Erase sector in main memory */
gCmdStatus = DL_FlashCTL_eraseMemoryFromRAM(
FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_COMMAND_SIZE_SECTOR);
if (gCmdStatus == DL_FLASHCTL_COMMAND_STATUS_FAILED) {
/* If command was not successful, set a breakpoint */
__BKPT(0);
}
/* 8-bit write to flash in main memory */
DL_FlashCTL_unprotectSector(
FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
gCmdStatus = DL_FlashCTL_programMemoryFromRAM8WithECCGenerated(
FLASHCTL, MAIN_BASE_ADDRESS, &gData80);
if (gCmdStatus == DL_FLASHCTL_COMMAND_STATUS_FAILED) {
/* If command was not successful, set a breakpoint */
__BKPT(0);
}
DL_FlashCTL_unprotectSector(
FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
gCmdStatus = DL_FlashCTL_programMemoryFromRAM8WithECCGenerated(
FLASHCTL, MAIN_BASE_ADDRESS, &gData81);
if (gCmdStatus == DL_FLASHCTL_COMMAND_STATUS_FAILED) {
/* If command was not successful, set a breakpoint */
__BKPT(0);
}
DL_FlashCTL_unprotectSector(
FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
gCmdStatus = DL_FlashCTL_programMemoryFromRAM8WithECCGenerated(
FLASHCTL, MAIN_BASE_ADDRESS, &gData82);
if (gCmdStatus == DL_FLASHCTL_COMMAND_STATUS_FAILED) {
/* If command was not successful, set a breakpoint */
__BKPT(0);
}
Hi, Gentleman.
I want to make program to write data on the flash memory.
I refer the sample program in mspm0_sdk "flashctl_multiple_size_write", and add the "over-write different data program" on the same flash memory address.
This program shall write 8bit data 0x11, 0x03, 0xff on the flash memory 0x00010000, but it doesn't change after 1st byte '0x11' is written. (I expected memory data will change 11->03->ff)
How can I write program that I want. Please advice me.