您好!
我目前看到在 PUC 事件后、在写入 msp430fr2476控制器的"信息存储器"区域时出现问题。
我正在尝试通过存储 "SYSRSTIV"看到的值来存储复位原因、控制器在写入信息存储器区域时似乎崩溃。
在 PUC 事件发生时、我是否应该执行特殊操作?
相同的方法/例程/代码在 POR/BOR 事件被触发时起作用、例如"PMMSWPOR"、"PMMSWBOR"或"欠压"
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.
您好!
我目前看到在 PUC 事件后、在写入 msp430fr2476控制器的"信息存储器"区域时出现问题。
我正在尝试通过存储 "SYSRSTIV"看到的值来存储复位原因、控制器在写入信息存储器区域时似乎崩溃。
在 PUC 事件发生时、我是否应该执行特殊操作?
相同的方法/例程/代码在 POR/BOR 事件被触发时起作用、例如"PMMSWPOR"、"PMMSWBOR"或"欠压"
1.12.1.1 FRAM 写保护
用户可通过 FRAM 写保护防止对用户代码和数据执行意外写操作。 为
主代码 FRAM 和信息 FRAM 受 PFWP 和 DFWP 位保护。
分别在 SYSCFG0寄存器中。 PUC 复位之后、这两个位默认为1、FRAM 写操作均为
被禁用。 必须先清零相应位、然后才能对用户代码执行写操作。 请参阅第1.16.2节以了解
寄存器详细信息。
//Get previous write protection setting uint8 u8_State = SYSCFG0_L; uint8 u8_wp = DFWP | PFWP; SYSCFG0 = FRWPPW | (u8_State & ~(u8_wp)); __disable_interrupt(); ///< Write Data for(uint16 i = 0; i < u16_Length; i++) { pu8_InfoMemoryPointer[i] = pu8_Data[i]; } __enable_interrupt(); //Restore previous write protection setting SYSCFG0 = FRWPPW | u8_State;
您好!
有一个写入信息存储器的示例代码。 您是否在电路板上尝试过它?
https://dev.ti.com/tirex/explore/node?node=A__AM6QYnBUHQT2ROMUPiKp5g__msp430ware__IOGqZri__LATEST
此致、
现金豪
//Calculate new crc-sum mp_storageDrv->Read(static_cast<uint32>(u16_StorageLoc), &buffer[0], u16_StructLengthNV); memcpy(&buffer[u16_offset], pv_data, u16_size); // recompute crc based on the new value u16_crc = crc16_Compute(CRC_INITIAL_VALUE, &buffer[sizeof(ST_Header::u16_crc_sum)], u16_StructLengthNV - sizeof(ST_Header::u16_crc_sum)); // Write new data to eeprom en_error = EC_ResWriteConstrainConflict; if ((mp_storageDrv->Write(static_cast<uint32>(u16_StorageLoc) + u16_offset, pv_data, u16_size) == u16_size) && (mp_storageDrv->Write(static_cast<uint32>(u16_StorageLoc), &u16_crc, sizeof(u16_crc)) == sizeof(u16_crc))) { en_error = EC_NoError; }
您好!
很抱歉回复延迟。 我想这个问题已经解决了。
回到这个问题、在 UG 第1.9.3章中。 "对受保护的 FRAM 执行任何写入访问都会导致无效的写入操作、但不会生成中断或复位"。 如果仍然遇到 PUC 事件、不应该是由于写入 FRAM 而引起的。 它应该是导致 PUC 事件的其他事件。
而将 CRC 写入 FRAM 在功能上不起作用、您是否曾尝试过 首先测试示例代码?
有一个写入信息存储器的示例代码。 您是否在电路板上尝试过它?
https://dev.ti.com/tirex/explore/node?node=A__AM6QYnBUHQT2ROMUPiKp5g__msp430ware__IOGqZri__LATEST
[/报价]此致、
现金豪
我很生气、因为我回答了您的所有问题、而您给我提供了标准回答、认为我不知道如何使用微控制器、并且我没有 编写代码的经验。
简单的实验来在您的终端上执行、
在 msp430fr2476硬件上执行 PUC 事件、并验证您可以在启动时多次写入 FRAM。
我已经多次解释自己。
我再输入一下、进行娱乐。
//Calculate new crc-sum mp_storageDrv->Read(static_cast<uint32>(u16_StorageLoc), &buffer[0], u16_StructLengthNV); memcpy(&buffer[u16_offset], pv_data, u16_size); // recompute crc based on the new value u16_crc = crc16_Compute(CRC_INITIAL_VALUE, &buffer[sizeof(ST_Header::u16_crc_sum)], u16_StructLengthNV - sizeof(ST_Header::u16_crc_sum)); // Write new data to eeprom en_error = EC_ResWriteConstrainConflict; if ((mp_storageDrv->Write(static_cast<uint32>(u16_StorageLoc) + u16_offset, pv_data, u16_size) == u16_size) && (mp_storageDrv->Write(static_cast<uint32>(u16_StorageLoc), &u16_crc, sizeof(u16_crc)) == sizeof(u16_crc))) { en_error = EC_NoError; }
mp_storageDrv->Write
//Get previous write protection setting uint8 u8_State = SYSCFG0_L; uint8 u8_wp = DFWP | PFWP; SYSCFG0 = FRWPPW | (u8_State & ~(u8_wp)); __disable_interrupt(); ///< Write Data for(uint16 i = 0; i < u16_Length; i++) { pu8_InfoMemoryPointer[i] = pu8_Data[i]; } __enable_interrupt(); //Restore previous write protection setting SYSCFG0 = FRWPPW | u8_State;
(mp_storageDrv->Write(static_cast<uint32>(u16_StorageLoc) + u16_offset, pv_data, u16_size)
mp_storageDrv->Write(static_cast<uint32>(u16_StorageLoc), &u16_crc, sizeof(u16_crc))