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.

[参考译文] TMS320F28379D:无来自 SPIASIMO 的信号输出

Guru**** 2589760 points
Other Parts Discussed in Thread: C2000WARE

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1071788/tms320f28379d-no-signal-output-from-spiasimo

部件号:TMS320F28379D
“线程:C2000WARE”中讨论的其它部件

我的启动板是  C2000 LaunchPad XL TMS28379D 版本:2.0

我将 GPIO58~61配置为无 FIFO 和中断的 SPIA GPIO  

我可以确保 GPIO58~61能够以正确的功能运行,因为我以前将其配置为通用 GPIO 并使外部 LED 指示灯呈右闪烁

我调试示例:C2000Ware_4_00_00_00\device_support\f2837xd\examples\CPU1\SPI_loopback_interrupts 和 SPI_loopback_DMA。 他们甚至没有来自 SPICLK 的信号!!!

这是我的代码:

void SPI_Init(void)
{
    //GPIO58
    GpioCtrlRegs.GPBGMUX2.bit.GPIO58=3;
    GpioCtrlRegs.GPBMUX2.bit.GPIO58=3;
    GpioCtrlRegs.GPBDIR.bit.GPIO58=1;
    GpioCtrlRegs.GPBPUD.bit.GPIO58=0;
    GpioCtrlRegs.GPBODR.bit.GPIO58=1;
    //GPIO59
    GpioCtrlRegs.GPBGMUX2.bit.GPIO59=3;
    GpioCtrlRegs.GPBMUX2.bit.GPIO59=3;
    GpioCtrlRegs.GPBDIR.bit.GPIO59=0;
    GpioCtrlRegs.GPBPUD.bit.GPIO59=0;
    //GPIO60
    GpioCtrlRegs.GPBGMUX2.bit.GPIO60=3;
    GpioCtrlRegs.GPBMUX2.bit.GPIO60=3;
    GpioCtrlRegs.GPBDIR.bit.GPIO60=1;
    GpioCtrlRegs.GPBPUD.bit.GPIO60=0;
    GpioCtrlRegs.GPBODR.bit.GPIO60=1;
    //GPIO61
    GpioCtrlRegs.GPBGMUX2.bit.GPIO61=3;
    GpioCtrlRegs.GPBMUX2.bit.GPIO61=3;
    GpioCtrlRegs.GPBDIR.bit.GPIO61=1;
    GpioCtrlRegs.GPBPUD.bit.GPIO61=0;
    GpioCtrlRegs.GPBODR.bit.GPIO61=1;


    SpiaRegs.SPICCR.bit.SPISWRESET=0;
    SpiaRegs.SPICCR.bit.CLKPOLARITY=0;
    SpiaRegs.SPICCR.bit.SPICHAR=7;
    SpiaRegs.SPICTL.bit.CLK_PHASE=0;
    SpiaRegs.SPICTL.bit.MASTER_SLAVE=1;
    SpiaRegs.SPICTL.bit.TALK=1;
    SpiaRegs.SPIBRR.bit.SPI_BIT_RATE=99;
    SpiaRegs.SPICCR.bit.SPISWRESET=1;

}

unsigned char SPI_WriteRead(unsigned char in)
{
    SpiaRegs.SPITXBUF=in;
    while(SpiaRegs.SPISTS.bit.INT_FLAG!=1);
    return SpiaRegs.SPIRXBUF;
}
void main(void)
{
//
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the F2837xD_SysCtrl.c file.
//
   InitSysCtrl();

#ifdef _STANDALONE
#ifdef _FLASH
//
// Send boot command to allow the CPU2 application to begin execution
//
IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);
#else
//
// Send boot command to allow the CPU2 application to begin execution
//
IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_RAM);
#endif
#endif

//
// Call Flash Initialization to setup flash waitstates
// This function must reside in RAM
//
#ifdef _FLASH
   InitFlash();
#endif

//
// Step 2. Initialize GPIO:
// This example function is found in the F2837xD_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
//
    InitGpio(); // Skipped for this example
    InitPieCtrl();
    InitPieVectTable();
    EALLOW;
//    SCIB_GPIO18_GPIO19_Init();
//    PWM_Init();
    SPI_Init();

//
// TODO Add code to allow configuration of GPADIR from CPU02 using IPC
//
    EDIS;


//
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
//
    DINT;

//
// Initialize the 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();

//
// Disable CPU interrupts and clear all CPU interrupt flags:
//
//    IER = 0x100;
    IER = 0x0000;
//    IFR = 0x0000;

//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example.  This is useful for debug purposes.
// The shell ISR routines are found in F2837xD_DefaultIsr.c.
// This function is found in F2837xD_PieVect.c.
//
//    InitPieVectTable();

//
// Enable global Interrupts and higher priority real-time debug events:
//
    EINT;  // Enable Global interrupt INTM
    ERTM;  // Enable Global realtime interrupt DBGM
    char temp[6],i;
//
// Step 6. IDLE loop. Just sit and loop forever (optional):
    for(;;)
    {
        DELAY_US(1000);
        GpioDataRegs.GPBCLEAR.bit.GPIO61=1;
        SPI_WriteRead(0x02|0x80);
        for(i=0;i<6;i++)
        {
            temp[i]=SPI_WriteRead(0xff);
        }
        GpioDataRegs.GPBSET.bit.GPIO61=1;
    }
}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,

    我建议如下:

    1.通过检查 CCS 中的设备 regs,确保 GPIO 配置生效。

    2.检查 SPI 环回模式是否已禁用(SPICCR.SPILBK = 0)。 注:我相信大多数 C2000ware 示例都使用内部环回模式。

    3.检查 SPI 模块时钟是否已启用(应在 InitSysCtrl 中完成)。  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    现在我知道了 MOSI 无信号的原因,就是 TXBUF 没有被合理化。

    但新的问题不是来自错误的信号  

    我禁用了所有示例的环回功能,但没有一个示例可以正常运行.....

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [引用 userid="411692" url="~/support/icles/c2000-iclers-group/c2f/c2000-微控制器-forume/1071788/tms320f28379d-no-signate-output-ffrom -spiasimi/3971592#3971592"]我现在知道 MOXBF/USI 没有信号的原因[引用]。

    是的,当使用小于16位的数据时,您必须在写入 TXBUF 时对数据进行对齐。

    [引用 userid="411692" url="~/support/icros/c2000-icroms-group/c2f/c2000-微控制器-forume/1071788/tms320f28379d-no-signate-output-ffrom -spiasimo/3971592#3971592"],但新问题不是来自错误 的信号

    您的代码是否一直在等待 INT_FLAG =1? 或者 SPIRXBUF 中的数据始终为0? 您的设置上的 miso 针脚连接了什么?  

    [引用 userid="411692" url="~/support/icros/c2000-icroms-group/c2f/c2000-微控制器-forume/1071788/tms320f28379d-no-signate-output-ffrom -spiasimi/3971592#3971592">,我禁用了所有示例的环回功能,但无法正常运行 [/引用]

    如果在示例代码上禁用环回,则必须提供外部环回,即向 MOSI 提供错误。