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.

[参考译文] MSP430FR2355:是什么阻止 FRAM 被写入?

Guru**** 2539500 points
Other Parts Discussed in Thread: MSP430FR2355

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/884154/msp430fr2355-what-prevents-the-fram-to-be-written

器件型号:MSP430FR2355
主题中讨论的其他器件: MSP430WARE

大家好、团队、

在下面的示例中、什么阻止 FRAM 地址被写入?

应用程序应指向未写入应用程序的 FRAM 地址并写入新值。

我从程序大小中选择了一个。

执行分步调试时、我可以看到变量 FRAM_content 根据用作指针的 FRAM_ADDRESS (FFFF)进行了更新。

当我按下 P2.3上的按钮时、会执行更新 FRAM 位置的代码。

但 FRAM 不会更新为新值(FRAM_Data)。

我将在 MSP430FR2355 Launchpad 上测试 FW。

下面的演示被认为是一个数据记录器、显示了如何在下电上电后更新 FRAM 位置并保留数据。

感谢后续行动。

日落。

#include 

//指针内容未初始
化 unsigned int * FRAM_Pointer;

const unsigned int FRAM_address = 0x9000;
const unsigned int FRAM_Data = 0x050A;

void main (void){

unsigned int FRAM_content = 0;

//停止看门狗计时器
WDTCTL = WDTPW + WDTHOLD;

PM5CTL0 &=~LOCKLPM5;

//LED 初始化
//将 BIT0设置为输出
P1DIR |= BIT0;
//复位 BIT0
P1OUT &=~BIT0;


//开关初始化
//端口1设置
P2DIR &= BIT3;
P2REN |= BIT3;
P2OUT |= BIT3;

FRAM_POINTER =(unsigned int *) FRAM_ADDRESS;


while (1){

FRAM_content =* FRAM_POINTER;

如果(!(P2IN & BIT3)){
*FRAM_POINTER = FRAM_Data;
}
}