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.

TM4C1294KCPDT SPI Interface Chip select issue

Other Parts Discussed in Thread: TM4C1294KCPDT

Hi,

We are using TM4C1294KCPDT micro controller in our project.


we are using SPI bus 0 for interface.

Slave is not getting selected by using SSI0FSS chip select.

We are using GPIO as chip select & SPI interface is working fine.

Why can't we use SPI interface chip select pin SSI0FSS as chip select?

  • Hello Vinod,

    Please share your code for the same?

    Regards
    Amit
  • See attached Code

    #define SPI_CLOCK_FREQUENCY		(250000)
    #define SYSTEM_CLOCK_FREQUENCY	(120000000)
    
    void ssi_initialize()
    {
    	uint32_t i;
    
    	ssi_ss_gpio_initialize();
    	
    	// Enable the system clock gating
    	ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
    	ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    	ROM_SysCtlDelay(25);
    
    	// Pin type is set to alternate SSI function
    	ROM_GPIOPinConfigure(GPIO_PA2_SSI0CLK);
    	ROM_GPIOPinConfigure(GPIO_PA3_SSI0FSS);
    	ROM_GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);
    	ROM_GPIOPinConfigure(GPIO_PA5_SSI0XDAT1);
    	ROM_GPIOPinTypeSSI(GPIO_PORTA_BASE, (GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5));
    	
    	// Enable the clock to the SSI
    	ROM_SSIClockSourceSet(SSI0_BASE, SSI_CLOCK_SYSTEM);
    	
    	// CPOL = 1, CPHA = 1 Clock=160kHz
    	ROM_SSIConfigSetExpClk(SSI0_BASE, SYSTEM_CLOCK_FREQUENCY, SSI_FRF_MOTO_MODE_3, SSI_MODE_MASTER, SPI_CLOCK_FREQUENCY, 8);
    
    	// Enable the peripheral
    	ROM_SSIEnable(SSI0_BASE);
    
    	while(ROM_SSIDataGetNonBlocking(SSI0_BASE, &i))
    	{
    	}
    }
    
    /*
    	Initialises the GPIO as an output for SS
    */
    void ssi_ss_gpio_initialize()
    {
    		ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    		ROM_GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_5);
    		ROM_GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_5, GPIO_PIN_5);
    }

  • Hello Vinod,

    The SSI module works by pushing data to receive data (see datasheet description). So if you want to get a byte of data then you would have to write a dummy byte.

    Regards
    Amit
  • Hi Amit,

    We are doing same way as mentioned "pushing data to receive data".

    When we use GPIO as chip select, Slave is able to communicate.

    Is there any timing issue which is not able to generated by SS pin?

  • Hello Vinod,

    Or it could be that the Slave expects a longer CS before the SCLK is given. Did you check the CS to SCLK edge duration on the slave device?

    Regards
    Amit
  • Hi Amit,

     We have checked CS & CLK pin.

    It is edge synchronized.

  • Hello Vinod,

    That is fine, but is there a timing requirement of time between CS and SCLK pin on the Slave device.

    Regards
    Amit