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.

CCS/TMS320F28379D: CCS/TMS320F28379D

Part Number: TMS320F28379D
Other Parts Discussed in Thread: DRV8711, , TMS320F28035, LAUNCHXL-F28379D

Tool/software: Code Composer Studio

Hello,

I have doing a small SPI test between F28035 as Master and F28379DZ as slave. My connections are SIMO of Master to SIMO of Slave, SCLK of master to SCLK of slave, SPISTE of master to SPISTE of slave. The two boards share the common ground. The voltage across all SPI connections are 3.3V.

Master code:

Uint16 sdata= 0x0001;

for(;;)

{
SpiaRegs.SPITXBUF=sdata;
while(SpiaRegs.SPIFFRX.bit.RXFFST !=1) { }

sdata++;
delay_loop();
}

void delay_loop()
{
long i;
for (i = 0; i < 10000000; i++) {}
}

void spi_fifo_init()
{
// Initialize SPI FIFO registers
SpiaRegs.SPICCR.bit.SPISWRESET=0; // Reset SPI

SpiaRegs.SPICCR.all=0x000F; //16-bit character, Loopback mode
SpiaRegs.SPICTL.all=0x0017; //Interrupt enabled, Master/Slave XMIT enabled
SpiaRegs.SPISTS.all=0x0000;
SpiaRegs.SPIBRR=0x0063; // Baud rate
SpiaRegs.SPIFFTX.all=0xC022; // Enable FIFO's, set TX FIFO level to 4
SpiaRegs.SPIFFRX.all=0x0022; // Set RX FIFO level to 4
SpiaRegs.SPIFFCT.all=0x00;
SpiaRegs.SPIPRI.all=0x0010;

SpiaRegs.SPICCR.bit.SPISWRESET=1; // Enable SPI

SpiaRegs.SPIFFTX.bit.TXFIFO=1;
SpiaRegs.SPIFFRX.bit.RXFIFORESET=1;
}

Slave code: 

void spi_fifo_init()
{
// Initialize SPI FIFO registers
SpiaRegs.SPICCR.bit.SPISWRESET=0; // Reset SPI
SpiaRegs.SPICCR.all=0x000F; //16-bit character, Loopback mode
SpiaRegs.SPICTL.all=0x0013; //Interrupt enabled, Master/Slave XMIT enabled
SpiaRegs.SPISTS.all=0x0000;
SpiaRegs.SPIBRR.all=0x0063; // Baud rate
SpiaRegs.SPIFFTX.all=0xC022; // Enable FIFO's, set TX FIFO level to 4
SpiaRegs.SPIFFRX.all=0x0022; // Set RX FIFO level to 4
SpiaRegs.SPIFFCT.all=0x0000;
SpiaRegs.SPIPRI.all=0x0010;
SpiaRegs.SPICCR.bit.SPISWRESET=1; // Enable SPI
SpiaRegs.SPIFFTX.bit.TXFIFO=1;
SpiaRegs.SPIFFRX.bit.RXFIFORESET=1;
}

interrupt void spiRxFifoIsr(void)
{
rdata=SpiaRegs.SPIRXBUF; // Read data

SpiaRegs.SPIFFRX.bit.RXFFOVFCLR=1; // Clear Overflow flag
SpiaRegs.SPIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x20; // Issue PIE ack
}

//////////////////////////////////////////////////////////////////////////////////////////////////////

The master code (F28035) waits on the while(SpiaRegs.SPIFFRX.bit.RXFFST!=1){} loop forever and the slave code never receives anything in rdata. 

Signals are all 3.3 V on the Picoscope forever. Previously I was working on driving DRV8711 using F28035 and the same SPI coding worked for me. 

Am I missing something here? Maybe on the connections?

Thank you,

