ESP8266 Developer Zone The Official ESP8266 Forum 2016-06-08T18:47:41+08:00 https://bbs.espressif.com:443/feed.php?f=66&t=1090 2016-06-08T18:47:41+08:00 2016-06-08T18:47:41+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7263#p7263 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]>
Thank you :)

Statistics: Posted by gustavo — Wed Jun 08, 2016 6:47 pm


]]>
2016-06-07T13:34:55+08:00 2016-06-07T13:34:55+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7238#p7238 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]>
spi_flash_erase_sector(0x90); // Here should be the sector number 0x90

spi_flash_write(0x90000, temp, sizeof(temp)); // Here should be the flash address 0x90000

Statistics: Posted by ESP_Faye — Tue Jun 07, 2016 1:34 pm


]]>
2016-06-03T22:44:34+08:00 2016-06-03T22:44:34+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7200#p7200 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]> At the very least point to some documentation which explains the difference.

Nonetheless I'm still having problems:

The following code:

Code:

void user_init(void)
{
    printf("SDK version:%s\n", system_get_sdk_version());
   
    uint32 temp[4]={0x05, 0x06, 0x07, 0x08};
    uint32 temp1[4]={0};
   
    int l = 0x90000;
    printf("l: %d - 0x%x\n", l, l);
    int i = spi_flash_erase_sector(l);
    printf("spi_flash_erase_sector: %d\n", i);
    int o = spi_flash_write(l, temp, sizeof(temp));
    printf("spi_flash_write: %d\n", o);

    int p = spi_flash_read(l, temp1, sizeof(temp1));
    printf("spi_flash_read: %d\n", p);

    printf("read :0x%x, 0x%x, 0x%x, 0x%x\n", temp1[0], temp1[1], temp1[2], temp1[3]);

    uint32 temp2[4] = {0x01, 0x02, 0x03, 0x04};
    i = spi_flash_erase_sector(l);
    printf("spi_flash_erase_sector: %d\n", i);
    o = spi_flash_write(l, temp2, sizeof(temp2));
    printf("spi_flash_write: %d\n", o);

    p = spi_flash_read(l, temp1, sizeof(temp1));
    printf("spi_flash_read: %d\n", p);
   
    printf("read :0x%x, 0x%x, 0x%x, 0x%x\n", temp1[0], temp1[1], temp1[2], temp1[3]);
}

prints:

Code:

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000

OS SDK ver: 1.4.0(c599790) compiled @ Mar  1 2016 17:25:17

SDK version:1.4.0(c599790)
l: 589824 - 0x90000
spi_flash_erase_sector: 0
spi_flash_write: 0
spi_flash_read: 0
read :0x1, 0x2, 0x3, 0x0
spi_flash_erase_sector: 0
spi_flash_write: 0
spi_flash_read: 0
read :0x1, 0x2, 0x3, 0x0

There's a 0x4 missing.

And If I try some other position, for example 0x250000
I get:

Code:

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000

OS SDK ver: 1.4.0(c599790) compiled @ Mar  1 2016 17:25:17

SDK version:1.4.0(c599790)
l: 2424832 - 0x250000
spi_flash_erase_sector: 0
spi_flash_write: 0
spi_flash_read: 0
read :0x0, 0x0, 0x0, 0x0
spi_flash_erase_sector: 0
spi_flash_write: 0
spi_flash_read: 0
read :0x0, 0x0, 0x0, 0x0

And can't run the same code again without flashing:

Code:

ets Jan  8 2013,rst cause:2, boot mode:(3,6)

ets_main.c


By my understanding, based on the 99c-esp8266_ota_upgrade_en_v1.6.pdf document, user data should go from 0x200000 to 0x3FC000.

Statistics: Posted by gustavo — Fri Jun 03, 2016 10:44 pm


]]>
2016-06-03T11:29:54+08:00 2016-06-03T11:29:54+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7190#p7190 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]>
You can refer to the esptool on github https://github.com/themadinventor/esptool, it can set the corresponding flash size.

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Fri Jun 03, 2016 11:29 am


]]>
2016-06-02T16:51:45+08:00 2016-06-02T16:51:45+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7181#p7181 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]> Could you explain please?

Is there a way to flash with these settings with esptool?
Or can I use this flash tool on Linux?

Statistics: Posted by gustavo — Thu Jun 02, 2016 4:51 pm


]]>
2016-06-02T14:03:58+08:00 2016-06-02T14:03:58+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7177#p7177 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]>
Please select "32Mbit-C1" on the "Flash Size" area of the ESP Flash Download Tool, and download it again.

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Thu Jun 02, 2016 2:03 pm


]]>
2016-06-01T18:02:52+08:00 2016-06-01T18:02:52+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7172#p7172 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]>
bins.zip

