Hi...
i'm interfacing ltc2440(24 bit ADC) with spi of tm4c123gh6pz ...i'm checking the clock in oscilloscope but i'm not getting any clock pulses..i don't known wheather the communication configuration is wrong or rite..please help me.
my code is (XTAL = 8MHZ)
#include <string.h>
#include "inc/lm4f232h5qc.h"
#include "inc/hw_memmap.h"
#include "driverlib/pin_map.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "utils/softssi.h"
#include "utils/uartstdio.h"
#include "driverlib/rom.h"
#include "driverlib/ssi.h"
#include "inc/hw_gpio.h"
//#define NUM_SSI_DATA 4
#define GPIO_PK0_SSI3CLK 0x00090002
#define GPIO_PK1_SSI3FSS 0x00090402
#define GPIO_PK2_SSI3RX 0x00090802
//#define GPIO_PK3_SSI3TX 0x00090C02
// Number of bytes to send and receive used in the ulDataTx and ulDataRx arrays, this will equal 2 bytes
#define NUM_SSI_DATA 4
//unsigned long ulDataTx[NUM_SSI_DATA]; // An array of 2 data bytes to be Tx
unsigned long ulDataRx[NUM_SSI_DATA]; // An array of 4 data bytes to be Rx
unsigned long ulindex; // Used to count the number of bytes Tx or Rx
void system_peripheral_set();
//long SpiRead();
//*****************************************************************************
//
// The error routine that is called if the driver library encounters an error.
//
//*****************************************************************************
#ifdef DEBUG
void
__error__(char *pcFilename, unsigned long ulLine)
{
}
#endif
//const int nsamples = 5; // how many ADC readings to average together
unsigned long clock1 ;
int main(void)
{
system_peripheral_set();
clock1 = SSIClockSourceGet(SSI_CLOCK_SYSTEM);
while(1)
{
// while(SSIDataGetNonBlocking(SSI0_BASE, &ulDataRx[0])) {}
GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_1, 0x00);
for(ulindex = 0; ulindex < NUM_SSI_DATA; ulindex++)
{
// Receive the data using the "blocking" get function.
SSIDataGet(SSI3_BASE, &ulDataRx[ulindex]);
while(SSIBusy(SSI3_BASE)){}
}
GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_1, 0x08);
}
}
void system_peripheral_set()
{
// The SSI0 peripheral must be enabled for use.
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_XTAL_8MHZ | SYSCTL_OSC_MAIN); //8MHZ
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
//GPIO port A needs to be enabled so these pins can be used.
// TODO: change this to whichever GPIO port you are using.
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
// Configure the pin muxing for SSI0 functions on port A2, A3, A4, and A5.
// This step is not necessary if your part does not support pin muxing.
// TODO: change this to select the port/pin you are using.
GPIOPinConfigure(GPIO_PK0_SSI3CLK);
GPIOPinConfigure(GPIO_PK1_SSI3FSS);
GPIOPinConfigure(GPIO_PK2_SSI3RX);
GPIOPinTypeSSI(GPIO_PORTK_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2);
GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_0|GPIO_PIN_1);
GPIOPinTypeGPIOInput(GPIO_PORTK_BASE, GPIO_PIN_2);
GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_3, 0x08);
// Configure and enable the SSI port for SPI master mode. Use SSI0,
// system clock supply, idle clock level low and active low clock in
// freescale SPI mode, master mode, 1MHz SSI frequency, and 8-bit data.
SSIConfigSetExpClk(SSI3_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
SSI_MODE_MASTER, SysCtlClockGet()/8, 16);
// Enable the SSI0 module.
SSIEnable(SSI3_BASE);
}
Thanks in advance