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.
Dear TIVA Users,
I'm trying to configure the SSI0 port for using SPI as a slave.
The weird thing is, SSIConfigSetExpClk hangs when executed.
Another weird thing is this only occurs when using Keil. The code works properly in Eclipse using the gcc-arm cross compilier
The link below had a similar problem which was resolved by changing SysCtlClockSet to SysCtlClockFreqSet.
https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/313814
I'm using the TM4C1294XL board.
#include <stdbool.h> #include <stdint.h> #include "inc/hw_memmap.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/ssi.h" #include "driverlib/sysctl.h" #include "driverlib/uart.h" #include "utils/uartstdio.h" void InitConsole(void) { SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTStdioConfig(0, 115200, 16000000); } void SystemInit(){} int main(void) { //SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | // SYSCTL_XTAL_16MHZ); SysCtlClockFreqSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ, 10000000); InitConsole(); SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinConfigure(GPIO_PA2_SSI0CLK); GPIOPinConfigure(GPIO_PA3_SSI0FSS); GPIOPinConfigure(GPIO_PA4_SSI0XDAT0); GPIOPinConfigure(GPIO_PA5_SSI0XDAT1); GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2); UARTprintf("test 1\n"); volatile uint32_t test = SysCtlClockGet(); SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_SLAVE, 1000000, 8); UARTprintf("test 2\n"); //never gets here SSIEnable(SSI0_BASE); uint32_t temp = 0; while(SSIDataGetNonBlocking(SSI0_BASE, &temp)) { } while(1) { SSIDataGet(SSI0_BASE, &temp); temp &= 0x00FF; switch(temp) { case 'M': SSIDataPut(SSI0_BASE, 'S'); break; case 'A': SSIDataPut(SSI0_BASE, 'L'); break; case 'S': SSIDataPut(SSI0_BASE, 'A'); break; case 'T': SSIDataPut(SSI0_BASE, 'V'); break; case 'R': SSIDataPut(SSI0_BASE, 'E'); break; } } }