Errors flashing NodeMCU to ESP8266

强颜欢笑 提交于 2019-12-24 06:04:39

问题


I've been having a bit of a rough time trying to flash the latest dev firmware. I've edited the question with a bunch of copy/paste examples from my cli and to clarify the steps I've taken so far. Here's what I've tried doing:

  • I downloaded the 1.4.0 master and dev versions of firmware from the custom build service.
  • I tried to flash the 1.4.0 master version with this command:

    python esptool.py --port /dev/ttyUSB0 write_flash -fm=dio -fs=32m 0x00000 ~/git/nodemcu-
    firmware/bin/nodemcu_integer_1.4.0_master_20160531.bin 
    esptool.py v1.0.2-dev
    Connecting...
    Running Cesanta flasher stub...
    Flash params set to 0x0240
    Writing 405504 @ 0x0... 405504 (100 %)
    Wrote 405504 bytes at 0x0 in 35.2 seconds (92.2 kbit/s)...
    Leaving...
    
  • This appears to succeed because I can connect to the devkit

    n?$B�
          ��4"*���4"*��B%,��� C�
    NodeMCU custom build by frightanic.com
            branch: master
            commit: c8037568571edb5c568c2f8231e4f8ce0683b883
            SSL: false
            modules: file,gpio,i2c,net,node,rtcfifo,rtcmem,rtctime,tmr,uart,wifi,ws2812
     build  built on: 2016-06-01 02:58
     powered by Lua 5.1.4 on SDK 1.4.0
    lua: cannot open init.lua
    > 
    
  • I downloaded v1.5.1 nonos of the espressif sdk to get the esp_init_data_default.bin I had to do this because the devkit was running 0.9.6

  • I tried to flash the 1.4.0 dev version of the firmware with this command:

    python esptool.py --port /dev/ttyUSB0 write_flash -fm=dio -fs=32m 0x00000 ~/git/nodemcu-firmware/bin/nodemcu_integer_1.4.0_dev_20160531.bin 0x3fc000 ~/git/nodemcu-firmware/bin/esp_init_data_default.bin 
    esptool.py v1.0.2-dev
    Connecting...
    Running Cesanta flasher stub...
    Flash params set to 0x0240
    Writing 401408 @ 0x0... 401408 (100 %)
    Wrote 401408 bytes at 0x0 in 34.8 seconds (92.3 kbit/s)...
    Writing 4096 @ 0x3fc000... 4096 (100 %)
    Wrote 4096 bytes at 0x3fc000 in 0.4 seconds (90.0 kbit/s)...
    Leaving...
    
  • This appears to fail because when I try to connect to the devkit I get nothing but gibberish. I have tried to connect with EVERY baud setting and it doesn't appear to improve the gibberish at all.

    rll|l�|l�b|�rbb�nnlnn��bplrlrlp�n�lbn�|l�b�nn�ll`nn
                                                 lnr�n
    
                                                       b��`p�n�
    
                                                                  r���bn�|llb�nn�l`nnl�l`nr�n
    
                                                                                                 ��l``�n
    
    
                                                                                                         ��b�nl�
                                                                                                                ��nn�
                                                                                                                     lp�n�
    
      r���lbn�|b�nn�ll`
    

The master version of the firmware works very well, but as I said its missing a couple things from wifi and ws2812 modules that I want to use. The dev version of the firmware does flash, but when I try to use screen to connect to the devkit all I get is gibberish and a Lua prompt never shows up. I'm giving up now I don't know what to try next so can somebody please guide me?

Thanks for any help.


回答1:


Your wording regarding branches and versions is a bit confusing (to me at least). dev is based on SDK v1.5.1 while for master it's 1.4.0.

You don't need to flash the firmware plus the SDK. The firmware itself is enough. Since you reference our flashing docs I assume you got the esptool.py command right.

Two things worth noting:

  • I reckon you mention esp_init_data_default.bin because of the byte-107-dance? No longer necessary if you're on the dev branch because of adc.force_init_mode(), we just had this yesterday. Or is this because you previously had old 0.9.x firmware on the device? If so, did you get the address for esp_init_data_default.bin right i.e. aligned to your device's flash size?
  • We've got auto-baud detection in dev. I'm not sure how nice this plays with screen. Try setting 115'200 explicitly or try ESPlorer.

Update

Allow me to say that I believe you created a total mess. Also, I have reason to believe the reports and the output in your Q ain't the whole truth.

  • Again, there's no such thing as v1.4 dev. dev is based on SDK 1.5.1, master uses 1.4.
  • You claim to use my custom build service. Yet, in your first cmd line excerpt the filename and path is ~/git/nodemcu-firmware/bin/nodemcu_integer_1.4.0_master_20160531.bin. This hints that you're building the firmware yourself (using my Docker image?). The file names generated by the build service use the pattern nodemcu-<branch>-<number>-modules-<timestamp>-integer|float while my Docker image by default generates something like nodemcu_integer|float_<branch>_<timestamp>.
  • But then again your second snippet undoubtedly shows that you successfully load a firmware from the NodeMCU master branch built by my custom build service.
  • And then you flash something like "1.4.0 dev" (doesn't exist) built locally PLUS esp_init_data_default.bin? I don't get it. The NodeMCU flashing docs say that you only need esp_init_data_default.bin when directly upgrading from 0.9.x - if at all. So, if you already have master (1.4) there's absolutely no need for that.

Sorry, really can't help any further. I believe the road to success for you is really simple:

  • got to http://nodemcu-build.com/
  • select the dev branch plus all desired modules
  • download the binary
  • esptool.py --port /dev/ttyUSB0 write_flash -fm=dio -fs=32m 0x00000 nodemcu-dev-N-modules-2016-06-03-<time>-integer.bin



回答2:


It turns out that there is a bug with screen that keeps it from communicating to the devkit on firmware versions 1.5 and above. To work around this issue you can either use putty for linux (available from apt-get if you're on ubuntu) or downgrade your firmware to 1.4

See this answer on SuperUser for some detailed info: https://superuser.com/questions/810937/how-can-i-set-the-parity-bits-when-using-screen-to-access-a-serial-port

P.s. I have only confirmed this bug on armhf compiled binaries. It is possible that the x86 binaries work just fine as I have not tested it, though the Q&A on SuperUser that I linked seems to imply that screen on x86 will have problems too.



来源:https://stackoverflow.com/questions/37559525/errors-flashing-nodemcu-to-esp8266

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!