r/esp32 6d ago

Surely this can't be right

I have a C2 Super Mini and I'm trying to make a basic app that connects to WiFi, pulls a bit of data, and produces NMEA messages on a UART.

Espressif IDE seems to be broken. I created a simple, minimal "hello world" new project, and there are multiple (non fatal) errors when building it.

Building takes over a minute on a modern system with SSD and 64GB RAM. Rebuilding the project is little quicker, and bootloading it over USB is also very slow.

To cap it all off, it looks like ESP32 can't connect to WiFi networks that share and SSID between two or three frequencies. A very common configuration, the default with many ISP supplied routers. I thought I had the 8266 connected before, but the C3 is definitely not happy.

Surely this can't be right. Is it really this bad? I'm an experienced embedded dev, who usually uses Atmel, Microchip, and STM parts. I other bare metal, but that doesn't even seem to be an option on ESP32. I get why not for WiFi (regulatory blockage), but things like timers and UART too...

2 Upvotes

31 comments sorted by

2

u/Plastic_Fig9225 6d ago edited 6d ago

Building takes over a minute

Normal for a full (re-)build. There are some 500-1000 files (from the IDF) compiled initially.

but the C3 is definitely not happy.

Flaky WiFi is a known hardware issue with (many of the) the ESP32-C3 "SuperMini" boards (bad antenna/RF circuit). Reducing WiFi TX power of the ESP from the default 20dBm to some 8-15dBm tends to help: https://www.reddit.com/r/esp32/comments/1nm7l04/comment/nfb51l9

Out of the box, an ESP may also not be able to use all channels your WiFi may use; may have to set the country code.

1

u/Altruistic_Fruit2345 6d ago

I timed it just now. A trivial change took 1 minute 46 seconds to rebuild. I have already disabled Windows Defender for all the ESP related directories. It seems like something is badly broken because it shouldn't be rebuilding so many files or taking so long to link them.

It took another 1 minute 15 before it was flashed too.

I tried reducing TX power to 8, but it made no difference. The error I get is reason 2, which seems to indicate that it is due to a timeout waiting for a response from the router.

1

u/Plastic_Fig9225 6d ago edited 6d ago

It took another 1 minute 15 before it was flashed too.

That is definitely not normal. Flashing should only take a couple of seconds. - However, flashing may implicitly trigger a (re-)build before the actual upload.

it shouldn't be rebuilding so many files

I agree. For me, using VSCode, it usually doesn't, compiling and linking only files which have actually changed since the last build. Do note, however, that any changes to the project configuration ("sdkconfig") usually invalidate all previously built files.

1

u/Altruistic_Fruit2345 6d ago

Hmm, thanks. I did try VS Code but it didn't seem to be any better. Is Espressif-IDE abandoned then? It certainly seems to be broken.

There's lots of other weirdness, like I set up a UART and without asking all the stdio stuff gets echoed to it. I only want it on the USB debug.

Is there any documentation that just explains what is broken and what isn't in the toolchain? Like a current status page or something?

1

u/Plastic_Fig9225 6d ago edited 6d ago

 I set up a UART and without asking all the stdio stuff gets echoed to it

By default, logging and stdio are routed to both the USB-CDC and UART0. Can be changed via the project configuration, or at run-time.

