hi
i am currently working on the SPI communication in tm4c123gh6pge board,the main thing is....
i want to communicate two SPI's in tm4c123gh6pge microcontrollers ,one SPI0 (tiva) for master and another SPI2 (tiva) for slave by using SPI protocol.
Is it is possible to communicated b/w two tiva by using SPI protocol.
by using
1.Tiva(Master) 2.Tiva(Slave)
SPI0 SPI2
1,Clk--------------> Clk
2,MISO----------> MISO
3.MOSI----------> MOSI
4.SS--------------> SS
the code i have written is ..
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinConfigure(GPIO_PA3_SSI0FSS);
GPIOPinConfigure(GPIO_PA4_SSI0RX);
GPIOPinConfigure(GPIO_PA5_SSI0TX);
GPIOPinConfigure(GPIO_PB4_SSI2CLK);
GPIOPinConfigure(GPIO_PB5_SSI2FSS);
GPIOPinConfigure(GPIO_PH6_SSI2RX);
GPIOPinConfigure(GPIO_PH7_SSI2TX);
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 |GPIO_PIN_3 |
GPIO_PIN_2);
GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_4 |GPIO_PIN_5);
GPIOPinTypeSSI(GPIO_PORTH_BASE, GPIO_PIN_6 |GPIO_PIN_7);
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
SSI_MODE_MASTER, 1000000, 8);
SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
SSI_MODE_MASTER, 1000000, 8);
SSIEnable(SSI0_BASE);
SSIEnable(SSI2_BASE);
while(SSIDataGetNonBlocking(SSI0_BASE, &pui32DataRx[0]))
{
}
while(SSIDataGetNonBlocking(SSI2_BASE, &pui32DataRx[0]))
{
}
pui32DataTx[0] = 's';
pui32DataTx[1] = 'p';
pui32DataTx[2] = 'i';
UARTprintf("Sent:\n ");
while(1)
{
spi_protocol();
}
}
void spi_protocol()
{
asd++;
for(ui32Index = 0; ui32Index < NUM_SSI_DATA; ui32Index++)
{
UARTprintf("'%c' ", pui32DataTx[ui32Index]);
UARTprintf("\ntx:\n ");
SSIDataPut(SSI0_BASE, pui32DataTx[ui32Index]);
}
while(SSIBusy(SSI0_BASE))
{
}
asd1++;
for(ui32Index = 0; ui32Index < NUM_SSI_DATA; ui32Index++)
{
SSIDataGet(SSI2_BASE, &pui32DataRx[ui32Index]);
pui32DataRx[ui32Index] &= 0x00FF;
UARTprintf("\nRx:\n ");
UARTprintf("'%c' ", pui32DataRx[ui32Index]);
}
while(SSIBusy(SSI2_BASE))
{
}
}