Hi, I'm getting a hard time trying to communicate with this digital potentiometer. I'm using a Tiva Launchpad TM4C123G. I'm still not quite familiar in establish this type of communication. But I did some code and I'd appreciate some guidance. I tested but I've got nothing.
This is what I've done:
void init_SSI(void)
{
void init_SSI(void)
{
//Enable SSIO Peripheral
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
//Enable GPIOA Peripheral
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//Configures the alternate function of a GPIO pin.
GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinConfigure(GPIO_PA3_SSI0FSS);
GPIOPinConfigure(GPIO_PA5_SSI0TX);
//Configures pin(s) for use by the SSI peripheral.
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5);
//Selects the advanced mode of operation for the SSI module.
SSIAdvModeSet(GPIO_PORTA_BASE, SSI_ADV_MODE_WRITE);
//Configures the synchronous serial interface.
SSIConfigSetExpClk(SSI0_BASE, 100000, SSI_FRF_MOTO_MODE_2, SSI_MODE_MASTER, 50000, 8);
//Enable the SSIO
SSIEnable(SSI0_BASE);
}
void Delay(unsigned long ulCount){
do{
ulCount--;
}while(ulCount);
}
void send_SSI(uint32_t dado)
{
SSIDataPut(SSI0_BASE, dado);
while(SSIBusy(SSI0_BASE)); // wait until SSI0 not busy
}
int main (void)
{
init_SSI();
while(1)
{
int i = 0;
for(i=0; i <=255; i++)
{
send_SSI(i);
Delay(5000000);
}
for(i=255; i > 0; i--)
{
send_SSI(i);
Delay(5000000);
}
}
}