Nikit shah 

  • This is SPI pin config for Launchpad TMS320F28379D (SLAVE)

    void InitSpibGpio()
    {

    EALLOW;

    GpioCtrlRegs.GPBPUD.bit.GPIO63 = 0; // Enable pull-up on GPIO63 (SPISIMOB)
    GpioCtrlRegs.GPCPUD.bit.GPIO64 = 0; // Enable pull-up on GPIO64 (SPISOMIB
    GpioCtrlRegs.GPCPUD.bit.GPIO65 = 0; // Enable pull-up on GPIO65 (SPICLKB)
    GpioCtrlRegs.GPCPUD.bit.GPIO66 = 1; // Enable pull-up on GPIO66 (SPISTEB)

    GpioCtrlRegs.GPBQSEL2.bit.GPIO63 = 3; // Asynch input GPIO63 (SPISIMOB)
    GpioCtrlRegs.GPCQSEL1.bit.GPIO64 = 3; // Asynch input GPIO64 (SPISOMIB)
    GpioCtrlRegs.GPCQSEL1.bit.GPIO65 = 3; // Asynch input GPIO65 (SPICLKB)
    GpioCtrlRegs.GPCQSEL1.bit.GPIO66 = 3; // Asynch input GPIO66 (SPISTEB)

    GpioCtrlRegs.GPBMUX2.bit.GPIO63 = 15; // Configure GPIO63 as SPISIMOB
    GpioCtrlRegs.GPCMUX1.bit.GPIO64 = 15; // Configure GPIO64 as SPISOMIB
    GpioCtrlRegs.GPCMUX1.bit.GPIO65 = 15; // Configure GPIO65 as SPICLKB
    GpioCtrlRegs.GPCMUX1.bit.GPIO66 = 15; // Configure GPIO66 as SPISTEB

    EDIS;
    }

    This is SPI pin config for TMS320F28035 (MASTER)

    void InitSpiaGpio()
    {

    EALLOW;

    GpioCtrlRegs.GPAPUD.bit.GPIO16 = 0; // Enable pull-up on GPIO16 (SPISIMOA)
    GpioCtrlRegs.GPAPUD.bit.GPIO17 = 0; // Enable pull-up on GPIO17 (SPISOMIA)
    GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0; // Enable pull-up on GPIO18 (SPICLKA)
    GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0; // Enable pull-up on GPIO19 (SPISTEA)

    GpioCtrlRegs.GPAQSEL2.bit.GPIO16 = 3; // Asynch input GPIO16 (SPISIMOA)
    GpioCtrlRegs.GPAQSEL2.bit.GPIO17 = 3; // Asynch input GPIO17 (SPISOMIA)
    GpioCtrlRegs.GPAQSEL2.bit.GPIO18 = 3; // Asynch input GPIO18 (SPICLKA)
    GpioCtrlRegs.GPAQSEL2.bit.GPIO19 = 3; // Asynch input GPIO19 (SPISTEA)

    GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 1; // Configure GPIO16 as SPISIMOA
    GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 1; // Configure GPIO17 as SPISOMIA
    GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 1; // Configure GPIO18 as SPICLKA
    GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 1; // Configure GPIO19 as SPISTEA

    EDIS;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    I am able to send data from F28035 but not able to catch any on the Launchpad. The below doc contains the waveform where blue is clock, gold is chip select and green is MOSI. These signals are 3.3 V when just the Master is operating as soon as the slave is connected and ready the signals are dropped to 2.3 V. I tried pulling up the signals on the slave to 3.3 V using 1K ohm resistor. But the results are still the same. I am not able to understand what is causing my slave to not read data. 

    waveform .docx

  • Hi Nikit,

    Can you confirm which Launchpad you are using (send exact part number if possible)?  On the F28377S launchpad we had some known problems with some of the specific pins you are trying to use.  I suspect it is probably the same thing going on here. 

    Here is a thread (skip to the end for the answer details) on issues with GPIO63/65.

    Regards,

    Kris

  • C2000 Launchpad XL TMS320F28379D VER:1.1
  • Thank you.

    It looks like this launchpad has different GPIOs on the level shifter so it's likely not the same issue. The waveform you sent appears to be when the F28035 is not connected to the slave device. Is that correct? If so, can you show us the waveform when it is attached?

    Regards,
    Kris
  • Here is the waveform with slave connected to f28035

    waveform with slave connected.docx

  • Nikit,

    Can you share a wiring diagram?
    You have mentioned that you have a LAUNCHXL-F28379D, but I am not sure what your F28035 is on. A basic schematic of how the boards/systems are connected would be fine. Please include power and ground connections and any other interface between the two boards.

    Thanks,
    Mark
  • They share common ground and 3.3 is provided by the Master.

    Thanks,
    Nikit shah
  • The voltage on the SPI signals at slave are dropped after InitSpiGpio() function.
    ///////////////////////////////////////
    {

    EALLOW;

    GpioCtrlRegs.GPBPUD.bit.GPIO63 = 0; // Enable pull-up on GPIO63 (SPISIMOB)
    GpioCtrlRegs.GPCPUD.bit.GPIO64 = 0; // Enable pull-up on GPIO64 (SPISOMIB
    GpioCtrlRegs.GPCPUD.bit.GPIO65 = 0; // Enable pull-up on GPIO65 (SPICLKB)
    GpioCtrlRegs.GPCPUD.bit.GPIO66 = 1; // Enable pull-up on GPIO66 (SPISTEB)

    GpioCtrlRegs.GPBQSEL2.bit.GPIO63 = 3; // Asynch input GPIO63 (SPISIMOB)
    GpioCtrlRegs.GPCQSEL1.bit.GPIO64 = 3; // Asynch input GPIO64 (SPISOMIB)
    GpioCtrlRegs.GPCQSEL1.bit.GPIO65 = 3; // Asynch input GPIO65 (SPICLKB)
    GpioCtrlRegs.GPCQSEL1.bit.GPIO66 = 3; // Asynch input GPIO66 (SPISTEB)

    GpioCtrlRegs.GPBMUX2.bit.GPIO63 = 15; // Configure GPIO63 as SPISIMOB
    GpioCtrlRegs.GPCMUX1.bit.GPIO64 = 15; // Configure GPIO64 as SPISOMIB
    GpioCtrlRegs.GPCMUX1.bit.GPIO65 = 15; // Configure GPIO65 as SPICLKB
    GpioCtrlRegs.GPCMUX1.bit.GPIO66 = 15; // Configure GPIO66 as SPISTEB

    EDIS;
    }
  • Nikit,

    Please look at your GPIO configuration for The F28379D. GPxMUXy cannot take '15' as a value. The maximum is 3. The GPIO mux of F2837x devices has two stages, a group mux (GPyGMUXy) and a mux (GPxMUXy). You must set GPxGMUXy before setting GPxMUXy. Basically, your code is not Setting the GPIOs correctly on the slave. Please fix that first.

    next, I would suggest making sure that the power supply on your master can provide enough to the slave. The F28379D has more power draw than the F2803x. Verify that you are not hitting a current limit on your power supply as well.

    I think that this is just contention on your GPIOs, but hopefully that is the issue. I am sorry that I did not catch that the first time you shared your GPIO code.

    -Mark

  • Mark,

    I completely ignored group MUX and the fact that GPxMUXy cannot take '15' as a value. Thank you so much, I got the SPI up and running.

    Thanks a lot,
    Nikit Shah