我用了DSP28377D的SPI-A与SCI-C的功能,在CPU1里进行配置,CPU2里边使用。只要配置了CPU1里SPI的寄存器,SCI的接收缓冲区就无法收到数据,把SPI相关配置代码注释掉,SCI就能正常工作。下边是我配置的代码
SPI配置
EALLOW;
GpioCtrlRegs.GPBPUD.bit.GPIO54 = 0; // GPIO54上拉 (SPISIMOA)
GpioCtrlRegs.GPBPUD.bit.GPIO55 = 0; // GPIO55上拉 (SPISOMIA)
GpioCtrlRegs.GPBPUD.bit.GPIO56 = 0; // GPIO56上拉 (***)
GpioCtrlRegs.GPBPUD.bit.GPIO57 = 0; // GPIO57上拉 (SPISTEA)
GpioCtrlRegs.GPBPUD.bit.GPIO55 = 0; // GPIO55上拉 (SPISOMIA)
GpioCtrlRegs.GPBPUD.bit.GPIO56 = 0; // GPIO56上拉 (***)
GpioCtrlRegs.GPBPUD.bit.GPIO57 = 0; // GPIO57上拉 (SPISTEA)
GpioCtrlRegs.GPBQSEL2.bit.GPIO54 = 3; // GPIO54异步输入 (SPISIMOA)
GpioCtrlRegs.GPBQSEL2.bit.GPIO55 = 3; // GPIO55异步输入 (SPISOMIA)
GpioCtrlRegs.GPBQSEL2.bit.GPIO56 = 3; // GPIO56异步输入 (***)
GpioCtrlRegs.GPBQSEL2.bit.GPIO57 = 3; // GPIO57异步输入 (SPISTEA)
GpioCtrlRegs.GPBQSEL2.bit.GPIO55 = 3; // GPIO55异步输入 (SPISOMIA)
GpioCtrlRegs.GPBQSEL2.bit.GPIO56 = 3; // GPIO56异步输入 (***)
GpioCtrlRegs.GPBQSEL2.bit.GPIO57 = 3; // GPIO57异步输入 (SPISTEA)
GpioCtrlRegs.GPBGMUX2.bit.GPIO54 = 1;
GpioCtrlRegs.GPBMUX2.bit.GPIO54 = 2; // GPIO122配置为SPISIMOA
GpioCtrlRegs.GPBGMUX2.bit.GPIO55 = 1;
GpioCtrlRegs.GPBMUX2.bit.GPIO55 = 2; // GPIO123配置为SPISOMIA
GpioCtrlRegs.GPBGMUX2.bit.GPIO56 = 1;
GpioCtrlRegs.GPBMUX2.bit.GPIO56 = 2; // GPIO124配置为SPICLKA
GpioCtrlRegs.GPBGMUX2.bit.GPIO57 = 1;
GpioCtrlRegs.GPBMUX2.bit.GPIO57 = 2; // GPIO125配置为SPISTEA
GpioCtrlRegs.GPBMUX2.bit.GPIO54 = 2; // GPIO122配置为SPISIMOA
GpioCtrlRegs.GPBGMUX2.bit.GPIO55 = 1;
GpioCtrlRegs.GPBMUX2.bit.GPIO55 = 2; // GPIO123配置为SPISOMIA
GpioCtrlRegs.GPBGMUX2.bit.GPIO56 = 1;
GpioCtrlRegs.GPBMUX2.bit.GPIO56 = 2; // GPIO124配置为SPICLKA
GpioCtrlRegs.GPBGMUX2.bit.GPIO57 = 1;
GpioCtrlRegs.GPBMUX2.bit.GPIO57 = 2; // GPIO125配置为SPISTEA
GpioCtrlRegs.GPBCSEL3.bit.GPIO54 = 2; // Configure GPIOs for CPU2
GpioCtrlRegs.GPBCSEL3.bit.GPIO55 = 2;
GpioCtrlRegs.GPBCSEL4.bit.GPIO56 = 2;
GpioCtrlRegs.GPBCSEL4.bit.GPIO57 = 2;
GpioCtrlRegs.GPBCSEL3.bit.GPIO55 = 2;
GpioCtrlRegs.GPBCSEL4.bit.GPIO56 = 2;
GpioCtrlRegs.GPBCSEL4.bit.GPIO57 = 2;
EDIS;
SCI配置
EALLOW;
GPIO_SetupPinOptions(106, GPIO_OUTPUT,GPIO_ASYNC);
GPIO_SetupPinMux(106, GPIO_MUX_CPU2, 6);
GPIO_SetupPinOptions(107, GPIO_INPUT,GPIO_PUSHPULL);
GPIO_SetupPinMux(107, GPIO_MUX_CPU2, 6);
EDIS;
时钟分配
EALLOW;
//##############CPU2控制权分配##############//
DevCfgRegs.CPUSEL6.bit.SPI_A = 0; // *** 时钟由CPU2分配
DevCfgRegs.CPUSEL5.bit.SCI_C = 1; // *** 时钟由CPU2分配
DevCfgRegs.CPUSEL11.bit.ADC_C = 1; // ADC-C 时钟由CPU2分配
DevCfgRegs.CPUSEL11.bit.ADC_D = 1; // ADC-D 时钟由CPU2分配
EDIS;
请大佬帮忙看看问题在哪