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: Erasing FLASH in BT815's full speed mode  (Read 9755 times)

lorcap

  • Newbie
  • *
  • Posts: 9
    • View Profile
Erasing FLASH in BT815's full speed mode
« on: September 18, 2019, 10:00:34 AM »

Hi everyone,

I noticed that working in full speed mode, attached FLASH in not actually erased. Application note BRT_AN_033 - BT81X Series Programming Guide, version 1.1, table at chapter 2.8 Flash Interface, states it's possible, though. I'm wondering if I'm making any mistake.

The following pseudo-code fills buffer with 0x55 and FLASH content is not wiped out (running the code again returns actual data over and over):
Code: [Select]
unsigned ram_g = 0xff00;
unsigned flash_addr = 4096
char buffer[256];

// FLASH contains proper unified.blob
flashfast();

flashread(ram_g, flash_addr, sizeof(buffer));
read_memory(ram_g, buffer, sizeof(buffer)); // buffer contains actual data

flasherase();

flashread(ram_g, flash_addr, sizeof(buffer));
read_memory(ram_g, buffer, sizeof(buffer)); // buffer is filled with 0x55

If I comment out the line with flashfast(), FLASH gets erased (process takes much longer) and buffer is filled with 0xff.

There's no counterpart to CMD_FLASHFAST, thus I believe one should go through the CMD_FLASHDETACHCMD_FLASHATTACHCMD_FLASHERASECMD_FLASHWRITE(unified.blob)CMD_FLASHFAST cycle. I didn't experiment with it because I can live with writing FLASH at normal speed.
« Last Edit: September 20, 2019, 10:41:59 AM by lorcap »
Logged

pauljiao

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Erasing FLASH in BT815's full speed mode
« Reply #1 on: September 20, 2019, 03:14:07 AM »

First, "CMD_FLASHDETACH → CMD_FLASHATTACH → CMD_FLASHERASE → CMD_FLASHFAST cycle"  is not feasible because after flash is erased , it is in Basic mode and there is no way to way to go back the full speed mode,  due to the lack of flash driver(known as blob).  The flash erase
will write every bytes of the whole chip into 0xFF. 
So you shall not run the cycle again and again.

Secondly,  at my side,  with your code logic, cmd_flashread can read the flash sector correctly
after cmd_flasherase is done.   The buffer is filled with 0xFF, not 0x55.
Logged

lorcap

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Erasing FLASH in BT815's full speed mode
« Reply #2 on: September 20, 2019, 10:50:59 AM »

First, "CMD_FLASHDETACH → CMD_FLASHATTACH → CMD_FLASHERASE → CMD_FLASHFAST cycle"  is not feasible because after flash is erased
You're right. I fixed my post by adding an extra CMD_FLASHWRITE(unified.blob).

Secondly,  at my side,  with your code logic, cmd_flashread can read the flash sector correctly
after cmd_flasherase is done.   The buffer is filled with 0xFF, not 0x55.
If your run the code again, what do you read? 0xFF or the older FLASH content?

In my test I didn't switch off the board, rather I started over and sent a RST_PULSE host command before accessing the FLASH again.
Logged