BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: FT813 display show divided screen and strange "rainbow"  (Read 11746 times)

jmribera

  • Newbie
  • *
  • Posts: 3
    • View Profile
FT813 display show divided screen and strange "rainbow"
« on: June 19, 2020, 10:39:30 AM »

Hi, we are starting to use FT813 to control a TFT display in a new project.

For now, as you can see in the attached image, we have created a simple composition, but we always get a divided screen and you can see the "rainbow" at the right side. I don%u2019t know how to solve this.

Our screen is 800 x 480 (T500T01X00)

It is our initial sequence (SPI speed is less < 11 MHz)

                HAL_Delay(200);
                FT813_PDN_OFF;
                HAL_Delay(20);
                FT813_PDN_ON; //Activa Power Down
                HAL_Delay(20) //Requerit
               
                FT813_cmdWrite(FT813_CMD_CLKEXT);                              // clock extern
                FT813_cmdWrite(FT813_CMD_ACTIVE);                              // activa el chip

if (FT813_memRead8(REG_ID) == 0x7C) {                            // espera a identificar el xip
                               
                               // WQVGA display parameters
                               FT813_memWrite16(REG_HSIZE,   800);                // Active width of LCD display
                               FT813_memWrite16(REG_HCYCLE,  928);             // Total number of clocks per line
                               FT813_memWrite16(REG_HOFFSET, 88);             // Start of active line
                               FT813_memWrite16(REG_HSYNC0,  1);                 // Start of horizontal sync pulse
                               FT813_memWrite16(REG_HSYNC1,  48);              // End of horizontal sync pulse
                               FT813_memWrite16(REG_VSIZE,   480);                // Active height of LCD display   
                               FT813_memWrite16(REG_VCYCLE,  525);             // Total number of lines per screen
                               FT813_memWrite16(REG_VOFFSET, 32);             // Start of active screen
                               FT813_memWrite16(REG_VSYNC0,  0);                 // Start of vertical sync pulse
                               FT813_memWrite16(REG_VSYNC1,  3);                 // End of vertical sync pulse
                               FT813_memWrite8(REG_SWIZZLE,  0);                  // Define RGB output pins
                               FT813_memWrite8(REG_PCLK_POL, 1);                // Define active edge of PCLK

                               FT81x_GPIO = FT813_memRead8(REG_GPIO);  // Read the FT800 GPIO register for a read/modify/write operation
                               FT81x_GPIO = FT81x_GPIO | 0x80;         // set bit 7 of FT800 GPIO register (DISP) - others are inputs
                               FT813_memWrite8(REG_GPIO, FT81x_GPIO);  // Enable the DISP signal to the LCD panel
                               
                               // Can move these 2 lines to after the first display list to make the start-up appear cleaner to the user
                               FT813_memWrite8(REG_PCLK, 2);           // Now start clocking data to the LCD panel
                               FT813_memWrite8(REG_PWM_DUTY, 127);



                               val = SI;               
                               }
                else val = NO;

I've changed the values of this configurations, but I got the same result. Based on your experience, what could be the problem?

Thank you in advance


« Last Edit: June 21, 2020, 03:21:44 PM by jmribera »
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 391
    • View Profile
Re: FT813 display show divided screen and strange "rainbow"
« Reply #1 on: June 19, 2020, 03:53:18 PM »

This happens when you configure EVE for a smaller resolution than the display you have connected.
Like for example 480x272 when the display has 800x600.
And 480x272 is the reset default value.

What happens is that your init sequence is not executed.
Reading REG_ID directly after CMD_ACTIVE like shown will fail as the FT813 does not even respond then.

Check the init sequence in the programming manual.

Somehow REG_PCLK gets set regardless so this has to happen outside of the fragment you have presented.
« Last Edit: June 21, 2020, 11:09:25 PM by Rudolph »
Logged

jmribera

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: FT813 display show divided screen and strange "rainbow"
« Reply #2 on: June 22, 2020, 09:35:51 AM »

