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.
cpu01_to_cpu02_ipcdrivers_lite_cpu01.c和cpu01_to_cpu02_ipcdrivers_lite_cpu02.c这两个例程,我是在control suit里面找到的F2837XD的例程,我发现当我将这两个程序以FLASH模式烧录到板子上后。当我给板子断电之后重新插上电他就无法工作了。
是因为核二没有正常启动导致核一进入了循环等待一直等待核二启动吗,以下是部分代码,我该怎样让开发板断电后能正常启动
main(void) { // Step 1. Initialize System Control: // PLL, WatchDog, enable Peripheral Clocks // This example function is found in the F2837xD_SysCtrl.c file. InitSysCtrl(); // Step 2. Initialize GPIO: InitGpio(); // Skipped for this example GPIO_SetupPinMux(20, GPIO_MUX_CPU1, 0); GPIO_SetupPinOptions(20, GPIO_OUTPUT, GPIO_PUSHPULL); // Step 3. Clear all interrupts and initialize PIE vector table: // Disable CPU interrupts DINT; // Initialize PIE control registers to their default state. // The default state is all PIE interrupts disabled and flags // are cleared. // This function is found in the F2837xD_PieCtrl.c file. InitPieCtrl(); #ifdef _STANDALONE #ifdef _FLASH // // Send boot command to allow the CPU02 application to begin execution // IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH); #else // // Send boot command to allow the CPU02 application to begin execution // IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_RAM); #endif #endif // // Initialize all variables used in example. // ErrorFlag = 0; usWWord16 = 0; ulWWord32 = 0; usRWord16 = 0; ulRWord32 = 0; pulMsgRam = (void *)CPU02_TO_CPU01_PASSMSG; // // Spin here until CPU02 is ready // while(!IPCRtoLFlagBusy(IPC_FLAG17)); IPCRtoLFlagAcknowledge(IPC_FLAG17); // 16 and 32-bit Data Writes // Write 16-bit word to CPU02 16-bit write word variable. // IPCLiteLtoRDataWrite(IPC_FLAG0, pulMsgRam[0],(uint32_t)usWWord16, IPC_LENGTH_16_BITS, IPC_FLAG31); // // Optionally Get result of the Write (i.e. read word that was written at // address) without // performing a separate read command. IPCLiteLtoRGetResult() will return // STATUS_FAIL if // the CPU02 did not recognize the command being sent, and therefore did not // process the // command. Otherwise it will return STATUS_PASS and the appropriate read // value. // while(IPCLiteLtoRGetResult(&usRWord16,IPC_LENGTH_16_BITS, IPC_FLAG31) != STATUS_PASS) { } if(usWWord16 != usRWord16) { ErrorCount++; } usRWord16 = 0; // // OR Read 16-bit word from CPU02 16-bit write word variable. Use IPC Flag 32 // to check status of command. // Notice that the command function is in a while-loop. All command // functions will return STATUS_FAIL if // the IPC interrupt ulFlag is still busy, and subsequently, will not send // the command to the CPU02. If // the IPC interrupt ulFlag is available, the command will be sent, and the // function will return STATUS_PASS. // while(IPCLiteLtoRDataRead(IPC_FLAG0, pulMsgRam[0], IPC_LENGTH_16_BITS, IPC_FLAG31) != STATUS_PASS) { } // // Result of Read will be read into usRWord16 variable. // while(IPCLiteLtoRGetResult(&usRWord16,IPC_LENGTH_16_BITS, IPC_FLAG31) != STATUS_PASS) { } if(usWWord16 != usRWord16) { ErrorCount++; } // // Write 32-bit word to CPU02 32-bit write word variable. // while(IPCLiteLtoRDataWrite(IPC_FLAG0, pulMsgRam[1],ulWWord32, IPC_LENGTH_32_BITS, IPC_FLAG31) != STATUS_PASS) { } // // Optionally Get result of the Write (i.e. read word that was written at // address) without // performing a separate read command. // while(IPCLiteLtoRGetResult(&ulRWord32,IPC_LENGTH_32_BITS, IPC_FLAG31) != STATUS_PASS) { } if(ulWWord32 != ulRWord32) { ErrorCount++; } ulRWord32 = 0; // // Read 32-bit word from CPU02 32-bit write word variable. Use IPC Flag 32 to // check status of command // IPCLiteLtoRDataRead(IPC_FLAG0, pulMsgRam[1], IPC_LENGTH_32_BITS, IPC_FLAG31); // // Result of Read will be read into ulRWord32 variable. // while(IPCLiteLtoRGetResult(&ulRWord32,IPC_LENGTH_32_BITS, IPC_FLAG31) != STATUS_PASS) { } if(ulWWord32 != ulRWord32) { ErrorCount++; } // 16 and 32-bit Data Set Bits // Set upper 8 bits in 16-bit write word variable location. IPCLiteLtoRSetBits(IPC_FLAG0, pulMsgRam[0], SETMASK_16BIT, IPC_LENGTH_16_BITS, IPC_FLAG31); // // Optionally Get result of the Write (i.e. read word that was written at // address) without performing a separate read command. // while(IPCLiteLtoRGetResult(&usRWord16,IPC_LENGTH_16_BITS, IPC_FLAG31) != STATUS_PASS) { } if(usRWord16 != (usWWord16 | SETMASK_16BIT)) { ErrorCount++; } // // Set upper 16 bits in 32-bit write word variable location. // IPCLiteLtoRSetBits(IPC_FLAG0, pulMsgRam[1], SETMASK_32BIT, IPC_LENGTH_32_BITS, IPC_FLAG31); // // Optionally Get result of the Write (i.e. read word that was written at // address) without performing a separate read command. // while(IPCLiteLtoRGetResult(&ulRWord32,IPC_LENGTH_32_BITS, IPC_FLAG31) != STATUS_PASS) { } if(ulRWord32 != (ulWWord32 | SETMASK_32BIT)) { ErrorCount++; } // // 16 and 32-bit Data Clear Bits // Clear alternating bits in 16-bit write word variable location // IPCLiteLtoRClearBits(IPC_FLAG0, pulMsgRam[0], CLEARMASK_16BIT, IPC_LENGTH_16_BITS, IPC_FLAG31); // // Optionally Get result of the Write (i.e. read word that was written at // address) without performing a separate read command. // while(IPCLiteLtoRGetResult(&usRWord16,IPC_LENGTH_16_BITS, IPC_FLAG31) != STATUS_PASS) { } if(usRWord16 != ((usWWord16 | SETMASK_16BIT) & (~CLEARMASK_16BIT))) { ErrorCount++; } // // Clear alternating bits in 32-bit write word variable location // IPCLiteLtoRClearBits(IPC_FLAG0, pulMsgRam[1], CLEARMASK_32BIT, IPC_LENGTH_32_BITS, IPC_FLAG31); // // Optionally Get result of the Write (i.e. read word that was written at // address) without performing a separate read command. // while(IPCLiteLtoRGetResult(&ulRWord32,IPC_LENGTH_32_BITS, IPC_FLAG31) != STATUS_PASS) { } if(ulRWord32 != ((ulWWord32 | SETMASK_32BIT) & (~CLEARMASK_32BIT))) { ErrorCount++; } // // Check Data Write Protected Function // // // Write to write-protected CPU02 PCLKCR0 register // IPCLiteLtoRDataWrite_Protected(IPC_FLAG0, pulMsgRam[2], 0x000A, IPC_LENGTH_16_BITS, IPC_FLAG31); // // Result of write will be read into usRWord16 variable. // while(IPCLiteLtoRGetResult(&usRWord16, IPC_LENGTH_16_BITS, IPC_FLAG31) != STATUS_PASS) { } if(usRWord16 != 0x000A) { ErrorCount++; } // Check Function Call Function // // // // Call FunctionCallNoReturn() function on CPU02 with a dummy parameter of // "0". IPCLiteLtoRFunctionCall(IPC_FLAG0, pulMsgRam[3], 0, IPC_FLAG31); // // When IPC_FLAG0 is ready, Read FnCallFlag to see if FunctionCallNoReturn() // was called and executed properly. while(IPCLiteLtoRDataRead(IPC_FLAG0, pulMsgRam[5], IPC_LENGTH_16_BITS, IPC_FLAG31) != STATUS_PASS) ; //// //// Result of Read will be read into usRWord16 variable. //// while(IPCLiteLtoRGetResult(&usRWord16,IPC_LENGTH_16_BITS, IPC_FLAG31) != STATUS_PASS) { } if(usRWord16 != 1) { ErrorCount++; } // // Call FunctionCallReturn() function on CPU02 with a parameter of 0x12345678. // IPCLiteLtoRFunctionCall(IPC_FLAG0, pulMsgRam[4], 0x12345678, IPC_FLAG31); // // Return value from function call will be read into ulRWord32 variable. // while(IPCLiteLtoRGetResult(&ulRWord32,IPC_LENGTH_32_BITS, IPC_FLAG31) != STATUS_PASS) { } if(ulRWord32 != 2) { ErrorCount++; } for(;;) { // // When Complete, Loop Forever here. // GPIO_WritePin(20 , 0); while(i < 10000) { i++; } i=0; GPIO_WritePin(20, 1); if(ulWWord32 == 2333) { ulWWord32 = 0; } else { ulWWord32++; } //IPCLiteLtoRDataWrite(IPC_FLAG0, pulMsgRam[1],ulWWord32,IPC_LENGTH_32_BITS, IPC_FLAG31); } } // // End of file //
确实有可能是因为,在重新上电后,CPU01在等待时进入死循环,或者是引导失败。
请从以下方面进行检查:
确保两个核的程序都正确烧录到FLASH中。
启动代码中,确保在引导CPU02之前有足够的延时
检查CPU02的程序是否被正确放置在FLASH中,并且链接器配置的FLASH地址与CPU01引导时使用的地址一致。