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: Displaing an image from flash  (Read 10513 times)

Rad

  • Newbie
  • *
  • Posts: 11
    • View Profile
Displaing an image from flash
« on: August 01, 2023, 07:21:29 AM »

Hi there,

I am struggling to perform the above action. I did the steps as follow:
1. using EAB (v2.8.0 ), Image util. tab - converted image with COMPRESSED_RGBA_ASTC_4x4_KHR
2. using EAB (v2.8.0 ), Flash util. tab - added ".raw", and generated .bin file (with result as in the attachment)
and updated & verified an external flash of BT817 (EAB with MPSSE module is capable to detect flash and change to flash to FAST mode).
3. with STM32 MCU, after EVE init (flash in BASE state) - tried to display image with code:
cmd_dlstart();
cmd_setbitmap(0x800000 | 4160/32, COMPRESSED_RGBA_ASTC_4x4_KHR, 528, 304);
cmd(CLEAR(1,1,1));
cmd(BEGIN(BITMAPS));
cmd(VERTEX2II(10, 10, 0, 0));
cmd(END());

but only blank screen is visible...
Smaller picture also does not help.

What could be wrong, how to detect the root cause and how to fix it?

Is there a possibility to read image from flash in another way?

I was able to upload a small image data via SPI into RAM_G and then display it successfully (same code but cmd_setbitmap(0,COMPRESSED_RGBA_ASTC_4x4_KHR, 52, 30) ).


Edit:
With CMD_ FlashRead(0, 0, 4096) used and then reading RAM_G (with Rd8() - the same function as when reading chip ID - from addr 0 onwards) the returned values are just "FF"s for quite long part of memory (while bolb file starts with 70 DF...). While EAB flash utility reads same values as in the file flash was written with.

No idea what happens here...

« Last Edit: August 02, 2023, 07:00:27 PM by Rad »
Logged

Matrix Orbital

  • Newbie
  • *
  • Posts: 34
    • View Profile
    • Matrix Orbital
Re: Displaing an image from flash
« Reply #1 on: August 02, 2023, 08:19:16 PM »

Rad,

This might help:

Programming manual section 2.8 Flash Interface:  "Direct rendering of ASTC based bitmaps from flash is only possible in FLASH_STATE_FULL. "

If you are using a Matrix Orbital display give support a shout, we have full example code for this.
« Last Edit: August 02, 2023, 08:21:02 PM by Matrix Orbital »
Logged
Matrix Orbital
Display Solution Provider

Embedded HDMI TFT's, EVE2, EVE3 & EVE4 TFT's, Serial LCD's, USB, LCD's

www.matrixorbital.com
www.lcdforums.com/forums

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 746
    • View Profile
Re: Displaing an image from flash
« Reply #2 on: August 04, 2023, 03:13:14 PM »

Hello Rad,

As Matrix Orbital have mentioned, please try running the sample code below to place the flash IC in fast mode and let us know if that fixes your issue.

Code: [Select]
void Flash_Full_Speed(void)
{
        uint8_t Flash_Status = 0;

 

        // Detach Flash
        EVE_LIB_BeginCoProList();
        EVE_CMD_FLASHDETATCH();
        EVE_LIB_EndCoProList();
        EVE_LIB_AwaitCoProEmpty();

 

        Flash_Status = HAL_MemRead8(EVE_REG_FLASH_STATUS);

 

        if (EVE_FLASH_STATUS_DETACHED != Flash_Status)
        {
            EVE_LIB_BeginCoProList();
            EVE_CMD_DLSTART();
            EVE_CLEAR_COLOR_RGB(255, 0, 0);
            EVE_CLEAR(1,1,1);
            EVE_COLOR_RGB(255,255,255);
            EVE_CMD_TEXT(100, 50, 28, 0, "Error detaching flash");
            EVE_CMD_TEXT(100,100, 28, EVE_OPT_FORMAT, "Mode is %d ", Flash_Status);
            EVE_DISPLAY();
            EVE_CMD_SWAP();
            EVE_LIB_EndCoProList();
            EVE_LIB_AwaitCoProEmpty();
            while(1)
            {
            }
        }

 

        // Attach
        EVE_LIB_BeginCoProList();
        EVE_CMD_FLASHATTACH();
        EVE_LIB_EndCoProList();
        EVE_LIB_AwaitCoProEmpty();

 

        Flash_Status = HAL_MemRead8(EVE_REG_FLASH_STATUS);

 

        if (EVE_FLASH_STATUS_BASIC != Flash_Status)
        {
            EVE_LIB_BeginCoProList();
            EVE_CMD_DLSTART();
            EVE_CLEAR_COLOR_RGB(0, 255, 0);
            EVE_CLEAR(1,1,1);
            EVE_COLOR_RGB(255,255,255);
            EVE_CMD_TEXT(100, 50, 28, 0, "Error attaching flash");
            EVE_CMD_TEXT(100,100, 28, EVE_OPT_FORMAT, "Mode is %d ", Flash_Status);
            EVE_DISPLAY();
            EVE_CMD_SWAP();
            EVE_LIB_EndCoProList();
            EVE_LIB_AwaitCoProEmpty();
            while(1)
            {
            }
        }

 

        // Fast mode
        EVE_LIB_BeginCoProList();
        EVE_CMD_FLASHFAST(0);
        EVE_LIB_EndCoProList();
        EVE_LIB_AwaitCoProEmpty();

 

        Flash_Status = HAL_MemRead8(EVE_REG_FLASH_STATUS);

 

        if (EVE_FLASH_STATUS_FULL != Flash_Status)
        {

 

            EVE_LIB_BeginCoProList();
            EVE_CMD_DLSTART();
            EVE_CLEAR(1,1,1);
            EVE_CLEAR_COLOR_RGB(0, 0, 255);
            EVE_COLOR_RGB(255,255,255);
            EVE_CMD_TEXT(100, 50, 28, 0, "Error going to full mode");
            EVE_CMD_TEXT(100,100, 28, EVE_OPT_FORMAT, "Mode is %d ", Flash_Status);
            EVE_DISPLAY();
            EVE_CMD_SWAP();
            EVE_LIB_EndCoProList();
            EVE_LIB_AwaitCoProEmpty();
            while(1)
            {
            }
        }

}