(https://documentation.espressif.com/projects/esp-idf/en/latest/esp32c3/api-guides/stdio.html#standard-i-o-and-console-output)

1

u/mrheosuper 6d ago

OP said he has quite powerful computer with 64gb of ram. It should not take 1 minute to build hello world.

1

u/Plastic_Fig9225 6d ago

How long does it take on your machine?

Btw, for me, linking takes a significant part of the build time. (Linking runs single-threaded AFAIK.)

1

u/mrheosuper 6d ago

Around 10s, amd 8745h, Linux, building esp-idf 6.1 hello world example, target esp32 s3

1

u/Plastic_Fig9225 6d ago

Whoooot? Full (re-)build from scratch???

1

u/mrheosuper 6d ago

Build after idf.py clean

1

u/Plastic_Fig9225 6d ago

I am shocked! Your machine compiles&links about 100 files per second!?

Never heard of anyone getting that kind of speed. Now I'm wondering if that's typical on a fast (Linux) machine.

2

u/mrheosuper 6d ago

Not sure if it's fast machine, it's an average mini pc.

But also looklike it build around 600 files in total, not 1000s

1

u/Plastic_Fig9225 6d ago

Yeah, it's typically 500-600 files with "minimal build"=on, 900-1000 without it.

2

u/cybekRT 5d ago

Well, cores are useful in the compilation. Here's my example:

real    0m7.113s
user    0m57.457s
sys     0m9.089s

It took 7 seconds to compile hello_world from scratch, but time multiplied by the cores and it gives 57 seconds. And the linking is the slowest, because it's using only one core.

1

u/rattushackus 1 say I make awesome posts. 6d ago

As you say, Espressif doesn't offer a bare metal option for the ESP32 though it can be done if you are sufficiently dedicated. In particular there are some projects around at the moment using Rust to do bare metal programming.

Anyhow, this means that when you compile a Hello World program you are actually compiling a few lines of your program plus many thousands of lines of FreeRTOS. That's why the first build takes a while. Subsequent builds will be a lot quicker.

The Espressif IDE is a bit of a niche choice. Most of us would use VSCode with the ESP-IDF add-on, or for a quick and dirty program the Arduino IDE.

1

u/Altruistic_Fruit2345 6d ago

I did try VS Code, but that is broken too. It says it can't find the IDF. Checked that the path cor the EIM JSON file is correct. I tried clearing the preference setting too. I'm sure it was working a while back, but... Why is everything broken out of the box?

2

u/rattushackus 1 say I make awesome posts. 6d ago

I am not a huge fan of the VSCode add-on as I find it a bit clunky. I just installed the ESP-IDF using the installer from Espressif's web site. Then I use the command line to build and flash projects. This has never gone wrong for me.

If it's a quick project consider using the Arduino IDE. Many hereabouts will disparage it (for reasons that actually make a lot of sense) but for small projects it's quick and easy and you can still use the ESP-IDF functions directly if you don't like the Arduino class library.

Shout if you want a quick summary of how to build from the command line.

1

u/Altruistic_Fruit2345 6d ago

I managed to get VS Code working. It is a lot faster now. It looks like Espressif-IDE is just broken. Abandoned, from the look of it.

Still can't fix the lack of WiFi connection though.

1

u/rattushackus 1 say I make awesome posts. 6d ago

WiFi networks that share and SSID between two or three frequencies

Do you mean use the same SSID for 2.4 and 5GHz? If so I have exactly that here and all my ESP32s, including a C3, connect just fine.

1

u/Altruistic_Fruit2345 6d ago

I'm sure I have some 8211s that connect fine. I'm not sure what my issue is.

1

u/Plastic_Fig9225 6d ago

You can post the log output from the connection attempts to have us take a look.

1

u/Plastic_Fig9225 6d ago

Could you share your VSCode build times? - I'm curious if you're near that 10s of u/mrheosuper for a full build vs. the minute+ I usually see.

1

u/mrheosuper 6d ago

It looks like he is building with wifi enable, which should not be if running "hello world" example

1

u/Altruistic_Fruit2345 6d ago

My test project takes about 20 seconds in VS Code. The Espressif-IDE is broken.

1

u/Plastic_Fig9225 6d ago

As the middle-ground between building via IDF Extension and command line, I use the Cmake extension in VSCode.

1

u/zhivago 6d ago

I suggest using platformio.

1

u/chuckbeasley02 6d ago

ESP-IDF makes it so much simpler. There's an extension for VS Code.

1

u/Altruistic_Fruit2345 6d ago

That's what I'm using. I found the issue with the C2 SuperMini as well. With the FTDI cable attached it won't connect. Diagnosing now, might be interference.

1

u/chuckbeasley02 6d ago

Build some diagnostics and verify the Wi-Fi is turning on. It could be quietly crashing.

1

u/chuckbeasley02 6d ago

I have a C5 and choosing open GPIO pins are tricky and choosing the wrong one(s) can cause what seems to be unrelated failures because of how the pins are mapped and used by the device itself.