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: Avoid double init of the screen between Boot and App  (Read 8734 times)

Cyrilou

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Avoid double init of the screen between Boot and App
« on: June 17, 2021, 10:20:31 AM »

Hi all!

I'd like to initialise screen in my boot with the EVE "lite" library to display some error codes or logos. But when bootloader jumps to app, which uses ESD library, how can I detect that screen is already initialized to avoid the glitch of init? What source code can I implement in ESD init to avoid this secondary init?

regards
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 744
    • View Profile
Re: Avoid double init of the screen between Boot and App
« Reply #1 on: June 17, 2021, 03:17:55 PM »

Hello,

Thank you for your question.

I'm note sure which library you are referring to when you mention the EVE 'Lite' Library. However you can find a standard EVE initialization sequence below:
Code: [Select]
    MCU_PDlow();                                                                // PD low to reset device                                                               
    MCU_Delay_20ms();
    MCU_PDhigh();                                                               // PD high again
    MCU_Delay_20ms();

    // ---------------------- Delay to allow FT81x start-up --------------------   
   
    EVE_CmdWrite(FT81x_ACTIVE, 0x00);                                           // Sends 00 00 00 to wake FT8xx
   
    MCU_Delay_500ms();                                                          // 500ms delay (EVE requires at least 300ms here))
       
    // --------------- Check that FT8xx ready and SPI comms OK -----------------
   
    while (EVE_MemRead8(REG_ID) != 0x7C)                                        // Read REG_ID register until reads 0x7C
    {
    }
     
    while (EVE_MemRead8(REG_CPURESET) != 0x00)                                  // Ensure CPUreset register reads 0 and so FT8xx is ready   
    {
    }
   
    // ------------------------- Display settings ------------------------------

    // WQVGA display parameters
    lcdWidth   = 800;                                                           // Active width of LCD display
    lcdHeight  = 480;                                                           // Active height of LCD display
    lcdHcycle  = 928;                                                           // Total number of clocks per line
    lcdHoffset = 88;                                                            // Start of active line
    lcdHsync0  = 0;                                                             // Start of horizontal sync pulse
    lcdHsync1  = 48;                                                            // End of horizontal sync pulse
    lcdVcycle  = 525;                                                           // Total number of lines per screen
    lcdVoffset = 32;                                                            // Start of active screen
    lcdVsync0  = 0;                                                             // Start of vertical sync pulse
    lcdVsync1  = 3;                                                             // End of vertical sync pulse
    lcdPclk    = 2;                                                             // Pixel Clock
    lcdSwizzle = 0;                                                             // Define RGB output pins
    lcdPclkpol = 1;                                                             // Define active edge of PCLK
       
    EVE_MemWrite16(REG_HSIZE,   lcdWidth);     
    EVE_MemWrite16(REG_HCYCLE,  lcdHcycle);     
    EVE_MemWrite16(REG_HOFFSET, lcdHoffset);   
    EVE_MemWrite16(REG_HSYNC0,  lcdHsync0);     
    EVE_MemWrite16(REG_HSYNC1,  lcdHsync1);     
    EVE_MemWrite16(REG_VSIZE,   lcdHeight);     
    EVE_MemWrite16(REG_VCYCLE,  lcdVcycle);     
    EVE_MemWrite16(REG_VOFFSET, lcdVoffset);   
    EVE_MemWrite16(REG_VSYNC0,  lcdVsync0);     
    EVE_MemWrite16(REG_VSYNC1,  lcdVsync1);     
    EVE_MemWrite8(REG_SWIZZLE,  lcdSwizzle);   
    EVE_MemWrite8(REG_PCLK_POL, lcdPclkpol);   
   
       
    // ---------------------- Touch and Audio settings -------------------------

    EVE_MemWrite16(REG_TOUCH_RZTHRESH, 1200);                                   // Eliminate any false touches

    EVE_MemWrite8(REG_VOL_PB, ZERO);                                            // turn recorded audio volume down
    EVE_MemWrite8(REG_VOL_SOUND, ZERO);                                         // turn volume down
    EVE_MemWrite16(REG_SOUND, 0x6000);                                          // set volume mute
       
   
    // ---------------- Configure the GPIO and PWM  --------------------
   
    EVE_MemWrite8(REG_PWM_DUTY, 0);                                             // Backlight off
   
    FT81x_GPIO_DAT = EVE_MemRead16(REG_GPIOX);                                  // Read the FT81x GPIO register for a read/modify/write operation
    FT81x_GPIO_DAT = FT81x_GPIO_DAT | 0x8000;                                   // set bit 15 of GPIO register (DISP). If using audio, also enable the amplifier shutdown GPIO line here
    EVE_MemWrite16(REG_GPIOX, FT81x_GPIO_DAT);                                  // Enable the DISP signal to the LCD panel

    FT81x_GPIO_DIR = EVE_MemRead16(REG_GPIOX_DIR);                              // Read the FT81x GPIO DIR register for a read/modify/write operation
    FT81x_GPIO_DIR = FT81x_GPIO_DIR | 0x8000;                                   // DISP is output, if using audio, also set the associated shutdown line as output (check your Eval module schematic))
    EVE_MemWrite16(REG_GPIOX_DIR, FT81x_GPIO_DIR);                              // Enable the DISP signal to the LCD panel
       

    // ---------------------- Create an initial screen before we enable the display -------------------------

    ramDisplayList = RAM_DL;                                                    // start of Display List
    EVE_MemWrite32(ramDisplayList, 0x02000000);                                 // Clear Color RGB sets the colour to clear screen to

    ramDisplayList += 4;                                                        // point to next location
    EVE_MemWrite32(ramDisplayList, (0x26000000 | 0x00000007));                  // Clear 00100110 -------- -------- -----CST  (C/S/T define which parameters to clear)

    ramDisplayList += 4;                                                        // point to next location
    EVE_MemWrite32(ramDisplayList, 0x00000000);                                 // DISPLAY command 00000000 00000000 00000000 00000000 (end of display list)

    EVE_MemWrite32(REG_DLSWAP, DLSWAP_FRAME);                                   // Swap display list to make the edited one active

    // -------------------- Now turn on PCLK and ramp the PWM up  -------------------------------------
    // ---------------- This provides a clean start-up for the application ----------------------------
       
    EVE_MemWrite8(REG_PCLK, lcdPclk);                                           // Now start clocking data to the LCD panel

    MCU_Delay_20ms();
   
    for(PWM = 0; PWM <= 127; PWM ++)
    {
        EVE_MemWrite8(REG_PWM_DUTY, PWM);     
        MCU_Delay_20ms();
    }

