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.
我在使用TI 官方的msp430f5529开发板写主存储器flash的扇区A时出错,复现概率100%
代码是TI官方代码,稍作修改
#include <msp430f5529.h> char value; // 8-bit value to write to seg C // Function prototypes void write_BankA(char value); void copy_C2D(void); int main(void) { WDTCTL = WDTPW+WDTHOLD; // Stop WDT value = 1; // initialize value write_BankA(value++); // Write Bank A, increment value // copy_C2D(); // Copy segment C to D __no_operation(); // Loop forever, SET BREAKPOINT HERE while(1); } //------------------------------------------------------------------------------ // Input = value, holds value to write to Bank A //------------------------------------------------------------------------------ void write_BankA(char value) { unsigned int i; char * Flash_ptr; // Initialize Flash pointer Flash_ptr = (char *) 0x4400; // Bank A address FCTL3 = FWKEY; // Clear Lock bit FCTL1 = FWKEY+ERASE; // Set Erase bit _DINT(); //no interrupt *Flash_ptr = 0; // Dummy write to erase Flash seg FCTL1 = FWKEY+WRT; // Set WRT bit for write operation for (i = 0; i < 128; i++) { *Flash_ptr++ = value; // Write value to flash } while(FCTL3 & BUSY); _EINT(); FCTL1 = FWKEY; // Clear WRT bit FCTL3 = FWKEY+LOCK; // Set LOCK bit }
1. 在IAR 平台编译Ctrl+F7(compile)代码
2. 下载并调试Ctrl+D(download and debug)
3. 按运行键F5(Go),然后就报错了
windows10+IAR 7.12.1+MSP-EXP430F5529LP-V1.8