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

Main Menu

Erasing FLASH in BT815's full speed mode

Started by lorcap, September 18, 2019, 10:00:34 AM

Previous topic - Next topic

lorcap

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):

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_FLASHDETACH â†' CMD_FLASHATTACH â†' CMD_FLASHERASE â†' CMD_FLASHWRITE(unified.blob) â†' CMD_FLASHFAST cycle. I didn't experiment with it because I can live with writing FLASH at normal speed.

pauljiao

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.

lorcap

Quote from: pauljiao 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
You're right. I fixed my post by adding an extra CMD_FLASHWRITE(unified.blob).

Quote from: pauljiao on September 20, 2019, 03:14:07 AM
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.