This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-F28069M: Interfacing SPI LCD ILI9341

Part Number: LAUNCHXL-F28069M

Hi,

Interfacing a SPI LCD to SPIA, few things that confuses me.

1. SPISTEA

Should this be controlled by the SPI Master F28069 ? I understand it implies SPI Slave Transmit Enable A. Is it really useful in the master mode ?

2. SPI Character Length

For the ILI9341, should this be 8bits, or should it be 16 bits ? Slightly lost on this.

At the moment, I am using the following SPI configuration:

void setup_spi(void)
{
	SpiaRegs.SPICCR.bit.SPISWRESET = 0;		/* Reset SPI						*/

	SpiaRegs.SPIPRI.bit.TRIWIRE = 0;		/* SPI 4 wire MODE enabled			*/
	SpiaRegs.SPICCR.bit.SPICHAR = 0xf;		/* 16 bits							*/
	SpiaRegs.SPICCR.bit.CLKPOLARITY = 0;	/* CPOL = 0							*/
	SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1;	/* Master							*/
	SpiaRegs.SPICTL.bit.CLK_PHASE = 0;		/* CPHA = 0, normal mode			*/
	SpiaRegs.SPICTL.bit.TALK = 1;			/* enable transmission				*/
	SpiaRegs.SPISTS.all = 0x0000;			/* clear status flags				*/
	SpiaRegs.SPIBRR = 0x0063;				/* Baud Rate						*/
	SpiaRegs.SPIFFTX.bit.SPIFFENA = 1;		/* FIFO enhancement enabled 		*/
	SpiaRegs.SPIFFTX.bit.SPIRST = 1;		/* FIFO can resume Rx/Tx			*/
	SpiaRegs.SPIFFCT.all = 0x00;			/* no delays						*/
	SpiaRegs.SPIPRI.bit.FREE = 1;			/* Free run							*/

	SpiaRegs.SPICCR.bit.SPISWRESET = 1;		/* Enable SPI						*/
	SpiaRegs.SPIFFTX.bit.TXFIFO = 1;		/* Re enable TX FIFO				*/
	SpiaRegs.SPIFFRX.bit.RXFIFORESET = 1;	/* Re enable RX FIFO				*/
}


/**
 * ILI9341 <--> LAUNCHXL-F28069M interconnect
 * ILI9341		LAUNCHXL-F28069M				InitSpiaGpio
 * -------------------------------------------------------------
 * SDO(MISO)	J2(14)	1SPI_SO		(GPIO17)	(SPISOMIA)
 * LED			J4(34)	GPIO		(GPIO13)
 * SCK			J1(7)	1SPI_CLK	(GPIO18)	(SPICLKA)
 * SDI(MOSI)	J2(15)	1SPI_SI		(GPIO16)	(SPISIMOA)
 * DC			J2(18)	GPIO		(GPIO44)
 * RESET		J1(8)	GPIO		(GPIO22)
 * CS			J2(19)	1SPI_CS		(GPIO19)	(SPISTEA)
 * GND
 * VCC
 */

void lcd_cmd(Uint16 cmd)
{
	Uint16 tmp;

	GpioDataRegs.GPBSET.bit.GPIO44 = 1;		/* enable D/C pin			*/

	SpiaRegs.SPITXBUF = cmd;			/* master TX data			*/
	while (SpiaRegs.SPISTS.bit.INT_FLAG != 1);
	tmp = SpiaRegs.SPIRXBUF;			/* Clear self received data	*/
}

Any thoughts/suggestions ?

Thanks,

Manu

  • Hi Manu,

    1) The C2000 SPI drives the SPISTE pin active/inactive by itself. You can chose to do this manually, but in instances when you just have one slave this is not really needed.
     
    2) Referencing the Datasheet of the ILI9341 it looks like if you are doing 3-line it should be 9 bits, and if you are doing 4-line it should be 8 bits.


    Best Regards,
    Marlyn