Watch DCFCTL2 is disabled(has no data) window), which means that the data window is not enabled when the DSP is initialized, which can be enabled by adding the following statement in the code:
EALLOW;
SysCtrlRegs.WDCR = 0x68; //启用 Watchdog,每个周期进行检测
EDIS;
DINT; //关闭所有中断
InitPieCtrl(); //初始化 PIE 控制器
IER = 0x0000; //禁用所有中断
IFR = 0x0000; //清除中断标志
InitPieVectTable(); //初始化 PIE 中断向量表
// 启用数据窗口
EALLOW;
SysCtrlRegs.WDCR = 0x28; //启用 Watchdog,每个周期进行检测,启用数据窗口
EDIS;
// 初始化 DSP
InitSysCtrl(); //初始化系统控制器
InitGpio(); //初始化 GPIO
InitAdc(); //初始化 ADC
InitSpiGpio(); //初始化 SPI GPIO
InitSpi(); //初始化 SPI
InitEPwm(); //初始化 EPwm
In the above code, we first disable all interrupts and initialize the PIE controller and interrupt vector table. Next, we enable the data window by making the code snippet access enhanced through EALLOW and EDIS. Finally, we initialize the system controller, GPIO, ADC, SPI, EPwm and other modules.
Note that you need to be very careful when enabling data Windows, as incorrect Settings can cause code runtime exceptions or even hardware corruption. Therefore, it is important to ensure that the data window is enabled in the right way.