I'm trying to connect a TLV5616 to the lm4f120 launch pad via SSI. I'm getting no errors when running the code, but I'm also not getting any output. I'm using the 3.3V out from J1 and the gnd from J3 for Vdd and Gnd for the 5616. I have a simple voltage divider for Aref. I have SSI0TX connected to DIN, SSI0CLK connected to SCLK, and SSI0FSS connected to FS. The CS pin on the tlv5616 is tied low.
On the output side, I have tried connected OUT to both a 4.7k resistor and an LED to ground and also a simple LED driver (4.7k to 2n3904 base, emitter to gnd, collector to LED to 2k).
My code simply ramps the output from 0 up to 4095 and back down again. I'd expect to see the LED pulse, but I'm getting nothing. I've verified Vdd and Aref with my multimeter (3.3v, 1.65v as expected).
Have I made an error in my code? Since the 5616 wants a falling clock edge to transfer the data, I'm using Mode 1, but I've tried other modes with no effect. I've verified in CCS that the output I'm trying to write does increment and go back down again. I did notice that the result of SSIDataPutNonBlocking always appeared to be 0, unless I stepped into it and then it came back 1. Even in the 0 case I examined the SSI registers and saw that the transmit FIFO was not full. It showed empty at the time, too, but the output is clocked so high that it would have emptied by the time I observed it.
Here's the code from main:
ROM_FPUEnable(); ROM_FPULazyStackingEnable(); // // Set the clocking to run directly from the crystal. //80 MHz? // ROM_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); // // Initialize the UART. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_GPIOPinConfigure(GPIO_PA0_U0RX); ROM_GPIOPinConfigure(GPIO_PA1_U0TX); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTStdioInit(0); // // Hello! // UARTprintf("Hello, world!\n"); RGBInit(0); RGBSet(COLOR_RED, 1.0f); RGBEnable(); // init ssi SysCtlPeripheralEnable(SYSCTL_PERIPH2_SSI0); GPIOPinConfigure(GPIO_PA5_SSI0TX); GPIOPinConfigure(GPIO_PA2_SSI0CLK); GPIOPinConfigure(GPIO_PA3_SSI0FSS); GPIOPinConfigure(GPIO_PA4_SSI0RX); // SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_1, // SSI_MODE_MASTER, 20000000, 16); SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_1, SSI_MODE_MASTER, 10000000, 16); SSIEnable(SSI0_BASE); float intensity = 0; float increment = 0.1; unsigned long * color = (SysCtlClockGet() == 80000000 ? COLOR_BLUE : COLOR_RED); unsigned short spiData = 0; short spiIncrement = 400; long entriesWritten = 0; while(1) { RGBSet(color, intensity); entriesWritten = SSIDataPutNonBlocking(SSI0_BASE, 0x4000 | spiData); if(entriesWritten == 0) { //a bad thing } //SSIDataPut(SSI0_BASE, 0x4000 | spiData); //SSIDataPut(SSI0_BASE, spiData); // // Delay for a bit. // SysCtlDelay(SysCtlClockGet() / 80); // 10 / 3 intensity += increment; if((intensity >= 1.0) || (intensity <= 0)) { increment *= -1; } spiData += spiIncrement; if((spiData >= 4000) || (spiData <= 0)) { spiIncrement *= -1; } }