D1 Clones

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
ChuckMcM
Posts: 9
Joined: Wed May 20, 2020 2:00 am
Contact:

D1 Clones

Post by ChuckMcM » Wed May 20, 2020 2:39 am

Hi All,

A friend of mine showed me uPython on the D1 Mini and I was very impressed. I bought a pack of 10 on AliExpress and have used them in many things. I got a Wio Link from Seeed Studio and put the generic build on it and it has issues, the repl comes up but it randomly resets. To debug that I got spun up on building from source. Since I was down to my last D1, I ordered 10 more from another vendor. These were similar but didn't have a metal can over them like the first ones I bought did. They also report a flash of 4M with a vendor of 0xEF. Looking at the chips they are marked BoyaMicro, which makes a 4M flash but reports a different vendor ID. I started putting the current build in these boards and no REPL, the serial port just spews junk and then stops. I used the same image in my older D1 and it comes up fine (t reports a Winbond flash and the flash ID seems to match). Trying to see if my new clone boards were functional at all I threw them on the Arduino IDE and loaded blink into them, that seems to work fine.

So there are *LOTS* of things going on clearly. I'm in the process of working to eliminate unknowns. I'm an EE/CS engineer that has done embedded programming for several decades with a fully equipped lab including SMT rework capability and a microscope. So I've got the tools and the chops to debug this down to the component level if necessary. I am also fully aware of the kinds of games these no-name Chinese board vendors play to be a few cents cheaper than the next guy.

But BEFORE I dump 20 or 30 hours into doing component swaps or what not. I'd be interested in thoughts on where to start in terms of looking at these systems programmatically. JTAG seems to be out of the question but esptool.py and the Arduino IDE both seem capable of loading arbitrary software into the flash and from the blink example it seems to work. My target is to get Micropython running on all these boards (not a big fan of the Arduino IDE / Wiring model). I had already started digging into the code to see what was what with the Wio Link but being able to hack on these $3 D1 clones is even better (well about 5 times better since a Wio Link board goes for $15 :-)).

UART1 TX works as expected under the Arduino IDE, and I the IDE lets me load programs and run them, so the current plan is to test FLASH then each of the GPIOs. Assuming that all the hardware works, the question will become "Where is the CPU initialized in the Micropython port and what configuration file controls the configuration options?" I noticed that the Arduino IDE runs things at 80 MHz, does python? Or does it try to run at 160MHz by default? Etc. I'm treating this as a bringup exercise for unknown hardware with a known good hardware example. Ideally the core differences will be isolated quickly and I'll be able to contribute something useful to this community.

--Chuck

ChuckMcM
Posts: 9
Joined: Wed May 20, 2020 2:00 am
Contact:

Re: D1 Clones

Post by ChuckMcM » Wed May 20, 2020 4:59 am

Okay, easy question. The ESP8266 can run at 80MHz or 160Mhz, what is the default and where does that get set?

DJShadow1966
Posts: 56
Joined: Sun Jun 23, 2019 4:55 am
Location: Gateshead, Tyne and Wear

Re: D1 Clones

Post by DJShadow1966 » Wed May 20, 2020 5:18 am

Hello

I have a couple of boards myself with similar issues and after some digging and looking at the memory chips using arduino code, I found that the chips were being registered as 16meg chips were not so I bought a few 16meg chips and replaced them on the boards and now all working.

Regards Mike

ChuckMcM
Posts: 9
Joined: Wed May 20, 2020 2:00 am
Contact:

Re: D1 Clones

Post by ChuckMcM » Wed May 20, 2020 6:00 am

Thanks, I'm still looking at things.

Online
User avatar
Roberthh
Posts: 2023
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: D1 Clones

Post by Roberthh » Wed May 20, 2020 6:27 am

The ESP8266 can run at 80MHz or 160Mhz, what is the default and where does that get set?
The default is 80 MHz. You can use machine.freq() to change the setting.

User avatar
jimmo
Posts: 1700
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: D1 Clones

Post by jimmo » Wed May 20, 2020 7:19 am

Hi,

My first thought was flash size (i.e. they're not really 4MiB). Have you tried flashing the 512kiB or 1MiB versions instead?

And is there anything interesting in the esptool.py output (and check that it's definitely a recent version of esptool.py -- which might be one difference to Arduino). Might be worth experimenting with dio/qio modes too.

If you're going to start experimenting with debugging this from the software side, then ports/esp8266/main.c is the place to start, but the main thing is getting a build environment set up. I highly recommend the docker option described in ports/esp8266/README.md

User avatar
deshipu
Posts: 1362
Joined: Thu May 28, 2015 5:54 pm

Re: D1 Clones

Post by deshipu » Wed May 20, 2020 11:07 am

You need to specify the flash mode when flashing your firmware — different boards will have the flash connected differently. There are four possible combinations, so you can just try them all and see which one works.

If the flash chip is 16MB, the default micropython will not work — there are ways of getting it to work, or you can just force flash size to 4MB when flashing, and it will simply just not use the remaining space.

kwiley
Posts: 102
Joined: Wed May 16, 2018 5:53 pm
Contact:

Re: D1 Clones

Post by kwiley » Wed May 20, 2020 9:12 pm

When you get your own issues sorted out, I would be very interested to know if you can confirm whether or not your D1 boards successfully wake from deep sleep with the RTC alarm. It is widely acknowledged on a number of forums, github issues, etc. that various ESP8266 systems, including bare ESP-12 boards in various E/F configurations, as well as wrappers around those boards, like the D1 mini, cannot be coaxed into behaving properly on an RTC deep sleep wake-up. I have two D1 mini clones from completely different venders and manufacturers that both exhibit exactly the same erroneous behavior, so I have completely given up on spending more money, time, or effort on the D1s until I can get some confirmations that these things actually work. Since you have such a large number at your disposal, I would love your input on this matter.

Thank you very much...and good luck with your own challenges with the D1. It would be nice to able to use them as MicroPython environments in a reliable manner.

Cheers!

ChuckMcM
Posts: 9
Joined: Wed May 20, 2020 2:00 am
Contact:

Re: D1 Clones

Post by ChuckMcM » Sat May 23, 2020 10:39 pm

jimmo wrote:
Wed May 20, 2020 7:19 am
Hi,

My first thought was flash size (i.e. they're not really 4MiB). Have you tried flashing the 512kiB or 1MiB versions instead?
Yes, that was the first thing I tried. It appears that they are smaller than 512kiB. I've built all of the generic versions. The Arduino code "works" for small sketches, and with that I'm exploring the access to the SPI flash and its size.

The big red flag is that the flash chips are marked "BoyaMicro" and return a manufacturer ID of 0xEF (not BoyaMicro) so their providence is less than stellar.
--Chuck

User avatar
tve
Posts: 210
Joined: Wed Jan 01, 2020 10:12 pm
Location: Santa Barbara, CA
Contact:

Re: D1 Clones

Post by tve » Sat May 23, 2020 11:22 pm

> I bought a pack of 10 on AliExpress and have used them in many things.

When comes the point where the best thing to do is to put those 10 into a little baggie, put a "Mistake!" note onto it, pin the whole thing to the wall in front you as a reminder, and then order a couple of esp32 boards? ;-) ;-)
Or continue to use those 10 for the other "many things" but not for MP...

Post Reply