Thread 中讨论的其他器件:C2000WARE
工具与软件:
你(们)好
在开发 EtherCAT 通信代码时发生问题。
该系统基于双核架构、在 CPU1和 Cortex-M4之间建立了 IPC 通信。
但是、在闪存运行期间、会观察到 IPC 通信出现间歇性中断。
根据当前的分析、发现出现问题是因为 sendCommand传递函数 whileCortex-M4文件的主例程中的循环停止运行、导致通信中断。
您能否对该问题的可能原因提供任何见解?
void CM_init(void)
{
//
// Disable the watchdog
//
SysCtl_disableWatchdog();
#ifdef _FLASH
//
// Copy time critical code and flash setup code to RAM. This includes the
// following functions: InitFlash();
//
// The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart symbols
// are created by the linker. Refer to the device .cmd file.
//
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
//
// Claim the Flash Pump Semaphore before initializing Flash
//
Flash_claimPumpSemaphore(FLASH_CM_WRAPPER);
//
// Call Flash Initialization to setup flash waitstates. This function must
// reside in RAM.
//
Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, DEVICE_FLASH_WAITSTATES);
//
// Set Flash Bank and Pump power mode to Active
//
Flash_setBankPowerMode(FLASH0CTRL_BASE, FLASH_BANK, FLASH_BANK_PWR_ACTIVE);
Flash_setPumpPowerMode(FLASH0CTRL_BASE, FLASH_PUMP_PWR_ACTIVE);
//
// Release the Flash Pump Semaphore after initialization
//
Flash_releasePumpSemaphore();
#endif
//
// Turn on all peripherals
//
CM_enableAllPeripherals();
//
// Sets the NVIC vector table offset address.
//
#ifdef _FLASH
Interrupt_setVectorTableOffset((uint32_t)vectorTableFlash);
#else
Interrupt_setVectorTableOffset((uint32_t)vectorTableRAM);
#endif
}
#else
HW_Init();
#endif
MainInit();
bRunApplication = TRUE;
do
{
GPIO_setPortPins(GPIO_PORT_C, GPIO_GPCSET_GPIO93);
IPC_Write(IPC_CM_L_CPU1_R, IPC_FLAG2, IPC_CMD_READ_MEM1, 6);
GPIO_clearPortPins(GPIO_PORT_C, GPIO_GPCCLEAR_GPIO93);
MainLoop();
DEVICE_DELAY_US((uint32_t)(5.));
BackTicker++;
} while (bRunApplication == TRUE);上述两个代码是为 Cortex-M4编写的。
void main(void)
{
//
// Disable the watchdog
//
SysCtl_disableWatchdog();
#ifdef _FLASH
//
// Copy time critical code and flash setup code to RAM. This includes the
// following functions: Flash_initModule();
//
// The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart symbols
// are created by the linker. Refer to the device .cmd file.
//
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
//
// Claim the Flash Pump Semaphore before initializing Flash
//
Flash_claimPumpSemaphore(FLASH_CPU1_WRAPPER);
//
// Call Flash Initialization to setup flash waitstates. This function must
// reside in RAM.
//
Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, DEVICE_FLASH_WAITSTATES);
//
// Set Flash Bank and Pump power mode to Active
//
Flash_setBankPowerMode(FLASH0CTRL_BASE, FLASH_BANK, FLASH_BANK_PWR_ACTIVE);
Flash_setPumpPowerMode(FLASH0CTRL_BASE, FLASH_PUMP_PWR_ACTIVE);
//
// Release the Flash Pump Semaphore after initialization
//
Flash_releasePumpSemaphore();
#endif
上述代码是为 CPU1编写的。