I am trying to use a TM4C123GXL to control an AD5206 digital potentiometer, but I can't get the spi communication to work.
Could you help me with this issue? Here is my test code that is supposed to cycle all the digipots from low to high.
#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"
int main(void)
{
uint32_t channel;
uint32_t level;
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE,GPIO_PIN_3);
GPIOPinConfigure(GPIO_PA5_SSI0TX);
GPIOPinTypeSSI(GPIO_PORTA_BASE,GPIO_PIN_5|GPIO_PIN_3|GPIO_PIN_2);
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 10000, 8);
SSIEnable(SSI0_BASE);
while(1)
{
for (channel = 0; channel < 6; channel++)
{
for (level = 0; level < 255; level++)
{
GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_3,0x00);
SSIDataPut(SSI0_BASE, channel);
SSIDataPut(SSI0_BASE, level);
GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_3,0x40);
while(SSIBusy(SSI0_BASE))
{
}
}
}
}
}
Thanks,
Gerald