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.
工具与软件:
你(们)好
在开发 EtherCAT 通信代码时发生问题。
该系统基于双核架构、在 CPU1和 Cortex-M4之间建立了 IPC 通信。
但是、在闪存运行期间、会观察到 IPC 通信出现间歇性中断。
根据当前的分析、发现出现问题是因为 sendCommand
传递函数 while
Cortex-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);
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编写的。
Hi Dongjin,
您是否有机会在 C2000Ware 中运行 CM IPC 基本示例? (c2000ware\driverlib\f2838x\examples\c28x_cm\ipc)
您能否确保以正确的方式编写完 CM 代码。 您还可以参考闪烁示例来了解如何更好地配置 CM 内核。
此致、
Ozino
您好、Ozino
我已经根据示例文件建立了 IPC 通信。
如示例文件中所示、该实现构建在使用中断和标志进行 IPC 通信的基础上。
此外、我已经在基于 RAM 的执行中验证了正确操作。
然而、当从闪存运行时、IPC 寄存器的激活会在运行期间间歇性停止。
您开始利用哪个示例? C2000Ware 中提供的 RAM 或闪存示例? 您能否尝试一下是否可以使用基于闪存的示例并在其基础上添加您的代码。
另外、我不知道在 CM 代码中调用您的 send 命令的确切位置。
此致、
Ozino
我是根据编写代码的 f2838x_cm_echoback_solution 和 f2838x_cpu1_allocat_ecat_to_cm 示例。
我还将配置更改为 闪存[有效] 。 General >> Configuration (常规>>配置) 添加了一些闪存函数、以确保正常运行。
谢谢。
您好!
IPC 寄存器问题是否易于重现还是随机问题? 您是否知道在对代码进行了什么修改后问题才开始发生? 最好是逐步添加代码、直到确定哪一行代码是导致错误的罪魁祸首。 如果您能缩小范围、请告知我们。
此致、
Ozino