This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CCS/MSP432P401R:如何使用两个扇区对闪存进行编程?

Guru**** 2595805 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/641721/ccs-msp432p401r-how-can-i-program-the-flash-memory-using-both-2-sectors

部件号:MSP432P401R

工具/软件:Code Composer Studio

你好。

我正在尝试对闪存进行编程,但数据大小与6 KB 有关,

所以我必须在 闪存主存储器中使用两个扇区(扇区30,31)。

但它不起作用.... 控制台说“内存不足”

这些是我的代码。

#define calibration_Start1 0x0003E000

unsigned int AdjMatrix [40][40]={...}

int main (void)
{

//![FlashCtl程序]
/* Unprotecting Info Bank 0,Sector 0 */
MAP_Flashctl_unprotectSector (FLASH_MAIN_MEMORY_SPACE_BANK1,FLASH_SECTOR31);
MAP_Flashctl_unprotectSector (FLASH_MAIN_MEMORY_SPACE_BANK1,FLASH_SECTOR30);



/*正在尝试擦除扇区。 在此函数中,API将
自动尝试清除最大尝试次数。 如果失败,
在无限循环中捕获*/
IF (!MAP_FlashCtl_eraseSector (CALIBRATION_Start1))
同时(1);

/*正在尝试对内存进行编程。 在此函数中,API将
自动尝试设定最大尝试次数。 如果失败,
在无限循环内陷印*/
IF(!MAP_FlashCTL_programMemory(AdjMatrix,(void*) calibration_Start1, sizeof (AdjMatrix ))
同时(1);


unsigned int (*A_PTR)[40]= calibration_Start1;

/*将扇区设置回受保护的*/
MAP_FlashCTL_ProtectSector(FLASH_MAIN_MEMORY_SPACE_BANK1,FLASH_SECTOR31);
MAP_FlashCTL_ProtectSector(FLASH_MAIN_MEMORY_SPACE_BANK1,FLASH_SECTOR30);...


}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,

     您还需要擦除扇区31。 因此,请添加以下代码:

    #define calibration_Start2 0x0003F000
    
    IF (!MAP_FlashCtl_eraseSector (CALIBRATION_Start2))
    同时(1); 

    希望这能有所帮助,

     David