cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429ZI interface to GEN4-FT813-CTP-CLB:

Hiram Hyman
Associate III

0693W00000HnkROQAZ.pngEveryone,

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.

  • 0x7C during Initialization is never detected although, it is detected from MISO. This is read on the logic analyzer. So my thinking is that the FT813 is awake and communicating to the Host.

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

1 ACCEPTED SOLUTION

Accepted Solutions
Hiram Hyman
Associate III

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

View solution in original post

5 REPLIES 5
Hiram Hyman
Associate III

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

MKoca.1
Senior

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.

Hi, Make sure that you are following the recommended Start up of the FT813. I’m thinking that you are so, After startup and a 300ms delay for self-diagnostics of the FT813, The problem that I had the most with the FT813 return of 0x7C was the following, 1. Bad SPI connection. Make sure that your MISO and MOSI lines are correct. Clock is without saying needs to validated too. 2. When validating your connections, it’s a very good idea to analyze your SPI Data. a. Validate MOSI --intended data to send to the FT813. b. Validate MISO -- intended data to sent from the FT813. c. Determine if there is a 0x7C on your MISO(without the MPU’s MISO Connected). Very Necessary! 3. Make sure that you have similar code when expecting 0x7C. This was an issue that I had for the longest time due to An issue I caused on my on. After realizing that I had the 0x7C on the analyzer but, not the MPU, I had to dig deeper into The understanding of the process. 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. #ifdef mine // unsigned long *Address = {0b001100000010000000000000}; unsigned long *Address = {0x302000}; uint8_t dummy = {0x00}; char *data = {0x00}; for (int j = 0;j<3;j++) { HAL_SPI_Transmit(&hspi1,&Address,2,100); // HAL_SPI_Transmit(&hspi1,&dummy,1,1); HAL_SPI_Receive(&hspi1,&data,1,10); HAL_Delay(5); } #endif unsigned char ftData8; // Place-holder for 8-bits being read unsigned char cTempAddr[3] = {0x00}; // FT813 Memory Address unsigned char *cZeroFill = ZERO; // Dummy byte3 //0x10/0x12(FT813/FT813 cTempAddr[2] = (char) (ftAddress >> 16) | MEM_READ; // 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 HAL_Delay(20); HAL_SPI_Receive(&hspi1, &ftData8, 1, 100); HAL_Delay(20); // Set chip select high HAL_GPIO_WritePin(GPIOD, FT813_CS_N_PD13, GPIO_PIN_SET); // Return 8-bits return ftData8; I was able to randomly change the screen color, place dot’s etc.. but, it was slow in terms of updating the screen. Therefore, It led me to research for an easier way to allow my projects to progress. I moved to the STM32H747-Disco. I couldn’t find enough documentation that I needed for the FT813 in addition to the Lagging of the screen updates so, I stopped about 9 months ago. P.S I did not want to spend more time researching to get the screens made to run on the FT813 so, I switched an never looked back! Touch GFX much easier to get going and to use! I hope this helps and that you’ll have more success than I did! Regards, Hiram Hyman Chief Engineer HXE,LLC 563-5 Komekami Odawara Kanagawa Japan 250-0023 Phone: +81-70-4163-7552 Skype: design_1384 Email: design@hiram-xe.com Web: <> www.hiram-xe.com
MKoca.1
Senior

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.

You’re more than welcome. I agree with the prices for the semiconductors. I have stm32f469 custom boards that I’m going to try and sell sometime. May find the remaining 40 use finally. You’re in Turkey and I live in Japan Now. Much success in your endeavors ! Regards, Hiram Get Outlook for iOS<>