cnlohr / esp82xx

Useful ESP8266 C Environment
Other
289 stars 107 forks source link

Added -fm dio into make burn for NodeMCU and some ESP-12E boards #30

Closed leopck closed 8 years ago

leopck commented 8 years ago

Hi, I would like to request for PR to resolve an issue faced in NodeMCU while I was doing for espusb #https://github.com/cnlohr/espusb/issues/3

This issue is stated inside the esptool docs https://github.com/themadinventor/esptool/tree/4deca7033e17d9b8d3b947a2d8f7ec3700d7d276#flash-mode---flash_mode--fm

Some ESP8266 modules, including the ESP-12E modules on some (not all) NodeMCU boards, are dual I/O and will only work with --flash_mode dio.

I'm not sure whether you guys prefer to have another if-else checker to check the chip model e.g. "8285,8266,NodeMCU" but currently I'm just adding -fm dio into the 8266 chip since I've tested this against other ESP8266 and it seems to work well.

cnlohr commented 8 years ago

Tested. Works well. I don't see any downsides. Any idea why it wouldn't be the default mode?

leopck commented 8 years ago

The default mode of esptool will use --flash_mode qio.

I am not sure why does some of the ESP-12E models have different configuration for programming their chip, apparently qio is the most common while the rest of the ESP-12E models uses dio. Probably some ESP12E models comes with a DIO flash only? I think currently it's safe to stick with DIO since it can also work for QIO flash probably need more ppl to test this out and see.

The benefit of using dio (Dual IO uses 2 lines for data) is that it frees GPIO 9 and GPIO 10 which previously was used for SPI flashing in qio (Quad IO uses 4 lines for data for up to 4 times the speed of standard)

cnlohr commented 8 years ago

Does that mean GPIO9 + GPIO10 are free on the ESP8285? I asked a while ago and no one told me which two GPIOs became free.

leopck commented 8 years ago

Hm, that's a good question. I don't have a ESP8285 to test this out unfortunately. But GPIO 9 + 10 would be free using DIO for ESP8266. I think this can be easily verified by running a simple LED blink on GPIO 9 and GPIO 10 on the ESP8285.

Regarding the ESP8266, I test run for you just to double verify whether GPIO 9 and GPIO 10 would be free. So I ran a simple blink on GPIO9, GPIO10 and it works perfectly. At least for 8266 I can say that it'll free the GPIO.

Now espressif did mention that 8285 is merely just 8266 + 1Mbyte flash. image And from the datasheet it states it is using dual out mode (DOUT) so I do think logically that GPIO 9 + 10 is free. It'll be interesting to know that. Hope you can test this and let me know :D

cnlohr commented 8 years ago

Thank you so much! I didn't see that. I knew it had a flash, I didn't know that about it internally. This whole dual mode / quad mode stuff is all new to me. Thank you thank you about the 9/10 thing!

leopck commented 8 years ago

You're welcome man :D I'm glad I could be of help to you.