Other Parts Discussed in Thread: TM4C123GH6PM, TPL9202
I have written a library for the TPL9202 Relay driver using TM4C123GH6PM MCU (Tiva launchpad )
The TPL9202 has an 8 bit register .Each bit corresponds to 8 output pins of the TPL .
This is how i have configured the SSI port on the Tiva
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinConfigure(GPIO_PA2_SSI0CLK); GPIOPinConfigure(GPIO_PA3_SSI0FSS); GPIOPinConfigure(GPIO_PA4_SSI0RX); GPIOPinConfigure(GPIO_PA5_SSI0TX); GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 |GPIO_PIN_2); SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,SSI_MODE_MASTER, 500000, 8); SSIEnable(SSI0_BASE);
I use the SSIDataPut() to pass uint8_t register values as follows
uint8_t w_reg(uint8_t Relay_reg,uint8_t relay_pin,uint8_t state)
{
if(state==0)
{
Relay_reg^=relay_pin;
}
else if(state==1)
{
Relay_reg|=relay_pin;
}
SSIDataPut(SSI0_BASE,Relay_reg);
return Relay_reg;
}
My main() is like so ,
int main(void)
{
uint8_t relay_reg=0x00;
SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN| SYSCTL_XTAL_16MHZ);
SPIEnable(SSI1_BASE);
relay_reg= w_reg( relay_reg,RELAY_PIN_4,1);
while(1){
}
}
WHere relay_Pin_4 = 0x08
The problem is that I am not getting any output on the pins .
Am i properly passing the register values ?Have is configured the SSICOnfigSetExpCLk() correctly ?
Also , i have shorted the ~RST and BO pins on the TPL .