Unlike the other displays that come from the Riverdi company, this one is a bit specific - in a sense that it uses the ILI9341 TFT Driver IC, so in order to display a picture on the display, it is necessary to set up both of the ICs used for this display: FT800/801 and ILI9341. To successfully achieve this, a specific workflow needs to be followed:
First, the FT800/801 should be initialized, so that it allows control of its GPIOs. After the control over the FT800/801 is established, it is necessary to initialize the ILI9341 TFT driver. This is performed by the functions that can be found in the ILI_cmds.h. All the other fuctions, mostly in a “FT800_” format can be found in the FT800 library, which can be downloaded from the Libstock.
Basically, to establish the control over the FT800/801, the SPI module should be activated in 8bit mode and the following commands need to be executed on the host MCU:
SPI2_Init_Advanced(SPI_MASTER,_SPI_8_BIT,8,_SPI_SS_DISABLE,_SPI_DATA_SAMPLE_MIDDLE,_SPI_CLK_IDLE_HIGH,_SPI_IDLE_2_ACTIVE); Delay_ms(1000); Ft_Gpu_Hal_Powercycle(true); FT800_Core_PowerMode(_FT800_PWR_MODE_ACTIVE); Delay_ms(20); FT800_Core_ClockSource(_FT800_CLK_SOURCE_INTERNAL); Delay_ms(10); FT800_Core_ClockPLL(_FT800_CLK_PLL_48MHz); Delay_ms(10); FT800_Core_Reset(); //ChipID = 7Ch, waiting for a proper response while(chipID!= 0x7C) { FT800_IO_ReadBuffAddr(_FT800_REG_ID,&chipID, 1); } Delay_ms(100);
To confirm the successful communication, the expected 0x7C response should be returned by theFT800/801. Now, when the communication is confirmed, it is time to move on with the initialization. The GPIO pins of the FT800/801should be configured and then, the ILI_init() function found in theILI_cmds.h cam be invoked. This function will disable the SPI peripheral, since it has to perform a 9bit bit banging (bit banging is manual toggling of the SPI pins, since 9bit SPI is not natively supported by the most MCUs) and it needs the SPI pins to revert to the GPIO functionality. This is achieved by these several functioncalls:
//Setsthe FT GPIO to ILI interface (ILI_CS and ILI_CS direction) FT800_GPIO_Set(0x83,0x83); //USINGILI 9bit communication in bitbanging mode, MSSP will getdisconnected... ILI_init(); //Returnpin control to the MSSP ON__SPI2CON_bit= 1;
Inside the ILI_init() function, all the necessary preparation for the host MCU SPI pins towork in a 9bit mode is done, along with SPI module disable function,necessary to expose control over the GPIO functionality of the SPI pins (MCU Specific). Besides these 9bit SPI communication functions,used to communicate with the ILI9341, the ILI_cmds.h file alsocontains the data communicated to the ILI9341 driver. This data is used to initialize this driver and here, it can be changed as needed.Please refer to the ILI9341 datasheet for the meaning of theseregisters and their values.
Once the function ILI_init() is done, the control over the GPIO pins is returned to the SPI peripheral (on the used MCU, it is done by the ON__SPI2CON_bit =1; command, it is MCU specific) and the device is ready to be used just like any other Riverdi TFT display (3.5” and up)
Known limitations and issues
Because of the peculiarity of this specific display, it is not fully supported by the current version of the Visual TFT. The generated project has to be supplemented and patched with the functions discussed in thistext. Depending on the used MCU, some of the used commands might be different (mainly the SPI related ones). The MCU used in the provided Riverdi 2.8” demo application is the PIC32MX460F512L.The included demo application is intended to be used as a reference for a custom designs for any MCU platform.
The Visual TFT currently does not support portrait displays and the FT8xx display driver ICs do not have landscape/portrait function register (90° rotation),only horizontal flip function registers (180° rotation). Although the ILI9341 TFT driver can be set to work in the portrait orlandscape mode, the FT800/FT801 is not able to follow this, so thelandscape mode is not supported for this display.