2021-12-06 09:26 PM
Everyone,
Posting for the first time here. We've been working with a 4d display that's based on an FT813 IC. The issue that we came to so far is the following.
Our setup for FT813 is default : Internal CLK, SPI is at 4Mhz, Pol 0 Pha 1 , STM32 Core Clock is 16Mhz.
As I debug the FT813memRead8 function it transmits the REG_ID (0x302000)address however during the SP Receive, we never receive 0x7C.
Only when we added an element to return &ftData8[2]; do we receive anything at all. Yet and still it never display's 0x7C that's on the host (MISO). Therefore, we stay stuck at
while (FT813memRead8(REG_ID) != 0x7C) //we should be reading chip ID from C0000 - C0003?
{
}
I have personally worked as a firmware engineer contractor for the DOD but, I have never been involved with starting any of the displays.
I tried contacting 4d and github but, porting to stm32 doesn't help our issue.
If anyone could provide a light to give me knowledge of our issue it would be greatly appreciated!
We are transmitting and receiving but on other devices but, we we aren't we receiving 0x7C keeps us extremely baffled at this point and time.
Thanks in advance!
SAMPLE CODE
while (1) //initialize the display
{
HAL_GPIO_WritePin(GPIOD, FT813_PD_N_PD14, GPIO_PIN_RESET); //LOW, INITIALLY THE PD_N PIN IS SET TO NO PULL UP OR PULL DOWN.
HAL_Delay(30);
HAL_GPIO_WritePin(GPIOD, FT813_PD_N_PD14, GPIO_PIN_SET); // BE HIGH NOW
HAL_Delay(30);
HAL_GPIO_WritePin(GPIOD, FT813_CS_N_PD13, GPIO_PIN_SET); //initially make low
FT813cmdWrite(FT813_ACTIVE,0x00); //set active address, data
// ITM_Port32(31) = 1;d
HAL_Delay(700); //minimum of 300ms
//****************************************************************************************************************************
//***************************************************************************************************************************
// ITM_Port32(31) = 2;
while (FT813memRead8(REG_ID) != 0x7C) //are we reading chip ID from C0000 - C0003?
{
}
MEMREAD8
unsigned char FT813memRead8(unsigned long ftAddress) // Compose the command and address to read
{
HAL_GPIO_WritePin(GPIOD, FT813_CS_N_PD13, GPIO_PIN_RESET); //Transactions take place with CS_N low.
unsigned char *ftData8[2] = {0x00}; // start up with 0 // Place-holder for 8-bits being read
unsigned char cTempAddr[3] = {0x00}; // start up with 0 // FT813 Memory Address
unsigned char *cZeroFill = ZERO; // Dummy byte
//0x10/0x12(FT813/FT813
cTempAddr[2] = (char) (ftAddress >> 16); // Compose the command and address to send
cTempAddr[1] = (char) (ftAddress >> 8); // middle byte
cTempAddr[0] = (char) (ftAddress); // low byte
for (int i = 2; i >= 0; i--)
{
HAL_SPI_Transmit(&hspi1, &cTempAddr[i], 1, 0); // Send Memory Read/Write plus high address byte
//TIMEOUT MAYBE TOO SHORT!! BYTE TOO!
}
HAL_SPI_Transmit(&hspi1, &cZeroFill, 1, 0); // Send dummy byte
for (int j = 0; j < sizeof(&ftData8); j++) // Start with least significant byte
{
HAL_SPI_Receive(&hspi1, &ftData8[2], 1, 100); // Receive data byte
}
// Set chip select high
HAL_GPIO_WritePin(GPIOD, FT813_CS_N_PD13, GPIO_PIN_SET);
return &ftData8[2]; // Return 8-bits
}
SPI SETUP
static void MX_SPI1_Init(void)
{
/* USER CODE BEGIN SPI1_Init 0 */
/* USER CODE END SPI1_Init 0 */
/* USER CODE BEGIN SPI1_Init 1 */
/* USER CODE END SPI1_Init 1 */
/* SPI1 parameter configuration*/
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 10;
if (HAL_SPI_Init(&hspi1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN SPI1_Init 2 */
/* USER CODE END SPI1_Init 2 */
}
GPIO BASIC ILLUSTRATION
/*Configure GPIO pins : FT813_CS_N_PD13_Pin FT813_PD_N_PD14_Pin */
GPIO_InitStruct.Pin = FT813_CS_N_PD13_Pin|FT813_PD_N_PD14_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
I tried
Solved! Go to Solution.
2021-12-07 11:12 PM
All,
I found after reading " BRT-AN-006-FT81x-Simple-PIC-Example.pdf" it gave me an understanding of what I was doing wrong. Using someone else's code causes more trouble for me than it should.
So, to all, I thank you for your time!
HXE
2021-12-07 11:12 PM
All,
I found after reading " BRT-AN-006-FT81x-Simple-PIC-Example.pdf" it gave me an understanding of what I was doing wrong. Using someone else's code causes more trouble for me than it should.
So, to all, I thank you for your time!
HXE
2022-11-14 12:49 AM
Hello Mr Hiram Hyman. I am also facing the same problem.
while (FT813memRead8(REG_ID) != 0x7C);
it never returns 0x7C after this command. Can you share how you solved this problem? Your answer will be really appreciated.
2022-11-16 12:23 AM
2022-11-17 02:51 AM
Mr Hiram Hyman,
First of all, thank you very much for taking your precious time to answer my question kindly. Your answer contains very detailed and valuable information. Also, thank you for sharing this information. I will update my project with the information you provide as soon as possible and I will share the results here again.
Also, I had the opportunity to do a project with TouchGFX in the past. I have realized TouchGFX with a 7" external display with STM32F429. However, I think that the M4 processors are not enough on the 7" display regarding the rendering slowness I encountered. I live in Turkey and you can appreciate that processor prices are quite high in my country. That's why using m4 and m7 processors is the last thing we want right now.
This situation forced me to use drivers that allow me to drive more stable screens on lower processors and I decided to work with the Ft811 driver.
I am sure you will do excellent work with touchgfx. Visually, more beautiful works will come out of most platforms.
I wish you success in your working life. I will be following you and your work. Good work. I wish you healthy days.
2022-11-17 04:20 AM