Hi, guys. I just get started using TM4C and I am trying to initialize a function generator chip AD9833. I followed the application notes AN-1070 provided by analog device. These are five sets of data I need write to AD9833 to initialized it, and it should give me a 400Hz sine wave out.
dataTx[0] = 0x2100;
dataTx[1] = 0x50C7;
dataTx[2] = 0x4000;
dataTx[3] = 0xC000;
dataTx[4] = 0x2000;
I used UART to test my writing data, it is correct, but the AD9833 doesn't give me any output. Here is my code, hope someone can give me some advice where things might go wrong. I just modified a SPI code from online.
/*
* main.c
*/
// SPI
#define PIN_SSI_CLK GPIO_PIN_4
#define PIN_SSI_FSS GPIO_PIN_5
#define PIN_SSI_TX GPIO_PIN_7
#define GPIO_SSI_BASE GPIO_PORTB_BASE
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_ssi.h"
#include "inc/hw_types.h"
#include "driverlib/ssi.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "utils/uartstdio.h"
int main(void) {
uint32_t dataTx[5];
uint32_t index;
// configure clock
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_PLL |SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
// configure SPI 2 on GPIO Port B
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
// configure SPI 2
GPIOPinConfigure(GPIO_PB4_SSI2CLK);
GPIOPinConfigure(GPIO_PB5_SSI2FSS);
GPIOPinConfigure(GPIO_PB6_SSI2RX);
GPIOPinConfigure(GPIO_PB7_SSI2TX);
GPIOPinTypeSSI(GPIO_SSI_BASE,PIN_SSI_CLK |PIN_SSI_FSS |PIN_SSI_TX);
// enable SPI 2
SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 16);
SSIEnable(SSI2_BASE);
// initialize data
dataTx[0] = 0x2100;
dataTx[1] = 0x50C7;
dataTx[2] = 0x4000;
dataTx[3] = 0xC000;
dataTx[4] = 0x2000;
for(index = 0; index < 5; index++){
SSIDataPut(SSI2_BASE, dataTx[index]);
}
while(SSIBusy(SSI2_BASE)) // waiting if data is sent
{
}
while(1)
{
}
}







