How to use the PlatformIO debugger on the ESP32 using an ESP-prog

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone in this video we'll take a look at how you can use inline debugging on your ESP 32 using platform il first up let's take a look at the hardware we'll need the main piece of hardware we'll need is a board bias press of called the ESP prog and it breaks out JTAG pins that you connect to your ESP 32 the only other piece of hardware you'll need is an ESP 32 board that breaks out the pins 12 13 14 and 15 to connect your ESP prog to the ESP 32 just use the pin outs as shown on the screen now and you can leave the other pins on the ESP prog disconnected or if you're feeling lazy you can buy one of my debug boards on tindy which just break out these pins to an equivalent connector and then you just use an IDC cable to connect between the ESP prog and these boards next we'll install the drivers platform i/o have some instructions on what to do with the drivers and I'll go through the windows one here first thing you need to do is install the FTDI drivers if you scroll over to the right there's an executable that I find makes this a little easier next you want to download and install the tool zadig inside the options menu click list all devices then select the dual rs30 tree 2 interface 0 option from the menu and click replace driver when when USB is selected you may need to repeat these Zadok steps in the future if you change USB port basically we're jumping ahead a bit here but if you see the error message you see on screen now you probably need to repeat the steps next we'll look at setting up platform i/o if you have this already done there'll be a timestamp in the description for you to skip it the first thing that you need to do is download and install vs code inside vs code you want to click on the extensions option and then search for platform i/o select it and then click install next let's try out an example to test that it's working in the PIO toolbar click the home icon and then click the project examples button in this drop down menu select the arduino blink under the express of 32 option you'll find the code that was normally contained in the sketch is contained in the source folder board configurations are stored in platforms at any this example even define several boards but to make it simpler we'll just remove all but one platform io automatically detects comm ports to upload your code to but when you've multiple ones which you will when you're using the debugger I think it makes sense to explicitly call it out and you can do that using the upload port definition that you put in platform IO teeny to upload the code just go back down to the toolbar and click the upload button and let it do its thing hopefully everything will go as expected and you should be greeted by a blinking board next we'll move on to the actual debugging the first thing we'll look at is something that actually caught me out while I was making this video at the time of making this video the most recent platform IO is 4 point 3 and there's a bug in it which relates to debugging for now we can just update to the latest dev version click on the terminal button in the tool bar and type in p io space upgrade space - - dev we need to edit the any file to enable configuration for the debugging debug tool specifies the programmer we're using and the bug in this break is a trick we learned from andreas to get it to stop in the setup of the sketch to show off one of the features you can use using the debugger we're going to change the delay to be stored in a global variable called delay time it's worth mentioning at this stage that you can't use pin 12 13 14 or 15 in your sketch because they're used by the JTAG pins so say that Adafruit feather has AI we saw earlier we can't use the built-in LED on that because it's on pin 13 after uploading the sketch to the board again we're ready to start the booking open the top menu click on run and then click on start debugging this will take a few minutes to complete even when the terminal shows a success if you click on the bug console you'll see that it's still doing some things in the background if everything went to plan it should stop at your breakpoints at the start of the setup click to the left of the line number to create a new breakpoint and then you can press this play button up the top to continue to the next breakpoint a really useful feature is variable watches basically it lets you see what the value of a variable is at any given breakpoint to add a watch just click on the plus button and type in the name of the variable we also have access to all the variables in this section we'll look for a delay time which is a global so it'll be under the global section and as you can see there's a huge amount of global variables defined so it actually takes a while to find the one you're looking for you can also edit these variables and in real time it will change the behavior of your application which i think is really cool to see this in action we can disable the breakpoint and click continue and as you can see the LED is now flashing much faster than before one issue I ran into while doing these tests was sometimes the ESP 32 would refuse to flash if it was plugged into the ESB prog I don't know what causes this because most of the time it works fine but I found if you just disconnect the ESP prog from the ESP 32 it will upload just fine and you can plug it back in afterwards hopefully you found this video interesting and if you have any comments please let me know in the comments below or if you want to discuss on my discord that's also a great place for makers to hang out I also want to say a huge thanks to my github sponsors for helping support the channel if you don't know github or matching any sponsorships I receive for the next six or seven months and that's it thank you for watching and I'll see you next time bye bye you
Info
Channel: Brian Lough
Views: 62,125
Rating: undefined out of 5
Keywords: arduino, electronics, maker, esp32 tutorial, esp32 arduino, platformio arduino, platformio esp32, platformio tutorial, platformio vscode, platformio debugger, esp32 debugger, esp32 debugging jtag, esp-prog, esp-prog jtag, esp-prog debugger, esp-prog tutorial, esp-prog esp32, esp-prog platformio, esp-prog development board jtag, Brian Lough, platformio setup, platformio install
Id: TivyIFF-dzw
Channel Id: undefined
Length: 6min 10sec (370 seconds)
Published: Sat Mar 28 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.