flash.png

Statistics: Posted by gustavo — Wed Jun 01, 2016 6:02 pm


]]>
2016-06-01T11:22:16+08:00 2016-06-01T11:22:16+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7162#p7162 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]>
Please use the ESP Flash Download Tool to download your bin files into flash.

If your problem is still unsolved, please provide the captured picture of ESP Flash Download Tool while downloading, and your bin files, we will have a try.

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Wed Jun 01, 2016 11:22 am


]]>
2016-05-31T17:38:34+08:00 2016-05-31T17:38:34+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7151#p7151 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]> You can find a copy in: http://www.darkwire.com.au/Downloads/BG25Q32A.pdf

I bought an ESP12E from eBay.

Statistics: Posted by gustavo — Tue May 31, 2016 5:38 pm


]]>
2016-05-31T11:36:49+08:00 2016-05-31T11:36:49+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7145#p7145 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]>
Sorry that we can not reproduce your problem. We tested the code you provided, it works fine.

Can you provide the datasheet of your flash (BergMicro 25Q32ASSIG) ?

Statistics: Posted by ESP_Faye — Tue May 31, 2016 11:36 am


]]>
2016-05-30T23:15:54+08:00 2016-05-30T23:15:54+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7143#p7143 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]>

Code:

   
void user_init(void)
{
    printf("SDK version:%s\n", system_get_sdk_version());
   
    uint32 temp[4]={0x05, 0x06, 0x07, 0x08};
    uint32 temp1[4]={0};
   
    int i = spi_flash_erase_sector(0x8c);
    printf("spi_flash_erase_sector: %d\n", i);
    int o = spi_flash_write(0x8c000, temp, sizeof(temp));
    printf("spi_flash_write: %d\n", o);

    int p = spi_flash_read(0x8c000, temp1, sizeof(temp1));
    printf("spi_flash_read: %d\n", p);
   
    printf("read :%x, %x, %x, %x\n", temp1[0], temp1[1], temp1[2], temp1[3]);
}


And I got the following output:

Code:

spi_flash_erase_sector: 1
spi_flash_write: 1
spi_flash_read: 1
read :0, 0, 0, 0


Which is SPI_FLASH_RESULT_ERR for all the calls.
I'm running the RTOS version of the SDK.

I also posted this as a discussion on the esp8266.com forum: http://www.esp8266.com/viewtopic.php?f=6&t=10116

My flash is marked BergMicro 25Q32ASSIG (32Mbits).

Statistics: Posted by gustavo — Mon May 30, 2016 11:15 pm


]]>
2016-05-27T17:08:37+08:00 2016-05-27T17:08:37+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7107#p7107 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]>
Sorry that we can not reproduce your problem.
Here is our test code

Code:

void user_init(void)
{
    os_printf("SDK version:%s\n", system_get_sdk_version());
   
    uint32 temp[4]={0x05, 0x06, 0x07, 0x08};
    uint32 temp1[4]={0};
   
    spi_flash_erase_sector(0x8c);
    spi_flash_write(0x8c000, temp, sizeof(temp));

    spi_flash_read(0x8c000, temp1, sizeof(temp1));
   
    os_printf("read :%x, %x, %x, %x\n", temp1[0], temp1[1], temp1[2], temp1[3]);

}


If your problem is still unsolved, please provide your whole test project, we will help debug it.

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Fri May 27, 2016 5:08 pm


]]>
2016-05-24T17:25:53+08:00 2016-05-24T17:25:53+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=7052#p7052 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]> did you find the problem with the flash?

I'm having the same issue.

Statistics: Posted by gustavo — Tue May 24, 2016 5:25 pm


]]>
2015-09-18T10:51:57+08:00 2015-09-18T10:51:57+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=3743#p3743 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]>
tried your code with no luck, fatal exception happened in this line :

Code:

flashchip->chip_size = 0x01000000;


the "fatal exception thingy" even happened when i just only try to peek the flashchip->chip_size using this code :

Code:

uint32 save_chip_size = flashchip->chip_size;
printf("flashchip->chip_size=%d\n",save_chip_size);
//flashchip->chip_size = 0x01000000; // Open all 16Mbytes

( i just only peek the var, not even alter it -- already commented the line below the printf(bla bla) )

Fatal exception (9):
epc1=0x4027200a
epc2=0x00000000
epc3=0x00000000
epcvaddr=0x001640f3
depc=0x00000000
rtn_add=0x40271fff

nb:
i use RTOS SDK v 2015-Aug-21 ( system_get_sdk_version() return "1.1.0(6009786)"), so the first time i try your code, the compiler gave me error :

Code:

