2020-10-23 04:59 AM
I need to use a custom display for my undergraduate thesis and I want to do my GUI with TouchGFX. However I could not use the custom display. I could not make the settings or necessary definitions of SPI (I done SPI settings in CubeMX but couldn't done in frame buffer integrations) and I want to learn about this subject in detail. I am using STM32F429 and my tft driver is FT800 or I have FT812 (I have both) and 4.3" resistive display. I really a need help!
2020-10-30 05:20 AM
Please have a look at https://support.touchgfx.com/docs/development/touchgfx-hal-development/scenarios/scenarios-fmc (Covers SPI and FMC) and see if you can get some hints.
In the meantime you need to provide a lot more information if i am to assist you. What does "I could not make it work" cover? What did you try? What was the result? etc. Thanks.
/Martin
2020-11-02 11:13 PM
Hi @Martin KJELDSEN ,
Here, sending red to the screen;
do
{
cmdBufferRd = ft800memRead16(REG_CMD_READ); // Read the graphics processor read pointer
cmdBufferWr = ft800memRead16(REG_CMD_WRITE); // Read the graphics processor write pointer
}while (cmdBufferWr != cmdBufferRd); // Wait until the two registers match
cmdOffset = cmdBufferWr; // The new starting point the first location after the last command
ft800memWrite32(RAM_CMD + cmdOffset, (CMD_DLSTART));// Start the display list
cmdOffset = incCMDOffset(cmdOffset, 4); // Update the command pointer
ft800memWrite32(RAM_CMD + cmdOffset, (DL_CLEAR_RGB | RED)); //Set the default clear color to Red (defined global var)
cmdOffset = incCMDOffset(cmdOffset, 4); // Update the command pointer
ft800memWrite32(RAM_CMD + cmdOffset, (DL_CLEAR | CLR_COL | CLR_STN | CLR_TAG)); // Clear the screen - this and the previous prevent artifacts between lists
// Attributes are the color, stencil and tag buffers
cmdOffset = incCMDOffset(cmdOffset, 4); // Update the command pointer
ft800memWrite32(RAM_CMD + cmdOffset, (DL_DISPLAY)); // Instruct the graphics processor to show the list
cmdOffset = incCMDOffset(cmdOffset, 4); // Update the command pointer
ft800memWrite32(RAM_CMD + cmdOffset, (CMD_SWAP)); // Make this list active
cmdOffset = incCMDOffset(cmdOffset, 4); // Update the command pointer
ft800memWrite16(REG_CMD_WRITE, (cmdOffset)); // Update the ring buffer pointer so the graphics processor starts executing
*Definition of ft800memWrite32;
void ft800memWrite32(unsigned long ftAddress, unsigned long ftData32)
{
unsigned char cTempAddr[3]; // FT800 Memory Address
unsigned char cTempData[4]; // 32-bit data to write
cTempAddr[2] = (char) (ftAddress >> 16) | MEM_WRITE; // Compose the command and address to send
cTempAddr[1] = (char) (ftAddress >> 8); // middle byte
cTempAddr[0] = (char) (ftAddress); // low byte
cTempData[3] = (char) (ftData32 >> 24); // Compose data to be sent - high byte
cTempData[2] = (char) (ftData32 >> 16);
cTempData[1] = (char) (ftData32 >> 8);
cTempData[0] = (char) (ftData32); // low byte
HAL_GPIO_WritePin(GPIOE, FT800_CS_N, GPIO_PIN_RESET); // Set chip select low
for (int i = 2; i >= 0; i--)
{
HAL_SPI_Transmit(&hspi3, &cTempAddr[i], 1, 0); // Send Memory Write plus high address byte
}
for (int j = 0; j < sizeof(cTempData); j++) // Start with least significant byte
{
HAL_SPI_Transmit(&hspi3, &cTempData[j], 1, 0); // Send SPI byte
}
HAL_GPIO_WritePin(GPIOE, FT800_CS_N, GPIO_PIN_SET); // Set chip select high
}
When I write as above, I can send red to the screen but I did not understand how to do this with touchgfx.
I don't have any idea how to write code to transfer pixels from a touchgfx frame buffer to a display.
Sincerely.
/Can