Note the "Create an initial screen before we enable the display" creates a blank display before issuing the first display list in your application to EVE, this should mitigate any screen 'glitches' seen after initialization.

Unfortunately however there are not registers available to detect whether or not the screen has already been initialized. I would suggest if your are using two separate libraries and these include two separate initialization sequences that you could check for a given value in one of the display registers (width for example) if this has already been written you could then abort the initialization code within the ESD library section of your application.

Best Regards,
BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 391
    • View Profile
Re: Avoid double init of the screen between Boot and App
« Reply #2 on: June 18, 2021, 09:48:10 AM »

If EVE is not initialized yet it should not even answer on the SPI, so reading all bytes as 0x00.
If EVE is in ACTIVE state the first four bytes of every SPI response are 0x00 0x4a 0x43 0x42.
Usually these first four bytes are ignored by the reading functions though.

Reading REG_FRAMES might an option, maybe twice.
If EVE is up and running there should be a small positive number in there and if read twice the second one should be higher.
Also reading REG_FREQUENCY would be an option for BT81x if it is configured for 72MHz.
Logged

Cyrilou

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Avoid double init of the screen between Boot and App
« Reply #3 on: June 18, 2021, 02:18:51 PM »

Thanks for your help. For your information, I'm using matrix orbital library with my boot.
Logged