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: BT816 : flash reading fail  (Read 18758 times)

yle

  • Newbie
  • *
  • Posts: 7
    • View Profile
BT816 : flash reading fail
« on: April 29, 2020, 02:23:52 PM »

Hi everyone,

Up to now I was using the FT810 with custom font loaded by the MCU at startup. Today I’m working on the BT816 with a flash to store my custom font and improve the startup time.

I’m facing an issue to work with the flash. I’m only able to erase it but neither the write not the read command works.
When I send the CMD_FLASHERASE command, I wait up to the REG_CMD_READ reaches the REG_CMD_WRITE. It takes few seconds (almost 25s for a 16M flash).
But when I send the CMD_FLASHREAD command to control that 0xFF have been written in the flash, this command never end. The REG_CMD_READ is never reaching the REG_CMD_WRITE.
I’m stuck at this point. Do you have any idea about what is causing this problem?

Any help or suggestion you can provide would be greatly appreciated.
Thank you.
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 744
    • View Profile
Re: BT816 : flash reading fail
« Reply #1 on: April 30, 2020, 04:50:21 PM »

Hello,

Would it be possible to see your code?
And can you let me know which EVE library you are using?

Best Regards,
BRT Community
Logged

yle

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: BT816 : flash reading fail
« Reply #2 on: May 05, 2020, 02:01:55 PM »

Hi,
Thank you for your response,
I started my development by copying the Riverdi’s EVE3_flash_write example from github. 
Here is the code I try to execute.

Code: [Select]
    Gpu_CoCmd_FlashHelper_Init(&Gpu);
    Gpu_CoCmd_FlashHelper_SwitchState(&Gpu, FLASH_STATUS_BASIC);

    ubyte fl_status = Ft_Hal_Read8(&Gpu, REG_FLASH_STATUS);
    ubyte fl_size = Ft_Hal_Read8(&Gpu, REG_FLASH_SIZE);

    if ( (Fl_Test == TRUE) && (fl_status == FLASH_STATUS_BASIC) && (fl_size == 16) ) {
        ubyte tmp[4096];
        Memory_Set_Byte(tmp, 0x00, 4096);

        Gpu_CoCmd_FlashHelper_Erase(&Gpu);
        Gpu_CoCmd_FlashHelper_Read(&Gpu, 0, 0, 4096, tmp);
    }

I’m able to reach the Erase function (flash status is set to 2 and flash size to 16). This function takes about 25 seconds. But the next function Read doesn’t finish. It loops in Gpu_Hal_WaitCmdfifo_empty waiting for REG_CMD_READ be equal to REG_CMD_WRITE.

Best Regards,
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 744
    • View Profile
Re: BT816 : flash reading fail
« Reply #3 on: May 06, 2020, 04:56:18 PM »

Hello,

Can you try flushing the co-pro buffer and double checking the REG_CMD_READ and REG_CMD_WRITE pointers are equal before issuing the flash read command as per the below example?

Code: [Select]
bool_t AppFlashErase(void)
{
/* Erase the flash */
uint8_t status = Gpu_Hal_Rd8(g_phost, REG_FLASH_STATUS);
#ifdef _DEBUG
printf("\nFlash status %d (%s)\n", status, flash_status[status]);
#endif
if (status == FLASH_STATUS_DETACHED)
{
Gpu_CoCmd_FlashAttach(g_phost);
App_Flush_Co_Buffer(g_phost);
Gpu_Hal_WaitCmdfifo_empty(g_phost);
status = Gpu_Hal_Rd8(g_phost, REG_FLASH_STATUS);
#ifdef _DEBUG
printf("Flash status %d (%s)\n", status, flash_status[status]);
#endif
if (FLASH_STATUS_BASIC != status)
{
printf("Error, Flash is not able to attach\n");
return FALSE;
}
}
printf("Erasing Flash...\n");
Gpu_CoCmd_FlashErase(g_phost);
App_Flush_Co_Buffer(g_phost);
Gpu_Hal_WaitCmdfifo_empty(g_phost);
/* Check first 4KB */
uint8_t *p_flashbuf = (uint8_t *)calloc(4 * 1024, sizeof(uint8_t));
Gpu_CoCmd_FlashHelper_Read(g_phost, 0, 0, 4 * 1024, p_flashbuf);
for (int i = 0; i < 4 * 1024; i++)
{
if (*(p_flashbuf++) != 0xFF)
{
return FALSE;
}
}
return TRUE;
}

Best Regards,
BRT Communnity
Logged

pauljiao

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: BT816 : flash reading fail
« Reply #4 on: May 08, 2020, 04:24:27 AM »

As far as I knew,  BT815/6 cannot work with a blank flash chip.  It requires a flash driver called blob locating at the first block of the flash chip.  After erasing of the flash, the first block of the flash chip might be erased too.  So you may need reprogram the blob to the flash before reading/writing.  The Blob file can be obtained from EAB.
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 391
    • View Profile
