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: No signal output from SPIASIMO

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

My launchpad is C2000LaunchPad XL TMS28379D VER:2.0

I configure GPIO58~61 as SPIA's GPIO without FIFO and interrupt 

I can ensure that GPIO58~61 can run in right function because I used to configure them as common GPIO and blink external led right

I debug example :C2000Ware_4_00_00_00\device_support\f2837xd\examples\cpu1\spi_loopback_interrupts and spi_loopback_dma. They even have no signal from SPICLK!!!!

Here is my code:

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;
    }
}

  • Hi,

    I would recommend the following:

    1. Make sure you GPIO configuration is taking effect by checking the device regs in CCS.

    2. Check that SPI loopback mode is disabled (SPICCR.SPILBK = 0). Note: I believe most of the C2000ware examples use internal loopback mode.

    3. Check that the SPI module clock is enabled (should be done in InitSysCtrl). 

  • Now I got the cause of the no signal of MOSI is that TXBUF is left justified.

    But new problem is no signal from MISO 

    And I disabled loopback function of all the example but none of them can run normally.....

  • Now I got the cause of the no signal of MOSI is that TXBUF is left justified.

    Yes, when using data less than 16-bits you must left-justify the data when writing to the TXBUF.

    But new problem is no signal from MISO 

    Do you mean your code gets stuck waiting for INT_FLAG = 1? Or that the data in SPIRXBUF is always 0? What is connected to the MISO pin on your setup? 

    And I disabled loopback function of all the example but none of them can run normally.....

    If you disable loopback on the example code, you have to provide external loopback, i.e. MISO to MOSI.