Is it possible to add debugging to Heltec Wifi Kit v2?

Hello, I recently purchased the ESP-debug tool. Unfortunately, it doesn’t work with the board I have in one of my main projects. I am using the Heltec Wifi Kit v2. The platformio debug page page lists that the Heltec LoRa 32 (v1 and v2) has debugging support. These appear to be really similar to the Heltec Wifi Kit, and this thread was useful for understanding a bit of what is going on here.

Looking at the platformio board file for the Heltec LoRa board and the Heltec Wifi board, it seems like the difference is this line:

 "debug": {
   "openocd_board": "esp-wroom-32.cfg"
 },

I don’t know if these boards are close enough to extend this functionality, whether this can be achieved by adding something to the platformio.ini, or whether or not this is something easy to test. This area is definitely at the edge of my knowledge, and I would really appreciate some help assessing if/how this can be implemented.

Thanks!

Heltec Lora: website, pinout
Heltec Wifi: website, pinout

Debugging requires GPIO12, GPIO13, GPIO14 and GPIO15 for an ESP32. There is a slight conflict on the Heltec board: GPIO15 is used as the I2C SCL line for the communication with the OLED display and has a fixed pull-up resistor.

Therefore, it’s either debugging or using the OLED display but not both. The pull-up resistor shouldn’t interfere.

So if you your code doesn’t use the OLED, you can connect the ESP-Prog (or whatever debug adapter you have) to GPIO12 – GPIO15 and GND and start debugging from PlatformIO.

Hi there, thanks for the reply. I can definitely disable the screen while debugging. However, I get this error when trying to run the debugger:

Error: Currently, PlatformIO does not support debugging for Heltec WiFi Kit 32.
Please request support at Issues · platformio/platformio-core · GitHub
or visit → Redirecting...

Then the debug play/pause bar disappears. Is there some process for forcing it to attempt debugging regardless? I couldn’t find anything specifically addressing an override on the debugging options page.

You can create your own board definition file and enable debugging:

  • Copy ~/.platformio/platforms/espressif32/boards/heltec_wifi_kit_32_v2.json to ~/.platformio/boards/heltec_wifi_kit_32_v2_debug.json
  • Make the below changes to the new file
  • Change platformio.ini by replacing heltec_wifi_kit_32_v2 with heltec_wifi_kit_32_v2_debug
  • Start debugging
{
  "platform": "espressif32",
  ...
  "debug": {
    "openocd_board": "esp-wroom-32.cfg"
  },
  ...
  "name": "Heltec WiFi Kit 32 (V2 with debugging)",
  ...
}

platform and debug are additions, name is a modification.

I don’t have such a board so I couldn’t test it. But the debugger certainly starts and doesn’t quit early.

Hi there. Thanks again for the directions, very clear for me :slight_smile:
Unfortunately, I wasn’t able to get it to work. I reverted to using a NodeMCU chip to try to test with an officially supported board. That didn’t seem to work out of the gate, throwing an “Error: unable to open ftdi device with vid 0403, pid 6010, description '', serial ‘’ at bus location '’*”.

I found your post on a very similar topic, but the best I got was this:

adapter speed: 5000 kHz

Info : tcl server disabled

Info : telnet server disabled

Error: no device found

Error: unable to open ftdi device with vid 0403, pid 6010, description ‘', serial '’ at bus >location ‘*’

Error: no device found

Error: unable to open ftdi device with vid 0403, pid 6014, description ‘', serial '’ at bus >location ‘*’

Assertion failed!

full log

At this point, it’s not quite as plug and play as I was hoping, and while I appreciate any help you’re able to provide, this is now pretty far out of my expertise. Thanks for the clear explanations in both posts.

Are you working on Windows? If so, have you used Zadig to replace the driver of ESP-Prog (interface 0 only)?

Hey there. A bit of a delay here, I was doing a bunch of reading on the subject since I got it up and running. I swapped to a nodemcu32s and ran through all the setup and troubleshooting steps again and something worked! It may have been poor quality wires, since I replaced them with better ones.

I had some issues with nodemcu not responding to breaks in the debugger, but I was able to get it going pretty good. I then tried the Heltec board again and it seems to be having a harder time with inserting breaks. It does this. I’ve pasted the relevant part below.

Either way, it seems like I have a good option. I’ll probably move to a supported board for future projects. Thanks a bunch for your help!

edit: I forgot to mention, I have the zadig drivers installed on both ‘0’ and ‘1’. Perhaps it should only be on 0?

Info : esp32.cpu0: Debug controller was reset.

Info : esp32.cpu0: Core was reset.

esp32.cpu0: Debug controller was reset.

esp32.cpu0: Core was reset.

Info : esp32.cpu0: Debug controller was reset.

Info : esp32.cpu0: Core was reset.

esp32.cpu0: Debug controller was reset.

esp32.cpu0: Core was reset.

Info : esp32.cpu0: Debug controller was reset.

Info : esp32.cpu0: Core was reset.

Info : esp32.cpu0: Target halted, PC=0x40080B02, debug_reason=00000000

esp32.cpu0: Debug controller was reset.

Info : Set GDB target to ‘esp32.cpu0’

esp32.cpu0: Core was reset.

esp32.cpu0: Target halted, PC=0x40080B02, debug_reason=00000000

Set GDB target to ‘esp32.cpu0’

Program received signal

SIGINT, Interrupt.

Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001

Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001

Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001

0x40080b02 in ?? ()

Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001

Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001

Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001

Info : esp32.cpu0: Debug controller was reset.

Info : esp32.cpu0: Core was reset.

esp32.cpu0: Debug controller was reset.

esp32.cpu0: Core was reset.

Info : esp32.cpu0: Debug controller was reset.

Info : esp32.cpu0: Core was reset.

esp32.cpu0: Debug controller was reset.

esp32.cpu0: Core was reset.

Info : esp32.cpu0: Debug controller was reset.

Info : esp32.cpu0: Core was reset.

esp32.cpu0: Debug controller was reset.

esp32.cpu0: Core was reset.