-->
Page 1 of 3

So many formats, so many different flashing setups! (WeMos)

PostPosted: Tue Apr 25, 2017 8:44 am
by alex_g
Hi all.

This is not a question, I've solved it now. However I thought I'd mention it in case it helps anyone.

Some background: I've been using ESP8266s a few months now, always with the NodeCMU firmware (Lua) and on the whole I've been getting everything I need done OK. I've used Devkit 0.9, Witty, ESP-07s and ESP-01s, all without problems. My toolkit is now invariably ESPtool.py and ESPlorer.

For flashing, the Devkit and the Witty are plug-and-play USB, and the ESP-07s gets soldered onto a breakout board which I plug into the Witty base. The ESP-01s get programmed on one of those USB stick-like adaptors to which I've an extra layer so that I can short GPIO0 and the RST. Funnily enough, I can't get the ESP-01 to flash on the Witty base, despite having tried out various breakout arrangements.

Now, yesterday I decided to enter the world of Arduino (never been there before) because I need access to some of the very rich library facilities it provides, not yet covered in the Lua setups. I had a WeMos D1 mini board set aside for the purpose. I figured that since it has a mini USB port, it would be plug-n-play, like the Devkits.

Haha, that's all I can say! I spent a lot of time thinking the WeMos was damaged and almost threw it away...
Under the Arduino IDE it would not even show a port. Then I tried the first test I usually do, [esptool ... flash_id]. Nada. Wouldn't connect to ESPlorer either, at any baud. Port not found, end of story.

Just before binning it, in an unusual moment of inspiration, I thought -- what if I ground D3 (GPIO0) and reset and then try to erase the flash? (It was a bit more complicated than that, but you get the idea). Well blow me down, the chip registered, and the flash was erased! I could now read the flash_id, too. I next tried to flash the sketch, it now registered the port fine, and did the deed! Whoopee! Then I tried to read the WeMos again with pytool and it wasn't working. Port didn't show on Arduino IDE either. And what's more, the sketch, even though flashed, was not working.

Well, obviously I thought, no, this one has had it, open the garbage can. But I held off a bit more, then I realised that if I now do a reset, the sketch does actually run.
(TL;DR) i.e Long story short:-
To flash the WeMos I have to take GPIO0 low and reset while there. Then I can flash, but need to reset again in order for the sketch to be run. However while running, the chip is not readable/flashable via USB, you have to do the D3 shorting thing for that. That's under Arduino. (I haven't even tried NodeMCU firmware yet, saving the pleasure for later)

Well, I'm pleased to have it working, but I did think it a bit peculiar, since the other setups with USB performed all that palaver automatically. However, I saw a lot of Web posts complaining about WeMos not working, so I just thought I'd mention it.

Right, off to play with some sketches now...

Re: So many formats, so many different flashing setups! (WeM

PostPosted: Tue Apr 25, 2017 9:05 am
by martinayotte
That is really strange.
I've several WeMos-D1-Mini and ArduinoIDE recognize them without any issues.

Re: So many formats, so many different flashing setups! (WeM

PostPosted: Tue Apr 25, 2017 9:14 am
by alex_g
Thanks for the feedback Martin, maybe the one I have is just "a bit" dud, after all.

I wanted to get some more WeMos D1s and also the new WeMos pro (with antenna and 16M), and I was a bit worried for a moment.

So I appreciate your reassurance, I think I'll get them anyway, it's still a very useful small format, having the USB port and all that...

=====

PS. One more little clarification of the behaviour, just in case it makes sense to anyone.

If I have my WeMos D1, with a freshly flashed, correctly working Arduino sketch, then "esptool flash_id" (and the Arduino IDE too) does not recognise it on the port. If I ground GPIO0 and reset, then 1) the sketch stops working 2) "esptool flash_id" recognises it correctly, returns the id, and then immediately resets the WeMos so that the sketch starts working again, as normal!

Of course, then the port is not recognised again until the D3->low-RST action, whereupon the cycle repeats... I can live with that, but I now suspect that it's not normal behaviour.

Re: So many formats, so many different flashing setups! (WeM

PostPosted: Tue Apr 25, 2017 12:14 pm
by martinayotte
Wait a minute ... I think I have a clue :
Are you saying that everything is working fine if GPIO0/RES sequence is done manually ?
If it is the case, then what type of board are you choosing in the ArduinoIDE ? Generic or Wemos-D1-Mini ?
Probably Generic ...
But this variant doesn't handle any GPIO/RES sequence, as you can see in boards.txt, therefore, no automatics.