logo elektroda
logo elektroda
X
logo elektroda

How to replace the memory in the ESP8266 with 4MB - video instructions

Chumanista 7287 18
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 15851222
    Chumanista
    Level 14  
    Hi!
    I made a video on how to replace the memory in the ESP8266 with the largest supported memory - 4MB.
    I hope it will help someone:


  • ADVERTISEMENT
  • #2 15851321
    excray
    Level 41  
    Strange. Recently I read a statement of a colleague from this forum, who explained cases of frequent "falls" of memory bones by the fact that ESP creates its own data structure on the flash and violation of this structure causes an error signaled as a flash bone damage. Meanwhile, you solder in a clean flash, not formatted in any way, and the chip gets up and works without any problems. Interesting case.
  • #3 15851344
    Chumanista
    Level 14  
    My bet is that I use it with the Ardiuno IDE in that I force-boot the chip from the UART and upload the code, while my colleague used some NodeMCU or other such creation.
    In my version only the compiled code is stored in the flash, nothing is left in between programming.
  • #4 15851349
    excray
    Level 41  
    Chumanista wrote:
    a colleague was using some sort of NodeMCU

    This is correct - this colleague is using a NodeMCU.
  • #5 15851374
    Chumanista
    Level 14  
    Well it in flash holds the whole LUA interpreter and file system in flash. And I just keep the program.
  • #6 15851495
    piotrva
    VIP Meritorious for electroda.pl
    But the fact is that flashes with a "clean" program also fail. So what if the flash works, if the program has even 1 byte corrupted and goes bushy? :D
  • ADVERTISEMENT
  • #7 15851501
    excray
    Level 41  
    Buddy, maybe you know of a site where it is written from scratch how to configure the arduino to work with ESP? I've just downloaded myself an arduino but in tools->board I don't have esp and so I'm struggling a bit. I've downloaded the Arduino-master library from github, but trying to upload it via "show zip" doesn't do anything, and manually pasting it into the libraries folder gives me a message that the library is invalid after rebooting.
  • ADVERTISEMENT
  • #9 15851699
    excray
    Level 41  
    Hey, thanks for the link. I configure as described and also according to this video:
    https://www.youtube.com/watch?v=tMRpYmDgkL0
    and the moment I want to upload the program on the ESP I get the error: "warning: espcomm_send_command: didn't receive command response
    warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
    error: espcomm_upload_mem failed"
    The port and transmission parameters are good - I can see the responses in the RSa monitor. Do I need to have any special firmware loaded on these my D1 mini?

    Added after 26 [minutes]:

    Correction. They were good. They are no longer. I took another module and the program loaded. And the previous one no longer works on 115200 but on 74880bps and after a reset it returns something like this " ets Jan 8 2013,rst cause:2, boot mode:( 3,7)" Is there any way I can reset/return it to life?
  • #10 15852202
    piotr411
    Level 22  
    This is a typical data integrity loss error on flash, power has been disconnected while writing data and there is a zong. It doesn't matter what is uploaded to the flash, whether Arduino, Basic, Lua. Some memories can be saved by formatting the memory. You can find the program at ESPBASIC.COM. It formats to 1MB in the first instance, if this is successful, you re-win the firmware you are interested in. As for programming ESP in Arduino, you have to bear in mind that this is the worst of the programming languages for ESP, due to the gigantic memory devouring by reserving memory for variables. That's why it's RTOS, Lua, or Basic very convenient for software updates, because the editor is supported from the web. Going back to the file system, ESP has its own and it doesn't matter the programming language, when the die is clean, it formats itself. If there is an error in the flash, ESP goes into an endless loop and does not boot, it then throws an error on COM at 74880. It can also flash showing that it is ok loaded firmware, but does not want to boot after a reset. There is no golden remedy for this so far, at least not known to me apart from trying to format the flash with a program from ESP BASIC.
  • #11 15852244
    excray
    Level 41  
    So, as I understand it, since ESPBASIC does not work I am left with physically replacing the FLASH bone?
  • #12 15852748
    piotr411
    Level 22  
    The bone itself is probably the issue, it needs to be formatted. There are a few programs for this, including this one from the ESP BASIC website, if you find others try it, there's bound to be some way to format the memory correctly. Formatting should be "", as this is about some overwritten files that ESP adds to itself. This is easy to check, just with the formatting program from Basic. Even if you have 16MB plugged in and you format to 512, ESP only sees 512kb, not 16MB. Some memory manages to revive this way, others not. Why, I don't know. On many forums the topic is discussed and I haven't found any specifics. I think you could ask yourself, the author of ESP BASIC, what the formatting is about and look for a solution to the problem along that line.
  • #13 16024965
    putonr
    Level 2  
    Someone wrote that 4M is the max I have seen options with 32M. Is it the 32M that is the problem? Will it be possible to use them?
  • #14 16025202
    tmf
    VIP Meritorious for electroda.pl
    Rather, it is 32 Mbits, or 4 Mbytes.
  • ADVERTISEMENT
  • #15 16025333
    piotr411
    Level 22  
    In part, TMF has given you the answer. The 32Mbits mentioned are 4Mbytes. However, the maximum value that the firmware allows to be addressed is 128Mbit, or 16Mbytes. This is the memory that the ESP-13 module is equipped with. Of course, you can equip the ESP with more memory, but this does not apply to your question;)
  • #16 16031055
    krzbor
    Level 28  
    I have already programmed several ESPs (both 01 and 12). They work very well. However, I wanted to know more about how they work - how does the FLASH work with the internal RAM? How does the memory work in the RTC? How is the data "arranged" in the FLASH?
    Here my question - has anyone seen a good description (Polish or English) of these technically more advanced details?
  • #17 18440545
    JoteR
    Level 24  
    "Meanwhile, you solder in a clean flash that has not been formatted in any way and the chip gets up and works without any problems. Interesting case."

    And yes ;->
    I came across this article after the fact. Namely, I had a couple of modules from ESP-01 (not "S") with the infamous PUYA memories, to which I tried to upload ESP Basic. It uploaded, yes, it uploaded, but what the modules were doing to the file system was [self-censored]. Thinking little of it, I ordered a couple of W25Q80BVSIG cubes from the Chinese and - thinking a little - a couple of W25Q32BVSIGs. In the so-called meantime, I received the ESP-01S and ESP-12F ordered earlier, so I forgot about the topic. When, after the traditional 2 months, I found a package in my mailbox and in it - surprisingly - actually Winbonds, I got down to work. And indeed - after soldering, the chips got up without any problems, only in the case of a 32 megabit bone I had to mark in the programmer (I use ESP8266 Download Tool) the size not 32Mbit but 32Mbit-C1, whatever C1 means. So far ESP Basic isn't crashing, so the operation seems to have gone well. Although the thread has long since died, I've decided to throw in my 3 cents, in case some unfortunate PUYA memory module owner is digging for a solution. Don't fiddle with libraries trying to tame these memories, order the dice, solder and enjoy fully working (and in the case of 32 Mbit dice even improved) modules. Unless you stay with firmware with AT+ commands up to and including version 1.6.2, with that even these PUYAs work fine, maybe because the file system is not created there.
  • #18 18444934
    kaczakat
    Level 34  
    I had a couple of ESP-01s with this PUYA flash and they worked flawlessly as long as the program did not modify the flash content while the module was running (i.e. normal file operations, for example). In my opinion, however, it is easier to add a few lines to "/cores/esp8266/Esp.cpp":
    
    bool EspClass::flashWrite(uint32_t offset, uint32_t *data, size_t size) {
    -    ets_isr_mask(FLASH_INT_MASK);
    -    int rc = spi_flash_write(offset, (uint32_t*) data, size);
    -    ets_isr_unmask(FLASH_INT_MASK);
    -    return rc == 0;
    +	static uint32_t flash_chip_id = 0;
    +
    +	if (flash_chip_id == 0)
    +		flash_chip_id = getFlashChipId();
    +	ets_isr_mask(FLASH_INT_MASK);
    +	int rc;
    +	uint32_t* ptr = data;
    +	if ((flash_chip_id & 0x000000ff) == 0x85) { // 0x146085 PUYA
    +		static uint32_t read_buf[SPI_FLASH_SEC_SIZE / 4];
    +		rc = spi_flash_read(offset, read_buf, size);
    +		if (rc != 0) {
    +			ets_isr_unmask(FLASH_INT_MASK);
    +			return false;
    +		}
    +		for (size_t i = 0; i < size / 4; ++i) {
    +			read_buf[i] &= data[i];
    +		}
    +		ptr = read_buf;
    +	}
    +	rc = spi_flash_write(offset, ptr, size);
    +	ets_isr_unmask(FLASH_INT_MASK);
    +	return rc == 0;
     }
    

    (where - comment it out, that's where plus add it) than re-soldering the flash bone.
    Helpful post? Buy me a coffee.
  • #19 18445642
    JoteR
    Level 24  
    > "In my opinion, however, it is easier to add a few lines to "/cores/esp8266/Esp.cpp:
    [...] than to re-solder the flash bone."

    Let me disagree with this. Re-soldering the memory (at a cost of a few zlotys) solves the problem radically, and when using a 32-Mbit bone it "enriches" the module by the way. In addition, for users of e.g. ESP Basic, uploading ready firmware in the form of .bin and creating .bas programs, the object "/cores/esp8266/Esp.cpp" is a foreign class element and I, for example, do not even have a clue where I would make these corrections.
ADVERTISEMENT