Hi,
I am currently trying to set up the SSI module for SPI functionality to grab 8 bits at a time from external flash. I am also running at a desired 66.66MHz clock for a timer function. I have included a snippet of my code below of what I have initialized so far for SSI:
//Enable Peripherals used
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER3);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
///////////////////////////////// Pin Configurations //////////////////////////////////////
//Timer 3A
ROM_GPIOPinConfigure(GPIO_PB2_T3CCP0); //configure function of GPIO Pin (_P#_fucntion)
ROM_GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_2); //configures pin for use by timer
//Audio Amp
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_3); //Using AMP CTL* on board
ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_3, 0); //Must move resistor to use AMP CTL (PA4)
//SSI
ROM_GPIOPinTypeSSI(GPIO_PORTB_BASE, SSI_CLK | SSI_CS | SSI_RX | SSI_TX); //configures pins for SSI
ROM_GPIOPinConfigure(GPIO_PB4_SSI2CLK);
ROM_GPIOPinConfigure(GPIO_PB5_SSI2FSS);
ROM_GPIOPinConfigure(GPIO_PB6_SSI2RX);
ROM_GPIOPinConfigure(GPIO_PB7_SSI2TX);
//ROM_GPIODirModeSet(GPIO_PORTB_BASE, SSI_CLK, GPIO_DIR_MODE_OUT); //PB4 is output
//ROM_GPIODirModeSet(GPIO_PORTB_BASE, SSI_CS, GPIO_DIR_MODE_OUT); //PB5 is output
//ROM_GPIODirModeSet(GPIO_PORTB_BASE, SSI_TX, GPIO_DIR_MODE_OUT); //PB7 is output (transmit)
//ROM_GPIODirModeSet(GPIO_PORTB_BASE, SSI_RX, GPIO_DIR_MODE_IN); //PB6 is input (receive)
//////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// SSI Configuration //////////////////////////////////////
sysClock = ROM_SysCtlClockGet();
SSIConfigSetExpClk(SSI2_BASE, sysClock, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 333333, 8);
SSIAdvModeSet(SSI2_BASE, SSI_ADV_MODE_READ_WRITE); //mode where data is written/read from the slave
SSIAdvFrameHoldEnable(SSI2); //enables frame hold feature
SSIEnable(SSI2_BASE); //enable SPI module
/////////////////////////////////////////////////////////////////////////////////////////
My main concern is with the "SSIConfigSetExpClk()" function as I feel I do not fully understand its functionality. Particularly the bit rate and clock inputs.
I was hoping I could receive some insight into whether I have missed anything thus far in my initialization of the SSI module. I was also hoping to get some quidance as to how the input clock and bit rate values are determined for this function. Is the sysclock automatically the clock fed into the SSI module? Is there any division of it? How do you determine the bit rate you need?
Thanks,
Garrett