error: unknown type name 'SpiFlashChip'
 extern SpiFlashChip * flashchip; // in RAM-BIOS: 0x3fffc714
 ^

in order to make it compiled, i have to overwrite the spi_flash.h file at the include/espressif folder (of the RTOS SDK) with the spi_flash.h file from the NON RTOS SDK (version 2015-Aug-08).

best regards,

Statistics: Posted by septijo — Fri Sep 18, 2015 10:51 am


]]>
2015-09-13T08:08:02+08:00 2015-09-13T08:08:02+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=3670#p3670 <![CDATA[Re: spi_flash_write and / or spi_flash_read not work above 0x80000]]>
septijo wrote:
Hi all,
I've encountered weird problem upon (erase+)write and read it back, on SPI flash above 0x80000,
....
any advice ? anyone ?

Code:

extern SpiFlashChip * flashchip; // in RAM-BIOS: 0x3fffc714
....
uint32 save_chip_size = flashchip->chip_size;
flashchip->chip_size = 0x01000000; // Open all 16Mbytes
// save data to flash
spi_flash_erase_sector(PRIV_PARAM_START_SEC + PRIV_PARAM_SAVE);
spi_flash_write((PRIV_PARAM_START_SEC + PRIV_PARAM_SAVE) * SPI_FLASH_SEC_SIZE,
  (uint32 *) &npConfigData, sizeof(struct structConfigData));

// read it back, i can get my previously saved data, only if i set the sector below 0x80000
spi_flash_read((PRIV_PARAM_START_SEC + PRIV_PARAM_SAVE) * SPI_FLASH_SEC_SIZE,
  (uint32 *) &npConfigData, sizeof(struct structConfigData));
flashchip->chip_size = save_chip_size;

Statistics: Posted by pvvx — Sun Sep 13, 2015 8:08 am


]]>
2015-09-11T20:00:27+08:00 2015-09-11T20:00:27+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1090&p=3657#p3657 <![CDATA[spi_flash_write and / or spi_flash_read not work above 0x80000]]>
I've encountered weird problem upon (erase+)write and read it back, on SPI flash above 0x80000,
no matter which option i choose when compiling :
* make COMPILE=gcc BOOT=none APP=0 SPI_SPEED=40 SPI_MODE=QIO SPI_SIZE_MAP=6
>> i flashed :
** "eagle.flash.bin" @ 0x00000
** "eagle.irom0text.bin" @ 0x40000
* make COMPILE=gcc BOOT=new APP=1 SPI_SPEED=40 SPI_MODE=QIO SPI_SIZE_MAP=6
>> i flashed :
** "boot_v1.4(b1).bin" @ 0x00000
** "upgrade\user1.4096.new.6.bin" @ 0x01000

if i (erase+)write the data to SPI Flash @ 0x3C000 (i've also tried 0x7C000), i can read it back successfully.
but when i try to (erase+)write the data @ 0x8C000, i can not read it back (the data returned is not my previously saved).

my sourcecode :

Code:

//#define PRIV_PARAM_START_SEC      0x3C // >> ok
//#define PRIV_PARAM_START_SEC      0x7C // >> ok
#define PRIV_PARAM_START_SEC      0x8C // >> fail

struct structConfigData {
  char magic[16];
  uint8_t switch1_mode;
  uint8_t switch1_timerHourOn1;
  uint8_t switch1_timerMinuteOn1;
  uint8_t switch1_timerHourOff1;
  uint8_t switch1_timerMinuteOff1;
  uint8_t switch1_timerRandomMinute1;
  uint8_t wifi_mode; // 0 = none, 1=AP, 2=Station 3=Both
  char wifi_station_SSID[32];
  char wifi_station_password[64];
  char wifi_softAP_SSID[32];
  char wifi_softAP_password[64];
  uint8 wifi_softAP_channel;
  AUTH_MODE wifi_softAP_authMode;
  uint8 wifi_softAP_SSID_hidden;
};
struct structConfigData npConfigData;

// save data to flash
spi_flash_erase_sector(PRIV_PARAM_START_SEC + PRIV_PARAM_SAVE);
spi_flash_write((PRIV_PARAM_START_SEC + PRIV_PARAM_SAVE) * SPI_FLASH_SEC_SIZE,
  (uint32 *) &npConfigData, sizeof(struct structConfigData));

// read it back, i can get my previously saved data, only if i set the sector below 0x80000
spi_flash_read((PRIV_PARAM_START_SEC + PRIV_PARAM_SAVE) * SPI_FLASH_SEC_SIZE,
  (uint32 *) &npConfigData, sizeof(struct structConfigData));


here is my flash downlaod tools screenshoot
Image

any advice ? anyone ?

Statistics: Posted by septijo — Fri Sep 11, 2015 8:00 pm


]]>