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: Limits of multiple Custom Fonts (ASTC, from flash) "on top" of each other  (Read 488 times)

Elmryn

  • Newbie
  • *
  • Posts: 2
    • View Profile

Hello,

I am new to working with an BT815 and consitently experience display artifacts when trying to display text in a custom font in a specific way. The font works properly as long as I only use a single font. As soon as multiple fonts are overlapping it starts flickering and displaying the artifacts.

I load the fonts from flash(glyphs in flash, xfont in ram_g) and set them with the EVE_CMD_SETFONT2 command.
All of the fonts are ~800KB in total right now(might be even more in the future), but still working on and finding new ways to make this less.

Since the code I use in the actual application is quite complex, I produced a minimal version of this, where this issue is still coming up:
Code: [Select]
    EVE_LIB_BeginCoProList();
    EVE_CMD_DLSTART();
    EVE_CLEAR_COLOR_RGB(0, 0, 0);
    EVE_CLEAR(1, 1, 1);
    EVE_VERTEX_FORMAT(0);

    EVE_CMD_TEXT(0, 0, NUNITO_SANS_32, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 0, NUNITO_SANS_24, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 0, NUNITO_SANS_32, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 0, NUNITO_SANS_24, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");

    EVE_DISPLAY();
    EVE_CMD_SWAP();
    EVE_LIB_EndCoProList();
    EVE_LIB_AwaitCoProEmpty();

But this is working
Code: [Select]
    EVE_LIB_BeginCoProList();
    EVE_CMD_DLSTART();
    EVE_CLEAR_COLOR_RGB(0, 0, 0);
    EVE_CLEAR(1, 1, 1);
    EVE_VERTEX_FORMAT(0);

    EVE_CMD_TEXT(0, 0, NUNITO_SANS_32, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 100, NUNITO_SANS_24, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 200, NUNITO_SANS_32, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 300, NUNITO_SANS_24, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");

    EVE_DISPLAY();
    EVE_CMD_SWAP();
    EVE_LIB_EndCoProList();
    EVE_LIB_AwaitCoProEmpty();

I found a Problem in the forum, which sounds like the problem I have, so the bandwidth could be the issue here(but the font loaded in that topic is way bigger, only a single font and the topic seemed stale - with a warning to post there):
http://www.brtcommunity.com/index.php?topic=298.0

The solutions over there did not work for me or are not feasible, more details to me trying out the solutions:
- turning on adaptive frame rate did not do anything, the display does not support it
- adaptive HSync is sadly not available on BT815
- loading the font from RAM_G -> I would like to avoid it, because I need to load a couple of fonts, which will use up too much space, because I also need a broad spectrum of characters for different languages and there are already icons in RAM_G to avoid this problem when loading icons/image.
- flash IC is already in FULL state
- switching to BT817 is not possible right now, too many devices to replace

I am very thankfull for ideas on how to handle this issue and maybe someone can verify this problem for me, just in case I was not smart enough to load the font properly or the issue lies somwhere else entirely.

Im still hoping I dont have to work around the issue, but we will see.

Best
Elmryn
« Last Edit: December 03, 2024, 09:13:36 AM by Elmryn »
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 788
    • View Profile
Re: Limits of multiple Custom Fonts (ASTC, from flash) "on top" of each other
« Reply #1 on: December 03, 2024, 11:52:44 AM »

Hello,

Thank you for your post.

Could I ask what Display settings you are utilising for your LCD panel? and what system clock you have the BT815 running at?

Best Regards,
BRT Community
Logged

Elmryn

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Limits of multiple Custom Fonts (ASTC, from flash) "on top" of each other
« Reply #2 on: December 19, 2024, 01:59:52 PM »

Hi,

Display is 800x480 pixels.
We have 12 MHz oscillator connected to the BT815. We run the Display at 72Mhz.
Here is the whole display-setup:

Code: [Select]
    MCU_Init(); // set up esp32s3-spi-driver (runs at 16 MHz)

    // Set Chip Select OFF
    HAL_ChipSelect(0);

    // Reset the display
    MCU_Delay_20ms();
    HAL_PowerDown(1);
    MCU_Delay_20ms();
    HAL_PowerDown(0);
    MCU_Delay_20ms();

    // can optionally set to 72MHz system clock here
    // In this case also adjust REG_FREQUENCY a few lines down from here in this file
    HAL_HostCmdWrite(0x44, 0x00); // 0x44 = HostCMD_CLKEXT
    HAL_HostCmdWrite(0x61, 0x46); // 0x46 = 01000110 -> 6 times osc-frequency (12MHz * 6)


    HAL_HostCmdWrite(0x68, 0x00); // Reset


    // Set active
    HAL_HostCmdWrite(0, 0x00);

    // MCU_Delay_500ms(); // Optional delay can be commented so long as we check the REG_ID and REG_CPURESET

    // Read REG_ID register (0x302000) until reads 0x7C
    while ((val = HAL_MemRead8(EVE_REG_ID)) != 0x7C)
    {
    }

    // Ensure CPUreset register reads 0 and so FT8xx is ready
    while (HAL_MemRead8(EVE_REG_CPURESET) != 0x00)
    {
    }

    HAL_MemWrite32(EVE_REG_FREQUENCY, 12 * 6 * 1000 * 1000);

    // This function will not return unless an EVE device is present.
    MCU_Setup();


// ------------------------- Display settings ------------------------------
    // LCD display parameters
    // Active width of LCD display
    HAL_MemWrite16(EVE_REG_HSIZE, EVE_DISP_WIDTH);
    // Total number of clocks per line
    HAL_MemWrite16(EVE_REG_HCYCLE, EVE_DISP_HCYCLE);
    // Start of active line
    HAL_MemWrite16(EVE_REG_HOFFSET, EVE_DISP_HOFFSET);
    // Start of horizontal sync pulse
    HAL_MemWrite16(EVE_REG_HSYNC0, EVE_DISP_HSYNC0);
    // End of horizontal sync pulse
    HAL_MemWrite16(EVE_REG_HSYNC1, EVE_DISP_HSYNC1);
    // Active height of LCD display
    HAL_MemWrite16(EVE_REG_VSIZE, EVE_DISP_HEIGHT);
    // Total number of lines per screen
    HAL_MemWrite16(EVE_REG_VCYCLE, EVE_DISP_VCYCLE);
    // Start of active screen
    HAL_MemWrite16(EVE_REG_VOFFSET, EVE_DISP_VOFFSET);
    // Start of vertical sync pulse
    HAL_MemWrite16(EVE_REG_VSYNC0, EVE_DISP_VSYNC0);
    // End of vertical sync pulse
    HAL_MemWrite16(EVE_REG_VSYNC1, EVE_DISP_VSYNC1);
    // Define RGB output pins
    HAL_MemWrite8(EVE_REG_SWIZZLE, EVE_DISP_SWIZZLE);
    // Define active edge of PCLK
    HAL_MemWrite8(EVE_REG_PCLK_POL, EVE_DISP_PCLKPOL);
    // Turn on or off CSpread
    HAL_MemWrite8(EVE_REG_CSPREAD, EVE_DISP_CSPREAD);
    // Turn on or off Dither
    HAL_MemWrite8(EVE_REG_DITHER, EVE_DISP_DITHER);

    // Write first display list
    HAL_MemWrite32((EVE_RAM_DL + 0), EVE_ENC_CLEAR_COLOR_RGB(0, 0, 0));
    HAL_MemWrite32((EVE_RAM_DL + 4), EVE_ENC_CLEAR(1, 1, 1));
    HAL_MemWrite32((EVE_RAM_DL + 8), EVE_ENC_DISPLAY());
    HAL_MemWrite8(EVE_REG_DLSWAP, EVE_DLSWAP_FRAME);

    // Read the  GPIO register for a read/modify/write operation
    regGpio = HAL_MemRead8(EVE_REG_GPIO);
    // set bit 7 of  GPIO register (DISP) - others are inputs
    regGpio = regGpio | 0x80;
    // Enable the DISP signal to the LCD panel
    HAL_MemWrite8(EVE_REG_GPIO, regGpio);

    // Write the PCLK or PCLK_FREQ register
    HAL_MemWrite8(EVE_REG_PCLK, EVE_DISP_PCLK); // EVE_DISP_PCLK = 2

    HAL_MemWrite8(EVE_REG_PWM_DUTY, 127);

    // ---------------------- Touch and Audio settings -------------------------
    // Eliminate any false touches
    HAL_MemWrite16(EVE_REG_TOUCH_RZTHRESH, 1200);

    // turn recorded audio volume down
    HAL_MemWrite8(EVE_REG_VOL_PB, EVE_VOL_ZERO);
    // turn synthesizer volume down
    HAL_MemWrite8(EVE_REG_VOL_SOUND, EVE_VOL_ZERO);
    // set synthesizer to mute
    HAL_MemWrite16(EVE_REG_SOUND, 0x6000);

    // --------------------- Clear screen ready to start -----------------------
    EVE_LIB_BeginCoProListDelayed();
    EVE_CMD_DLSTART();
    EVE_CLEAR_COLOR_RGB(0, 0, 0);
    EVE_CLEAR(1, 1, 1);
    EVE_DISPLAY();
    EVE_CMD_SWAP();
    EVE_LIB_EndCoProList();
    EVE_LIB_AwaitCoProEmptyDelayed();

    // ---------------------- Reset all bitmap properties ------------------------
    EVE_LIB_BeginCoProListDelayed();
    EVE_CMD_DLSTART();
    EVE_CLEAR_COLOR_RGB(0, 0, 0);
    EVE_CLEAR(1, 1, 1);
    for (i = 0; i < 16; i++)
    {
        EVE_BITMAP_HANDLE(i);
        EVE_CMD_SETBITMAP(0, 0, 0, 0);
    }
    EVE_DISPLAY();
    EVE_CMD_SWAP();
    EVE_LIB_EndCoProList();
    EVE_LIB_AwaitCoProEmptyDelayed();


Flash is running in full speed mode.

And one more thing: We used a 10pt font. Could it do any better if we use a 7pt font?

Best
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 788
    • View Profile
Re: Limits of multiple Custom Fonts (ASTC, from flash) "on top" of each other
« Reply #3 on: December 20, 2024, 02:04:20 PM »

Hello,

Thank you for the update.

I note from your initialization code that you are indeed using a System Clock of 72Mhz, but that you are using a REG_PCLK = 2, this would clock the LCD displays pixel clock at 36MHz.
Please refer to Table 4-11 in the BT815 datasheet for the available Pixel clock rates.

Do you have access to the datasheet for the LCD panel that you are using in your application?
This should list a min/typ/max PCLK values for the panel, as a first test i think we should try reducing the PCLK for the display to the datasheets typical value, as this will give EVE more time to render assets which are stored in flash during a screen refresh cycle. If you do not have the datasheet to hand you can incrementally increase the REG_PCLK value until the screen stops rendering data (for example, try: 3, 4, 5, 6, 7, etc).

Best Regards,
BRT Community
Logged