Visual Studio Code Esp32



[Matti Airas] wanted to have a better electronics platform for making his boat smarter, more connected, and safer. He found traditional marine electronics expensive and not suited for hacking and tinkering. There was also the issue of lack of interoperability between device generations from the same supplier and between different brands. This led him to design the Sailor Hat with ESP32 — a marine specific, open source hardware development board.

Applications include all kinds of sensor and control interfaces for the boat, such as measurement of fuel or water level, engine RPM, anchoring chain length counter, or setting up smart lighting or smart refrigeration control. The board is designed to work with the traditional NMEA 2000 standard, as well as with Signal K. NMEA 2000 is standardized as IEC 61162-3, but isn’t open source or free. Signal K, on the other hand, is free and open source, and can co-exist alongside NMEA 2000.

The marine environment can be pretty harsh with extremes of temperature, rain, humidity, condensation and vibration. Boats, just like automobiles, have a notoriously noisy electrical environment and [Matti] has paid special attention to noise and surge suppression throughout the board. The board can work with either 12 V or 24 V bus systems since the on board DC-DC converter is rated up to 32 V input. Connections between the board and the outside world need to be very robust, so it is designed to accept various types of connectors depending on how robust you want it to be.

This extension has no settings for this release. You just press ⌘ + ⇧ + P then type prefix ESP32 to see tasks list: ESP32: Create new Project. ESP32: Push; ESP32: Push & Debug; ESP32: Push whole. 3 hours ago  The Sailor Hat is based around a standard ESP32-WROOM-32 module. Interfaces include a CAN bus transceiver. ESPHome and Visual Studio Code.

The Sailor Hat is based around a standard ESP32-WROOM-32 module. Interfaces include a CAN bus transceiver, opto-coupled input and output, I2C, 1-wire and QWIIC interfaces, USB Micro-B programming conector, plus a couple of buttons and LEDs. All of the ESP32 GPIO pins are terminated on a GPIO header, with jumper options to disable terminations to the standard interfaces and instead route them to the GPIO header as needed. Additionally, there’s a generous prototyping area to add additional hardware to the board. Hardware design files are hosted on the project repository on GitHub.

On the software side, there are several frameworks that can be used, with PlatformIO, SensESP, ESPHome and Visual Studio Code being the recommended choices. Or you could use any of the widely available SDK’s for the ESP32 platform — Espressif SDK, Arduino Core for ESP32, MicroPython, NodeMCU or Rust.

[Matti]’s NMEA 2000 USB gateway example is a good way to get a grip on hardware assembly and software installation required to build a practical project using the Sailor Hat. The board is designed to withstand a harsh electrical environment. But it’s mechanical installation obviously requires greater care if it has to survive marine applications. The Sailor Hat can be installed in commonly available, 100x68x50 mm or larger plastic waterproof enclosures, rated for IP65 or higher. The bulkhead connectors and cable glands also need to be appropriately rated, and the enclosure may possibly need a IP68 rated ventilation plug to take care of environmental cycling within the enclosure.

Code

Lightroom 3 download mac. This tutorial shows how to develop projects for the Espressif ESP32 chip using Visual Studio, VisualGDB and the new ESP-IDF framework.

Warning: The MSBuild-based ESP32 projects are deprecated since VisualGDB 5.4. Please use the Advanced ESP-IDF Project Subsystem instead. The rest of the steps shown in this tutorial will still work.

Esp32

We will show how to build, program and debug a basic ESP32 program over JTAG on the Sparkfun ESP32 Thing board. In order to use JTAG with ESP32 you will need to connect the following pins to your JTAG programmer:

Pin name on ESP32 chipSignal on ESP32 Thing boardPin on the ESP32 boardJTAG signalPin on JTAG20 cable
+3.3V+3.3V5 on J1+3.3V1
ResetCHIP_PU6 on J1SRST3
GNDGND1 on J1GND4
MTDI128 on J1TDI5
MTMS149 on J1TMS7
MTCK137 on J1TCK9
MTDO1511 on J2TDO13

If you are using a different ESP32 board, consult your board schematics to find the pin numbers corresponding to the signals listed above. Proshow gold.

The assembled JTAG debugging setup for the ESP32 Thing board looks as follows:

Before you begin, install VisualGDB 5.2 or later.

Note: VisualGDB 5.4 supports the new advanced ESP-IDF project subsystem that delivers better development experience than MSBuild-projects shown in this tutorial. Once you get basic debugging to work, follow this tutorial to get started with the new advanced ESP-IDF project subsystem.

  1. Start Visual Studio and open the VisualGDB Embedded Project Wizard:
  2. On the first page proceed with the default MSBuild subsystem and click “next”:
  3. On the next page select the ESP32 toolchain. If it is not installed, VisualGDB will download and install it automatically. If it is not shown in the wizard, install it via Tools->VisualGDB Package Manager. Then select the regular ESP32 device:
  4. On the Sample Selection page pick the LEDBlink sample and enter the pin number where your LED is connected. On the Sparkfun ESP32 Thing board used in this tutorial the LED is connected to pin #5:
  5. On the debug settings page select your JTAG programmer. For Olimex ARM-USB-OCD-H and other FT2232-based ones, enable the “explicit speed” checkbox:
  6. You can test the OpenOCD settings and check for common driver problems by pressing the “Test settings” button:
  7. Press “Finish” to generate your project. Due to a bug in the ESP-IDF framework, the projects built with no optimization (which is the default option for the debug configuration) will not work properly. To fix this, open Visual Studio Project Properties and change the optimization for the project to “Optimize for GDB (-Og)”. If you are using an older version of VisualGDB that does not show this option, simply enter -Og in the “Optimization” field:
  8. Build your project via Ctrl-Shift-B:
  9. Try building the project again and ensure it is shown as “up to date”:If you have installed the latest Cygwin-based toolchain and are using VisualGDB 5.2 or earlier, VisualGDB will not handle the project dependencies correctly and will try building all of the source files again. If this happens, open VisualGDB Project Properties, go to the Path Mapping page and set GDB Path Style to Cygwin and the Windows directory for absolute paths to your toolchain directory:
  10. Press F5 to start debugging. VisualGDB will automatically program the FLASH memory on the device:
  11. After programming the program may produce a stop event in a random location inside the ESP32 libraries. You can safely ignore it by pressing “Continue”:
    WARNING! If you are using ESP-IDF 2.0, the bootloader may randomly hang after a software reset. If this happens, remove all breakpoints, press the Reset button on the board, resume the program and set your breakpoints again.
  12. Once the programming is complete, the onboard LED should start blinking:
  13. Set a breakpoint somewhere in the blink_task() function and wait for it to trigger:
  14. Note how the 2 ESP32 cores got mapped to 2 threads in the VisualGDB threads window:
  15. Because we have enabled minimum optimizations, the unused variables will not be shown and stepping through code will sometimes look strange. You can fix this by disabling optimization for specific files that you want to debug. This will not break the ESP-IDF framework and will provide better debugging experience:
  16. Another limitation of the ESP32 debugger is the inability to read local variables for the top-level functions. If you encounter this problem, while debugging your thread functions, simply wrap it with another function: