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.

[参考译文] msp430f5528:奇怪的闪存值-请帮助!

Guru**** 2540460 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/585145/msp430f5528-strange-flash-memory-value---please-help

部件号:MSP430F5528

大家好!

我在写入和读取闪存内存时遇到问题。 以下是用于写入和读取值的代码。

正在写入代码:

FLASH_ptrBflo=(float *) 0x1900;
FCTL3 = FWKEY;                           //清除锁定位
FCTL1 = FWKEY+erase;                     //设置擦除位
*Flash_ptrBfloat = 0;                         //虚拟写入以擦除闪存段
FCTL1 = FWKEY+BLKWRT;                    //启用长字写入

FLASH_ptrBflo=(float *) 0x1904;
*Flash_ptrBfloat = nPipedia;                     //写入闪存
FLASH_ptrBflo=(float *) 0x1908;
*Flash_ptrBfloat = nTravelDistance;                     //写入Flash
FLASH_ptrBflo=(float *) 0x190C;
*Flash_ptrBfloat = nStaticDistance;                     //写入Flash
FLASH_ptrBflo=(float *) 0x1914;
*Flash_ptrBfloat = nScaleFactor;                     //写入闪存

FLASH_ptrBuint32_t =(UINT32_t *) 0x1918;
*Flash_ptrBfloat = nSerialNo;                     //写入闪存

FCTL1 = FWKEY;                           //清除WRT位
FCTL3 = FWKEY+LOCK;

正在读取代码

 FLASH_ptrBflo=(float *) 0x1904;
 nPipedi=*Flash_ptrBfloat;

 FLASH_ptrBflo=(float *) 0x1908;
 nTravelDistance=*Flash_ptrBflo;

 FLASH_ptrBflo=(float *) 0x190C;
 nStaticDistance=*Flash_ptrBflo;

 FLASH_ptrBflo=(float *) 0x1910;
 n比例因子=*Flash_ptrBflo;

 FLASH_ptrBuint32_t=(UINT32_t *) 0x1914;
 n序列号=*Flash_ptrBuint32_t;

直至0x190C的绞线和读数工作正常。 但从0x1910开始,奇怪的值被写入和读取。 我做错了什么?

Plese帮了我…

苏霍


                                    FLASH_ptrBflo=(float *) 0x1900;
                                    FCTL3 = FWKEY;                           //清除锁定位
                                    FCTL1 = FWKEY+erase;                     //设置擦除位
                                    *Flash_ptrBfloat = 0;                         //虚拟写入以擦除闪存段
                                    FCTL1 = FWKEY+BLKWRT;                    //启用长字写入

                                    FLASH_ptrBflo=(float *) 0x1904;
                                    *Flash_ptrBfloat = nPipedia;                     //写入闪存
                                    FLASH_ptrBflo=(float *) 0x1908;
                                    *Flash_ptrBfloat = nTravelDistance;                     //写入Flash
                                    FLASH_ptrBflo=(float *) 0x190C;
                                    *Flash_ptrBfloat = nStaticDistance;                     //写入Flash
                                    FLASH_ptrBflo=(float *) 0x1914;
                                    *Flash_ptrBfloat = nScaleFactor;                     //写入闪存

                                    FLASH_ptrBuint32_t =(UINT32_t *) 0x1918;
                                    *Flash_ptrBfloat = nSerialNo;                     //写入闪存

                                    FCTL1 = FWKEY;                           //清除WRT位
                                    FCTL3 = FWKEY+LOCK;

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

    您正在写信给地址04,08,0C,1418

    您正在读取地址04,08,0C,1014