TMS320F28379d双核使用记录

C:\ti\controlSUITE\device_support\F2837xD\v210\F2837xD_examples_Dual\adc_epwm这个例程,设置生成flash编译,下载,不断电,直接运行,可以。但是断电重新上电运行就不可以。

怀疑是CPU1的工程中没有对CPU2的启动代码,需要加入:

    // Send boot command to allow the CPU2 application to begin execution
    IPCBootCPU2(0x0000000B);

    当然为了让上面这行代码能够编译通过和正常运行,需要做和他相关的头脑文件包含:#include "F2837xD_Ipc_drivers.h"

   以及该函数所在的源文件的导入:F2837xD_Ipc_Driver_Util.c

 CPU1的主函数,adc_epwm_cpu01.c,改成如下的样子:

#include "F28x_Project.h"
#include "F2837xD_Ipc_drivers.h"

void main(void)
{

    InitSysCtrl();
    // Send boot command to allow the CPU2 application to begin execution
    IPCBootCPU2(0x0000000B);

    InitGpio();

    GPIO_SetupPinMux(31, GPIO_MUX_CPU1, 0);
    GPIO_SetupPinOptions(31, GPIO_OUTPUT, GPIO_PUSHPULL);

    GPIO_SetupPinMux(34, GPIO_MUX_CPU2, 0);
    GPIO_SetupPinOptions(34, GPIO_OUTPUT, GPIO_PUSHPULL);

    DINT;

    InitPieCtrl();

    IER = 0x0000;
    IFR = 0x0000;

    InitPieVectTable();

    EINT;  // Enable Global interrupt INTM
    ERTM;  // Enable Global realtime interrupt DBGM

    InitEPwm1Gpio();
// Transfer ownership of EPWM1 and ADCA to CPU02
    EALLOW;
    DevCfgRegs.CPUSEL0.bit.EPWM1 = 1;
    DevCfgRegs.CPUSEL11.bit.ADC_A = 1;
    EDIS;

    while(1)
    {
        GPIO_WritePin(31, 0);
        DELAY_US(1000*500);
        GPIO_WritePin(31, 1);
        DELAY_US(1000*500);
    }
}

 

CPU2的主函数,adc_epwm_cpu02.c基本不用动。

posted @ 2022-02-10 21:01  艾诺洛格_泡尔斯伊  阅读(669)  评论(0)    收藏  举报