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/TM4C123GH6PM: Problem with SSI clock

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

Hello,

I try to configurate SSI (SPI) but without success. I have problem with clock signal. I try with different SSI base (SSI0_BASE and SSI2_BASE) and I got same result, clock is 0 all the time. When I put oscilloscope on clock, result is same, always 0. Here is code :

#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "hw_memmap.h"
#include "hw_types.h"
#include "hw_gpio.h"
#include "debug.h"
#include "rom.h"
#include "sysctl.h"
#include "gpio.h"
#include "rom_map.h"
#include "abi_prefix.h"
#include "crc_defines.h"
#include "rtos_bindings.h"
#include "fpu.h"
#include "adc.h"
#include "aes.h"
#include "arm_acle.h"
#include "assert.h"
#include "can.h"
#include "comp.h"
#include "complex.h"
#include "cpu.h"
#include "cpy_tbl.h"
#include "crc.h"
#include "ctype.h"
#include "des.h"
#include "etsi.h"
#include "interrupt.h"
#include "inttypes.h"
#include "lcd.h"
#include "iso646.h"
#include "limits.h"
#include "lowlev.h"
#include "locale.h"
#include "mpu.h"
#include "onewire.h"
#include "pprof.h"
#include "pin_map.h"
#include "stdio.h"
#include "stdnoreturn.h"
#include "stdlib.h"
#include "sysexc.h"
#include "signal.h"
#include "shamd5.h"
#include "tm4c123gh6pm.h"
#include "i2c.h"
#include "time.h"
#include "timer.h"
#include "pwm.h"
#include "uart.h"
#include "hw_uart.h"
#include "ssi.h"
#include "hw_ssi.h"

void Init_SSI_2(void){
    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);

    GPIOPinConfigure(GPIO_PB4_SSI2CLK);
    GPIOPinConfigure(GPIO_PB5_SSI2FSS);
    GPIOPinConfigure(GPIO_PB6_SSI2RX);
    GPIOPinConfigure(GPIO_PB7_SSI2TX);

    GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);

    SSIDisable(SSI2_BASE);
    SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
    SSIEnable(SSI2_BASE);
}

void main(void){
    SysCtlClockSet(SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ | SYSCTL_SYSDIV_4); // clock set 50MHz
    Init_SSI_2();
    while(1){
if(GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_4) == GPIO_PIN_4){
            GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_PIN_1);
             SysCtlDelay(50000000);
             GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, ~GPIO_PIN_1);
             SysCtlDelay(50000000);
        }
} }

  • Hi Milan,

      You only initialize the SSI module. In order to start a SPI transmission you must write data to the SPI FIFO. Once the FIFO is written the transmission will start. I don't see you calling SSIDataPut() to start the transmission. Once you call SSIDataPut() you should see SPICLK. Please also refer to the TivaWare SSI example under <TivaWare_Installation>/examples/peripherals/ssi.