关于MSP430FR4133写FRAM的问题

2019-07-18 16:25发布

当执行FRAMWrite_uint64((uint64_t *)FRAM_RECORD_ADDRESS,0); 时,后20*4会被修改为0
原来0xffffffff,0xffffffff,被改为0x0000ffff,0x00000000

当执行FRAMWrite_Long((uint32_t *)FRAM_RECORD_ADDRESS, 0);时,后10*4=40会被修改为0
原来0xffffffff,被改为0x0000ffff,

void FRAMWrite_uint64(uint64_t *pFRAM_write_ptr, uint64_t ui64data)
{
        SYSCFG0 &= ~DFWP;
        *pFRAM_write_ptr = ui64data;
        SYSCFG0 |= DFWP;
}

void FRAMWrite_Long(uint32_t *pFRAM_write_ptr, uint32_t ui32data)
{
        SYSCFG0 &= ~DFWP;
        *pFRAM_write_ptr = ui32data;
        SYSCFG0 |= DFWP;
}

#define FRAM_RECORD_ADDRESS  0x1812


FRAMWrite_uint64((uint64_t *)FRAM_RECORD_ADDRESS,0);
FRAMWrite_Long((uint32_t *)FRAM_RECORD_ADDRESS, 0);
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
9条回答
Thorald
1楼-- · 2019-07-18 19:09
FRAM好像可以提供8位16位写入,64位有问题
FRAM
The FRAM can be programmed via the JTAG port, Spy-Bi-Wire (SBW), the BSL, or in-system by the CPU.
Features of the FRAM include:
• Ultra-low-power ultra-fast-write nonvolatile memory
• Byte and word access capability
• Programmable and automated wait-state generation
• Error correction coding (ECC)
Bjorn
2楼-- · 2019-07-18 22:43
参考官方代码MSP430Ware中例子
//******************************************************************************
//   MSP430FR413x Demo - Long word writes to FRAM
//
//   Description: Use long word write to write to 512 byte blocks of FRAM.
//   Toggle LED after every 100 writes.
//   NOTE: Running this example for extended periods will impact the FRAM
//   endurance.
//   ACLK = REFO, MCLK = SMCLK = default DCODIV = ~1MHz
//
//           MSP430FR4133
//         ---------------
//     /||               |
//      | |               |
//      --|RST            |
//        |               |
//        |          P1.0 |---> LED
//
//   Cen Fang
//   Texas Instruments Inc.
//   August 2013
//   Built with IAR Embedded Workbench v5.60 & Code Composer Studio v5.5
//******************************************************************************
#include <msp430.h>

void FRAMWrite(void);

unsigned char count = 0;
unsigned long *FRAM_write_ptr;
unsigned long data;

#define FRAM_TEST_START 0x1800


int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;               // Stop watchdog timer

    P1OUT &= ~BIT0;                         // Clear P1.0 output latch for a defined power-on state
    P1DIR |= BIT0;                          // Set P1.0 to output directionOUT

    PM5CTL0 &= ~LOCKLPM5;                   // Disable the GPIO power-on default high-impedance mode
                                            // to activate previously configured port settings
    data = 0x11111111;                      // Initialize dummy data

    while(1)
    {
        data += 0x00010001;
        FRAM_write_ptr = (unsigned long *)FRAM_TEST_START;
        FRAMWrite();
        count++;
        if (count > 100)
        {
            P1OUT ^= 0x01;                  // Toggle LED to show 512K bytes
            count = 0;                      // ..have been written
            data = 0x11111111;
        }
    }
}

void FRAMWrite (void)
{
    unsigned int i=0;

    SYSCFG0 &= ~DFWP;
    for (i = 0; i < 128; i++)
    {
        *FRAM_write_ptr++ = data;
    }
    SYSCFG0 |= DFWP;
}
Rollo
3楼-- · 2019-07-19 04:07
FRAM读写有没有问题?
Rangar
4楼-- · 2019-07-19 04:54
 精彩回答 2  元偷偷看……
Stannis
5楼-- · 2019-07-19 10:13
我的是写入的时候,地址内容没有改变,全是FFFFFFFF
baimiaocun2015
6楼-- · 2019-07-19 15:18
这写代码的先参考研究下的再说

一周热门 更多>