Best regards
BRT Community
Logged

Rad

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Displaing an image from flash
« Reply #3 on: August 08, 2023, 08:49:01 PM »

Thank you for your replies.

I am trying to put it into fast mode. However I have two questions:

1. I try to put into fast mode straight after EVE inits and a check the state of external flash as basic mode. In the manual I can see that this is (probably the only one) command that reads back a result - Command layout:
+0 CMD_FLASHFAST (0xFFFF FF4A)
+4 result
so I build it as (looking at Matrix's code):
  void EVE_FlashFast(void)
  {
    Send_CMD(CMD_FLASHFAST);
    Send_CMD(0);
  }
The manual is not that clear how to execute this and only says: "When the host MCU calls CMD_FLASHFAST".
I tried two ways of sending this command:
- both subcommands transmitted as Host Memory Write (section 4.1.4 in data sheet) format,
- first as write and second as read.

But either way this command causes that EVE crashes, by meaning of REG_CMD_READ gives 4095 (although reading RAM_ERR_REPORT gives only zeros).

2. Does the flash need to be detached, attached back and then put into fast mode? Can it not be put into fast mode straight after initialization (and eventually checked if is in basic mode)?

 
« Last Edit: August 09, 2023, 05:41:28 AM by Rad »
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 391
    • View Profile
Re: Displaing an image from flash
« Reply #4 on: August 09, 2023, 04:41:51 PM »

I have a function that works fine for putting the attached flash in fast mode.
Check EVE_init_flash() from: https://github.com/RudolphRiedel/FT800-FT813/blob/5.x/EVE_commands.c
My EVE_cmd_flashfast() also is a bit different in that it does not only issue the command, it waits for completion, reads back
the return value from Eve and returns that value.

Quote
2. Does the flash need to be detached, attached back and then put into fast mode?

No, it does not, what I usually observe is that the status for the flash is "Basic" after initialization.

Quote
Can it not be put into fast mode straight after initialization (and eventually checked if is in basic mode)?

In my basic example I call my EVE_init(), set the backlight PWM, calibrate the touch.
Then I call EVE_init_flash() and if it returns E_OK, a .xfont file is read from the flash.
So yes, pretty much straight after initialization, at this point no images are loaded to RAM_G and only the initial empy display list is executed.
« Last Edit: August 14, 2023, 04:07:06 PM by Rudolph »
Logged

Rad

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Displaing an image from flash
« Reply #5 on: September 05, 2023, 08:50:08 AM »

I made a first step forward - managed to put flash into fast mode.
Thank you Matrix Orbital for pointing me out the problem.
And as always big thanks to Rudolph - your way of putting EVE into fast mode (sending CMD_FLASHFAST to REG_CMDB_WRITE followed by 4x "0") worked straight away! :)

EDIT:
I made some progress, however I got stuck again...
When I try to display w picture directly from flash EVE_SetBitmap(0x800000 | 130 , COMPRESSED_RGBA_ASTC_12x12_KHR, 1056, 612); //0x800000 | (4160/32)
then it does not work - a previous screen is slowly fading to black...

but when I read it from flash (to ram) and then I try to display
EVE_FlashRead(0, 4160, 71808);
EVE_SetBitmap(0 , COMPRESSED_RGBA_ASTC_12x12_KHR, 1056, 612);
then all is working just fine...

Could you point me the root cause/solution?

Thanks in advance!


« Last Edit: September 11, 2023, 06:27:36 AM by Rad »
Logged