I have been fighting this issue for 2 days and hoping someone can help.
I am using the Tiva TM4C1294 Launchpad and need to communicate with a touch screen.
I am using CCS on a Windows machine.
I need to send a 16 bit word over an SSI port but every method I have tried will only send 8 bits and stop.
Here are the versions of code I have tried:
Try 1. Manual chip select sending two 8 bit words. I have used this successfully on the Stellaris MCU.
// Enable and configure SSI0
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); //
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);
GPIOPinConfigure(GPIO_PA5_SSI0XDAT1);
// Setup SSI Port for Touch Screen
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_2);
SSIConfigSetExpClk(SSI0_BASE, g_ui32SysClock, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 4000000, 8);
SSIAdvModeSet(SSI0_BASE, SSI_ADV_MODE_LEGACY);
SSIEnable(SSI0_BASE);
// Setup Touch screen chip select
GPIODirModeSet(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_DIR_MODE_OUT); // /TCS
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3);
GPIOPadConfigSet( GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD );
SET_TCS; // this is same as SSIOFSS
// interrupt pin
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
SysCtlDelay(20000);
GPIOPinTypeGPIOInput(GPIO_PORTP_BASE, GPIO_PIN_0); // P0
GPIOIntTypeSet(GPIO_PORTP_BASE, GPIO_PIN_0, GPIO_FALLING_EDGE); // was FALLING_EDGE
CLR_TCS;
SSIDataPut(SSI0_BASE, 0x02);
while ( SSIBusy(SSI0_BASE)) {
}
SSIDataPut(SSI0_BASE, 0xF0);
while ( SSIBusy(SSI0_BASE)) {
}
SET_TCS;
Try 2. Manual chip select send one 16 bit word
// Enable and configure SSI0
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); //
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
GPIOPinConfigure(GPIO_PA2_SSI0CLK); // defined in pin_map.h
GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);
GPIOPinConfigure(GPIO_PA5_SSI0XDAT1);
// Setup SSI Port for Touch Screen
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_2);
SSIConfigSetExpClk(SSI0_BASE, g_ui32SysClock, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 4000000, 16);
SSIAdvModeSet(SSI0_BASE, SSI_ADV_MODE_LEGACY);
SSIEnable(SSI0_BASE);
// Setup Touch screen chip select
GPIODirModeSet(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_DIR_MODE_OUT); // SSI0Fss PA3 /TCS
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3);
GPIOPadConfigSet( GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD );
SET_TCS;
// interrupt pin
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
SysCtlDelay(20000);
GPIOPinTypeGPIOInput(GPIO_PORTP_BASE, GPIO_PIN_0); // P0
GPIOIntTypeSet(GPIO_PORTP_BASE, GPIO_PIN_0, GPIO_FALLING_EDGE); // was FALLING_EDGE
CLR_TCS;
SSIDataPut(SSI0_BASE, 0x02F0);
while ( SSIBusy(SSI0_BASE)) {
}
SET_TCS;
Tries 3 and 4 are same as above except I set pin A3 as the SSIOFSS chip select and removed the CLR_TCS and SET_TCS macros
I have also tried to do a direct hardware write to the FIFO as here:
CLR_TCS;
// Wait until there is space.
//
while(!(HWREG(SSI0_BASE + SSI_O_SR) & SSI_SR_TNF))
{
}
//
// Write the data to the SSI.
//
// HWREG(SSI0_BASE + SSI_O_DR) = 0x02F0;
SET_TCS;
I have tried with and without SSIAdvModeSet(...)
Looking at the serial data analyzer I see the CS line go low, all 16 clock pulses sent but only the first byte of data sent.
The second byte does not get sent.
I am at a loss.
I can send screenshot if you like.
Thanks in advance.
Sam