Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 066a8a5

Browse files
Merge pull request #1329 from arduino/sync/Hannes7eicher/Nano-ESP32-Debugging-Fix
[MKC-1192] Clarify debugging steps
2 parents 3a4e6ba + a4de764 commit 066a8a5

File tree

4 files changed

+58
-15
lines changed

4 files changed

+58
-15
lines changed
3.67 MB
Loading[フレーム]
122 KB
Loading[フレーム]
185 KB
Loading[フレーム]

‎content/hardware/03.nano/boards/nano-esp32/tutorials/debugging/debugging.md‎

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,26 @@ Debugging is an essential skill for anyone working with technology, whether you'
2727
- [Arduino IDE](https://www.arduino.cc/en/software)
2828
- [Arduino ESP32 Core](https://github.com/arduino/arduino-esp32) installed (2.0.12 or newer)
2929

30-
## IDE Setup
30+
***It's important to use the "Arduino ESP32 Boards" core by "Arduino" and not the "esp32" core by "Espressif Systems". For Windows users this is paramount, otherwise no drivers will be ever installed and no debugging can be performed.***
31+
32+
## System Setup
33+
34+
### Debugging on Linux
35+
36+
When debugging on a Linux machine you may encounter the following error, due to your user not having the authorization to connect:
37+
38+
```
39+
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
40+
Error: esp_usb_jtag: could not find or open device!
41+
```
42+
43+
To fix this, you can copy [this file](https://raw.githubusercontent.com/espressif/openocd-esp32/master/contrib/60-openocd.rules) in your `/etc/udev/rules.d/` folder (as root).
44+
45+
### Debugging on Windows
46+
47+
On Windows machines it's important to accept the driver installation when prompted during the core installation.
48+
49+
### IDE Setup
3150

3251
To use the debugging feature on the Nano ESP32, you need to have the IDE 2.2.0 or a newer version installed. After you install it, you have to configure the IDE as follows:
3352

@@ -47,45 +66,69 @@ To use the debugging feature on the Nano ESP32, you need to have the IDE 2.2.0 o
4766

4867
If this is your first time debugging your code we recommend starting with the classic Blink example. It's a simple sketch but works great for understanding the basics of debugging.
4968

50-
Before starting a debug session make sure to always do one of the following:
69+
Before starting a debug session you need to upload your sketch using one of the following methods:
70+
71+
### Method 1
72+
73+
- Connect a jumper cable between the **GND** and the **B1** pins and press the reset button **once**. The RGB LED will turn on with a green or blue color.
74+
75+
- Remove the jumper cable and you should see the RGB LED light up in a purple or yellow color, which means you successfully entered the **ROM Boot mode**.
76+
77+
***Some boards from the first limited production batch were assembled with a different RGB LED which has the green and blue pins inverted. For more information read our full Help Center article [here](https://support.arduino.cc/hc/en-us/articles/9589073738012).***
5178

52-
- Either connect a jumper cable between the **GND** and the **B1** pins and press the reset button **once**. The RGB LED will turn on with a green or blue color. Remove the jumper cable and you should see the RGB LED light up in a purple or yellow color. Then inside **Tools**, the board will be shown as a random ESP32 board.
79+
Note that inside **Tools**, the board will be shown as a random ESP32 board.
5380

5481
***This is because in this mode all ESP32 chips share the same identifier assigned to USB devices, therefore the IDE selects a random ESP32 board.***
5582

56-
Continue to select **Tools** > **Board** > **Arduino Nano ESP32** as well as the correct **Port**.
83+
-Continue by clicking on the drop-down menu.
5784

58-
After that select **Sketch** > **Upload Using Programmer**.
85+
![Drop-Down Menu](./assets/drop-down-menu.png)
5986

60-
- Or double-tap the reset button. You will see the RGB LED fading slowly which means you correctly entered the recovery / Device Firmware Update (DFU) mode. You should see two ports in the drop-down menu, one showing a USB symbol and another one showing a cube.
87+
- Then type "Arduino ESP32" and select the correct Port. Make sure to select the option by Arduino!
88+
89+
![Change Board](./assets/changeBoard.png)
90+
91+
- After that select **Sketch** > **Upload Using Programmer**.
92+
93+
### Method 2
94+
95+
- Slowly double-tap the reset button to enter the Arduino bootloader mode.
96+
97+
***Performing the double press can be a little tricky. Press it once, wait until you see the RGB LED flashing in different colours, then press again. If done correctly the RGB LED will start fading slowly.***
98+
99+
![Arduino bootloader mode](./assets/arduinoBootloaderMode.gif)
100+
101+
- You should see two ports in the drop-down menu, one showing a USB symbol and another one showing a cube.
61102

62103
![DFU Mode](./assets/dfuMode.png)
63104

64-
**After the upload completes** either way, make sure to also **manually reset** the board by pressing the reset button **once**. Otherwise, it may not properly connect via USB and not show up inside the IDE.
105+
- Select the port next to the **USB symbol** and upload a sketch like normal.
106+
107+
### Manual Reset
108+
109+
After uploading a sketch using **either** Method 1 or Method 2 make sure to also **manually reset** the board by pressing the reset button **once**. Otherwise, it may not properly connect via USB and not show up inside the IDE.
65110

66-
Finally, after completing all steps above the last step is to start the debugging sessions via the **Start Debugging** button found at the top of the IDE next to the Upload button.
111+
### Start Debugging
112+
113+
Finally, after completing all necessary steps above the last step is to start the debugging sessions via the **Start Debugging** button found at the top of the IDE next to the Upload button.
67114

68115
![Start Debugging](./assets/startDebugging.png)
69116

70117
***Note: During the upload you will see a debug_custom.json appear in the file view. If you want to debug using another board it's important that you delete this file otherwise the IDE will use the wrong debugger and fail. You can find the file inside your sketch folder, typically at `~/documents/Arduino/<yoursketch>`***
71118

72-
After starting the debugging session you have to press the continue button **several times** until you reach your main sketch and the breakpoints you set. This is due to how the recovery system works is expected behavior.
119+
After starting the debugging session you have to press the continue button **several times** until you reach your main sketch and the breakpoints you set. This is due to how the recovery system works and is expected behavior.
73120

74121
![Continue Button](./assets/continueBtn.png)
75122

76123
## Restore Normal Upload Functionality
77124

78125
Debug-enabled sketches will only accept updates with the above instructions. To restore normal upload functionality, set **Tools** > **USB Mode** to "**Normal mode (Tiny USB)**". You can also uncheck "**Optimize for Debugging**" to increase compilation speed.
79126

80-
Then repeat the steps described above:
81-
82-
- Either connect a jumper cable between the **GND** and the **B1** pins press the reset button **once** and upload using programmer.
83-
84-
- Or **double-tap** the reset button to enter **DFU mode** and perform a normal upload using the upload button.
127+
Then **either** repeat [Method 1](#method-1) or [Method 2](#method-2).
85128

86129
## Summary
87130

88-
In this article we covered the basic steps for debugging the Arduino Nano ESP32 using the Arduino IDE. We have learned how to select the debug mode, how to place the board in the right mode, and how to test out the Arduino IDE's debugging features.
131+
In this article, we covered the basic steps for debugging the Arduino Nano ESP32 using the Arduino IDE. We have learned how to select the debug mode, how to place the board in the right mode, and how to test out the Arduino IDE's debugging features.
89132

90133
## Learn More
91134
This article only covers how to configure the Nano ESP32 for debugging, and how to get things working. To learn more about how to use the debugging features in the IDE, see the [Debugging with the Arduino IDE 2](/software/ide-v2/tutorials/ide-v2-debugger) article, which covers things in more detail.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /