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/TM4C1294NCPDT: SSI problem on TM4C1294NCPDT

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: EK-TM4C1294XL, EK-TM4C123GXL

Tool/software: Code Composer Studio

I have some problems on SSI of TM4C1294NCPDT on Tiva™ EK-TM4C1294XL Launchpad. The SSI is set as master, when transmitting data, the SSI do not work. The pin clock (PA2) do not change. I use the code provided by TI workshop as below. When running to the code 'SSIDataPut(SSI0_BASE, ui32Data)', all the SSI pins on chip do not change, and the register of SSIDR always stays zero. Could you please help me to figure out the problem. Thanks in advance...

#include <stdint.h>

#include <stdbool.h>

#include "inc/hw_memmap.h"

#include "inc/hw_ssi.h"

#include "inc/hw_types.h"

#include "driverlib/ssi.h"

#include "driverlib/gpio.h"

#include "driverlib/pin_map.h"

#include "driverlib/sysctl.h"

uint32_t ui32SysClkFreq;

#define NUM_SSI_DATA 8

const uint8_t pui8DataTx[NUM_SSI_DATA] =

{0x88, 0xF8, 0xF8, 0x88, 0x01, 0x1F, 0x1F, 0x01};

// Bit-wise reverses a number.

uint8_t

Reverse(uint8_t ui8Number)

{

uint8_t ui8Index;

uint8_t ui8ReversedNumber = 0;

for(ui8Index=0; ui8Index<8; ui8Index++)

{

ui8ReversedNumber = ui8ReversedNumber << 1;

ui8ReversedNumber |= ((1 << ui8Index) & ui8Number) >> ui8Index;

}

return ui8ReversedNumber;

}

int main(void)

{

uint32_t ui32Index;

uint32_t ui32Data;

ui32SysClkFreq = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);

SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

GPIOPinConfigure(GPIO_PA2_SSI0CLK);

GPIOPinConfigure(GPIO_PA3_SSI0FSS);

GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);

GPIOPinTypeSSI(GPIO_PORTA_BASE,GPIO_PIN_4|GPIO_PIN_3|GPIO_PIN_2);

SSIConfigSetExpClk(SSI0_BASE, ui32SysClkFreq, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 10000, 16);

SSIEnable(SSI0_BASE);

while(1)

{

for(ui32Index = 0; ui32Index < NUM_SSI_DATA; ui32Index++)

{

ui32Data = (Reverse(pui8DataTx[ui32Index]) << 8) + (1 << ui32Index);

SSIDataPut(SSI0_BASE, ui32Data);

while(SSIBusy(SSI0_BASE))

{

}

}

}

}

  • Hi Faith,
    Were you using the workshop for TM4C123? I don't really see a problem with your code. I just run the ssi example from the <TivaWare_Installation>/peripherals/ssi/spi_master.c and I don't see any issue. Can you try this example? I will suggest you first import the CCS project hello from <TivaWare_Installation>/examples/boards/ek-tm4c1294xl/hello and then replace the hello.c with the spi_master.c. This will make sure you have all the correct include files for setting for TM4C129.
  • Hi Charles,

    The example that I used (lab-9) is from Creating IoT Solutions with the Tiva® C Series Connected LaunchPad Workshop and it is for TM4C1294XL. I run spi_master.c before actually but it did not work too.

    I see your point. I was going to do that but I realized that the "boards" file has only for TM4C123 in my following directory

    C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c123gxl\hello

    However I did a similar thing using the workshop labs (lab9 for spi). I imported that one but it did not work too. Where should I do to import <TivaWare_Installation>/examples/boards/ek-tm4c1294xl/hello ??
  • Hi Fatih,

     It seems to me that you did not have the correct TivaWare installed per your device. You will see <TivaWare_Installation>/examples/boards/ek-tm4c1294xl/hello if you install the TivaWare for TM4C129 properly.

     First go to and click on the 'Get Software'.

    Next click on either one of the highlighted in yellow. 

    If you want to install the complete TivaWare which includes both the TM4C123 and TM4C129 and as well as all the libraries then you will click on the second one that says "SW-TM4C-2.1.4.178.exe" 

  • Hi Charles,

    I did exactly what you suggested. When I run the code I had these error:

    #20 identifier "GPIO_PA4_SSI0RX" is undefined hello.c /hello line 204 C/C++ Problem
    #20 identifier "GPIO_PA5_SSI0TX" is undefined hello.c /hello line 205 C/C++ Problem

    Did you also get the same errors?
  • I solved the error changing them as following:

    GPIOPinConfigure(GPIO_PA4_SSI0XDAT0); // SSI Module 0 Bi-directional Data Pin 0 (SSI0TX in Legacy SSI Mode).
    GPIOPinConfigure(GPIO_PA5_SSI0XDAT1); // SSI Module 0 Bi-directional Data Pin 1 (SSI0RX in Legacy SSI Mode).

    However, it did not still work I can see the clock signal at GPIO pin 2. SSI_DR is always zero.
  • Hi,
    The DR register is used for both the receive and the transmit FIFO. When you write to the DR register you write to the FIFO. When you read from the DR register you will read from the receive FIFO. What is connected to the PA5 pin? Is your slave returning data? Please use the scope to capture both the PA4 and PA5 pins. For testing purpose, you can even connect the PA5 and PA4 together to form a loop back. You should see what you transmitted to be received in the receive FIFO.
  • Hi Charles, 

    The PA5 was not connected actually but at least I was hoping to see clocking sequence from PA2 every time when SSIDataPut is executed.

    I shorted the PA4 and PA5 as you suggested but still I can not read any value in DR register. 

    Another thing that I realized is that SSI_RIS becomes 0x00000048 at the first execution of SSIDataPut and then stays as it is.

  • Hi,
    Earlier you were saying you were seeing the SPICLK on the PA2? Are you still seeing the clock? Why are you not connecting PA4 and PA5 to the logic analyzer? I also don't see you looping back PA4 to PA5 in your picture.

    Why don't you try writing a fixed value to the DR register. Do something like SSIDataPut(SSI0_BASE, 0x55);
  • Hi,

    I was not seeing the clocking earlier too but I figured out why. I was connecting wrong wire from logic analyzer. I have never thought that could be the issue after observing that DR does not change at all.

    But at least I had the correct TivaWare installed now and it is working pretty well.

    Thanks Charles..

  • I just run your code, not even touching a line and it works and I'm seeing both the SPICLK and SPITX on PA2 and PA4. Why don't you use a scope to capture the pins instead of logic analyzer. Sometimes, the LA is not fast enough to capture fast switching signals. You can also try to lower your SPICLK baudrate and see if your LA can capture them. In any case, I can see the SPICLK and SPITX on my bench running your exact program.