Re: BT816 : flash reading fail
« Reply #5 on: May 08, 2020, 09:48:14 AM »

You are right in that you need the binary blob (for which I still miss any explanation to what is in there) to actually use the FLASH directly as you can not put it in full-speed mode when the FLASH is missing the blob in the first block.
However, a couple of commands still work in basic mode: FLASHERASE, FLASHWRITE, FLASHREAD, FLASHDETACH, FLASHFAST.
Logged

yle

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: BT816 : flash reading fail
« Reply #6 on: May 12, 2020, 10:43:30 AM »

Hi,
I tried what you suggested but it didn’t work. I tried to write the blob firmware too (just in case) but the write command doesn’t work so…
Here is my code modified following your suggestions.

Code: [Select]
    Gpu_CoCmd_FlashHelper_Init(&Gpu);
    Gpu_CoCmd_FlashHelper_SwitchState(&Gpu, FLASH_STATUS_BASIC);

    ubyte fl_status = Ft_Hal_Read8(&Gpu, REG_FLASH_STATUS);
    ubyte fl_size = Ft_Hal_Read8(&Gpu, REG_FLASH_SIZE);

    if ( (fl_status == FLASH_STATUS_BASIC) && (fl_size == 16) ) {
        switch (Fl_Test) {
            case FL_ERASE:
                Gpu_CoCmd_FlashHelper_Erase(&Gpu);
                break;
            case FL_WRITE_BLOB:
//                Ft_Hal_Write_Mem(&Gpu, 0, BLOB, 4096);
//                Gpu_CoCmd_FlashUpdate(&Gpu, 0, 0, 4096);
                Gpu_CoCmd_FlashHelper_Write(&Gpu,0, 4096, (ubyte*)BLOB);

                break;
            case FL_READ:
                Memory_Set_Byte(Tmp, 0x00, 4096);
                App_Flush_Co_Buffer(&Gpu);
                Gpu_Hal_WaitCmdfifo_empty(&Gpu);
                Gpu_CoCmd_FlashHelper_Read(&Gpu, 0, 0x1000, 4096, Tmp);
                break;
        }
    }

What is strange is that, even when I start directly by reading the flash memory whithout erasing it first, I’m not able to read it. Read and Write commands seem to lead the chip to an abnormal behavior. But the chip works well if I don’t manage the flash, I mean, I’m able to use it to display widgets as when I was using an FT810.
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 744
    • View Profile
Re: BT816 : flash reading fail
« Reply #7 on: May 12, 2020, 04:49:35 PM »

Hello,

Could you give me some more details on the hardware you are using?
Are you using our VM816C50A or VM816CU50A?

Best Regards,
BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 391
    • View Profile
Re: BT816 : flash reading fail
« Reply #8 on: May 12, 2020, 05:32:08 PM »

I was about the write the same. :-)

Some infos about the hardware could be usefull.

Which FLASH chip are you trying to use?
EVE does not play with every single NOR FLASH chip out there, might be that most work but there
are definately some that do not work.

I was meaning to test a dozen or so more chips but right now I can't get my fingers on a socket for these.

See: http://www.brtcommunity.com/index.php?topic=77.msg318#msg318

Unfortunately no one else contributed to this list so far.

So one option for you could be to get yourself a W25Q128JVSIQ or a 25Q32JVSIQ and try it again.

Annother option would be that you provide enough information about your hardware that someone else could
provide test-code.
Which controller, using which pins for what and what are the display parameters?
Logged

yle

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: BT816 : flash reading fail
« Reply #9 on: May 13, 2020, 06:40:56 AM »

Hi,

I'm using a VM816C50A-D board connected to our device.
The 4 SPI signals and the PD signal are connected to the MCU and the eval board is powered by using the 5V entry on the J5 connector.
The eval board seems to be working pretty well. I started using the BT816 without changing anything on the source code which was working with the previous FT810 and I recovered all functionalities previously implemented. There are only flash's read and write commands that fail.

Regards,

Logged

yle

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: BT816 : flash reading fail
« Reply #10 on: May 13, 2020, 12:20:41 PM »

The VM816C50A-D embeds a 25Q128JVSQ flash chip.
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 744
    • View Profile
Re: BT816 : flash reading fail
« Reply #11 on: May 13, 2020, 02:45:22 PM »

Hello,

Which MCU are you using? you mentioned starting with Riverdis flash examples, have you been porting the examples for your given MCU platform?

Below is a link to the updated BRT samples for the BT81x series. In particular set10 deals with the new flash functionality:
SampleApp EVE_Samples_v1.1.0_RC_28062019.zip
These have been tested on the VM816C50A-D board.


Best Regards,
BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 391
    • View Profile
Re: BT816 : flash reading fail
« Reply #12 on: May 13, 2020, 05:27:18 PM »

I'm using a VM816C50A-D board connected to our device.

Hrm, and what happens when you connect the board to USB and use EAB to Erase/Write/Read the FLASH?
Logged