Hacker News new | ask | show | jobs
by vbezhenar 930 days ago
What kind of programmer does one need to work with ESP32? I bought jlink for stm32 thinking that's the ultimate programmer for all my needs, however it does not claim compatibility with esp32.
8 comments

Depends a lot on the exact model of ESP32 you get. Even for non-devboards, a lot of the newer modules have a built in USB serial peripheral. If it's got a USB port, you're already ready to go. The ESP32-C3 QtPy modules from adafruit are awesome, they've got a USB-C port on them and you can just plug them in and they're ready to be flashed.
They do have a boot loader that speaks uart, but are also compatible with jtag and openocd. However, I haven’t needed to burn the pins on jtag because they’ve implemented a gdb stub over uart, including the ability to trap interrupts and dump into a paused gdb session. It’s not ideal, but it’s pretty impressive from a preexisting tools perspective.

This doesn’t really answer your question, but it feels like it’s worth mentioning.

The commonly used cheap devboards have everything included on the board, you just plug in USB and that's all you need.

There are also 'premium' devkits with smaller and nicer packaging e.g. I like m5 devkits that are inch-by-inch-by-halfinch blocks at $7.5 for https://docs.m5stack.com/en/core/AtomS3%20Lite or with an integrated screen for $15.5 https://shop.m5stack.com/products/atoms3-dev-kit-w-0-85-inch... is useful for visual feedback.

They have a built in serial bootloader. Most dev boards don't need anything, they come with a USB-to-serial adapter. Some of the new ones even have the USB part integrated on chip.

If you use a bare module then you need a basic 3.3V serial adapter and maybe a jumper wire to ground pin 0 to enter programming mode.

You can also do stuff with JTAG, which will let you use a debugger, but that's not mandatory. Espressif sells a dirt cheap one. I think maybe you can use your jlink for that with some fiddling but I'm not certain.

> Some of the new ones even have the USB part integrated on chip.

Worth noting that this includes JTAG over USB.

I haven't tried the newer ones with USB support since I have a literal stack of older ESP32s to get through for projects, how's support for JTAG/debugging over USB in the common environments like ESP-IDF/Arduino/Platformio/etc? If it's not a hassle to get it set up then I might have to pick one up to develop on.
I'm simply launching openocd and gdb and it works well. But the only way I've ever used Arduino was via arduino-cli, so I may not be the best person to ask :P
You don't need anything. Plug it into your machine's usb, open arduino ide(or their web ide + agent) and upload any of the examples that arduino ide comes with and use its serial monitor to debug/read whatever output you write on the esp32's serial. This applies to windows/mac/linux.
A usb cord to your computer. Flash the firmware with whatever you want. Check out WLED if you have wifi.
If you get a dev kit they'll usually have a usb-serial interface for power and data.
I’ve actually found that ESPHome is sufficient for most basic use cases
The question then is where have you found ESPHome to fall short?
ESPHome is great for most use cases.

But there are things they won't touch it seems, like LoRa support.

Also I might be wrong but so far I don't think you can leverage cool things like ESP-NOW (yet).

It ends up losing contact with home assistant regularly for me. All my devices do this (all based on 8266's anyway) and all devices will fall into unavailable for a few seconds. Which is annoying because their return can trigger automations.
Honestly? Nowhere where an ESP32 was a suitable device. Anything that esphome can’t do generally requires more powerful or specialized hardware anyways. I did have some issues with updates killing WiFi on the boards and needing a reflash but I think they fixed that bug. I could also never get the chrome based flasher to work properly when I tried that out.
I've found it to be nearly unusable. The opaque firmware generation is an anti-feature IMO. It also doesn't fucking work. If you change the config, you have to force a full clean and rebuild or you'll get a corrupt image. Building an esp firmware image from scratch takes several minutes every time you want to change a config.

All of the provided controls are bad. It's incredibly difficult to get it on the network. The documentation is laughable.

It took me three hours to get a simple RGB strip working. All it had to do was drive three PWM signals. The esp has hardware specifically for that. It took a lot of effort to even find out how to use the LEDC hardware, much less how to assign a pin and hook it to the color picker.

I also wanted to hang an IR LED off it to control my TV and such. No sort of configurable button panel, you get one giant widget per action.

I did eventually get it working, but honestly it would have been so much faster to just write my own firmware to talk to HA directly.