Thank you for your help Rudolph! I have my code like this, but the result is exactly the same:

        HAL_Delay(200);
   FT813_PDN_OFF; //Fem un reset del controlador
   HAL_Delay(20);
   FT813_PDN_ON; //Activa Power Down
   HAL_Delay(20); //Requerit
   
   
   FT813_cmdWrite(FT813_CMD_CLKEXT);      // clock extern
   
   HAL_Delay(20);
   
   FT813_cmdWrite(FT813_CMD_ACTIVE);      // activa el chip
   
   HAL_Delay(500); //WAIT 500 ms
   
   while(FT813_memRead8(REG_ID) != 0x7C) {}   // espera a identificar el xip
      
   while (FT813_memRead8(REG_CPURESET) != 0x00) {} // Ensure CPUreset register reads 0 and so FT8xx is ready
      
      
      // WQVGA display parameters
      FT813_memWrite16(REG_HCYCLE,  928);      // Total number of clocks per line
      FT813_memWrite16(REG_HOFFSET, 88);      // Start of active line
      FT813_memWrite16(REG_HSYNC0,  1);      // Start of horizontal sync pulse
      FT813_memWrite16(REG_HSYNC1,  48);      // End of horizontal sync pulse
      FT813_memWrite16(REG_VCYCLE,  525);      // Total number of lines per screen
      FT813_memWrite16(REG_VOFFSET, 32);      // Start of active screen
      FT813_memWrite16(REG_VSYNC0,  0);      // Start of vertical sync pulse
      FT813_memWrite16(REG_VSYNC1,  3);      // End of vertical sync pulse
      FT813_memWrite8(REG_SWIZZLE,  0);      // Define RGB output pins
      FT813_memWrite8(REG_PCLK_POL, 1);      // Define active edge of PCLK
      FT813_memWrite8(REG_CSPREAD, 1);      // This bit controls the polarity of PCLK.
      FT813_memWrite16(REG_HSIZE,   800);      // Active width of LCD display
      FT813_memWrite16(REG_VSIZE,   480);      // Active height of LCD display   

      FT81x_GPIO = FT813_memRead8(REG_GPIO);  // Read the FT800 GPIO register for a read/modify/write operation
      FT81x_GPIO = FT81x_GPIO | 0x80;         // set bit 7 of FT800 GPIO register (DISP) - others are inputs
      FT813_memWrite8(REG_GPIO, FT81x_GPIO);  // Enable the DISP signal to the LCD panel
      
      // Can move these 2 lines to after the first display list to make the start-up appear cleaner to the user
      // FT813_memWrite8(REG_PCLK, 2);           // Now start clocking data to the LCD panel
      FT813_memWrite8(REG_PWM_DUTY, 127);

I've debbuged my code and I read 0x7C, so the init sequence is executed..
« Last Edit: June 22, 2020, 09:46:05 AM by jmribera »
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 743
    • View Profile
Re: FT813 display show divided screen and strange "rainbow"
« Reply #3 on: June 22, 2020, 11:19:29 AM »

Hi,
It would be worth checking your defines for the display registers to ensure all are being written to correct addresses.
As Rudolph mentioned, this effect can appear if the values are wrong in the settings.
You can find an example header file in various libraries such as this zip file: https://brtchip.com/wp-content/uploads/EVE_Projects/SampleApp.zip
Best Regards, BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 391
    • View Profile
Re: FT813 display show divided screen and strange "rainbow"
« Reply #4 on: June 22, 2020, 11:55:24 AM »

Is it possible that you have a second init function somewhere else?
In your first example REG_PCLK should not have been written to and therefore the display should have stayed dark.
And now REG_PCLK is not written in the snippet shown and it still works?

Also the init is missing the basic display-list from the manual but this is not the issue.
Logged

jmribera

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: FT813 display show divided screen and strange "rainbow"
« Reply #5 on: June 22, 2020, 11:59:12 AM »

Hi, thank you all for your help.

you have reason, I had a mistake into the next function, so I wrote a wrong address register:

Quote
void FT813_memWrite16(u32 ftAddress, u16 ftData16) {
   s32   i;
   u8 cTempAddr[3], cTempData[2];
   HAL_StatusTypeDef estat;

   cTempAddr[2] = (u8)(ftAddress >> 16) | MEM_WRITE;   // Compose the command and address to send
   cTempAddr[1] = (u8)(ftAddress >> 8);            // middle byte
   cTempAddr[0] = (u8)(ftAddress);                  // low byte
   
   cTempData[1] = (u8) (ftData16 >> 8);            // Compose data to be sent - high byte
   cTempData[0] = (u8) (ftData16);                  // low byte
   
   FT813_CS_ON;
   for (i=2;i>=0;i--) HAL_SPI_Transmit(&FT813_SPI_H,&cTempAddr,1,FT813_SPI_TO);    // Send Memory Write plus high address byte
   for (i=0;i<2;i++) estat=HAL_SPI_Transmit(&FT813_SPI_H,&cTempData,1,FT813_SPI_TO);    // Send data bytes
   FT813_CS_OFF;   

   }
Now, all is correct.

Thank you
« Last Edit: June 22, 2020, 12:11:46 PM by jmribera »
Logged