{"id":81076,"date":"2019-02-12T12:01:44","date_gmt":"2019-02-12T12:01:44","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=81076"},"modified":"2019-05-02T20:47:28","modified_gmt":"2019-05-02T20:47:28","slug":"solved-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/solved-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header\/","title":{"rendered":"[SOLVED] Failed to connect to ESP32: Timed out waiting for packet header"},"content":{"rendered":"\n<p>Learn how to fix the Fatal Error Occurred: &#8220;<strong><em>Failed to connect to ESP32: Timed out waiting for packet header<\/em><\/strong>&#8221; error when trying to upload new code to your ESP32 board once for all.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-waiting-for-packet-header-featured.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"[SOLVED] Failed to connect to ESP32: Timed out waiting for packet header\" class=\"wp-image-81090\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-waiting-for-packet-header-featured.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-waiting-for-packet-header-featured.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-waiting-for-packet-header-featured.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-waiting-for-packet-header-featured.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Why are you getting this error?<\/h2>\n\n\n\n<p>Some <a rel=\"noreferrer noopener\" aria-label=\"ESP32 development boards (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\">ESP32 development boards<\/a> (read <a href=\"https:\/\/makeradvisor.com\/esp32-development-boards-review-comparison\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Best ESP32 boards (opens in a new tab)\">Best ESP32 boards<\/a>) don&#8217;t go into flashing\/uploading mode automatically when uploading a new code. <\/p>\n\n\n\n<p>This means that when you try to upload a new sketch to your ESP32, the Arduino IDE fails to connect to your board, and you get the following error message:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"928\" height=\"336\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/timed-out-waiting-for-packet-header.png?resize=928%2C336&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-81077\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/timed-out-waiting-for-packet-header.png?w=928&amp;quality=100&amp;strip=all&amp;ssl=1 928w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/timed-out-waiting-for-packet-header.png?resize=300%2C109&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/timed-out-waiting-for-packet-header.png?resize=768%2C278&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 928px) 100vw, 928px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Holding the BOOT\/FLASH button<\/h3>\n\n\n\n<p>One of the ways to solve this is holding-down the \u201c<strong>BOOT\/FLASH<\/strong>\u201d button in your ESP32 board while uploading a new sketch at the same time. But having to worry about this every time you want to upload new code can be tedious, specially when you&#8217;re testing and debugging your code. There is a way to fix this once for all &#8211; no need to hold down the &#8220;BOOT\/FLASH&#8221; button anymore.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to fix the Error?<\/h2>\n\n\n\n<p>To make your ESP32 board go into flashing\/uploading mode automatically, you can <strong>connect a 10 uF electrolytic capacitor between the <span class=\"rnthl rntclgray\">EN<\/span> pin and <span class=\"rnthl rntcblack\">GND<\/span><\/strong>.<\/p>\n\n\n\n<p>You may want to test this setup first on a breadboard to make sure it works for your ESP32 development board.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"569\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-capacitor-flashing-mode-automatic.png?resize=569%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-81092\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-capacitor-flashing-mode-automatic.png?w=569&amp;quality=100&amp;strip=all&amp;ssl=1 569w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-capacitor-flashing-mode-automatic.png?resize=253%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 253w\" sizes=\"(max-width: 569px) 100vw, 569px\" \/><\/figure><\/div>\n\n\n\n<p class=\"rntbox rntclgreen\"><strong>Note: <\/strong> electrolytic capacitors have polarity. The white\/grey stripe indicates the negative lead.<\/p>\n\n\n\n<p>If it works, then you can solder the <strong>10 uF electrolytic capacitor<\/strong> to the board. Since the <span class=\"rnthl rntclgray\">EN<\/span> and GND pins are far apart from each other, you can simply connect the capacitor between the <span class=\"rnthl rntclgray\">EN<\/span> and the <span class=\"rnthl rntcblack\">GND<\/span> of the ESP32 chip as shown in the schematic diagram below:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"528\" height=\"486\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-capacitor-flashing-mode-automatic-2.png?resize=528%2C486&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-81093\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-capacitor-flashing-mode-automatic-2.png?w=528&amp;quality=100&amp;strip=all&amp;ssl=1 528w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-capacitor-flashing-mode-automatic-2.png?resize=300%2C276&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 528px) 100vw, 528px\" \/><\/figure><\/div>\n\n\n\n<p><strong>Recommended:<\/strong> <a href=\"https:\/\/randomnerdtutorials.com\/esp32-pinout-reference-gpios\/\">ESP32 Pinout Reference: Which GPIO pins should you use?<\/a><\/p>\n\n\n\n<p>The following figure shows how my ESP32 looks like after soldering the capacitor. It doesn&#8217;t occupy much space, and fortunately you won&#8217;t get more trouble connecting to the ESP32 when uploading new code.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"500\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/fix-timed-out-waiting-for-packet-header-capacitor_f.jpg?resize=750%2C500&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-81086\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/fix-timed-out-waiting-for-packet-header-capacitor_f.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/fix-timed-out-waiting-for-packet-header-capacitor_f.jpg?resize=300%2C200&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>Before trying to upload a new code, you should check the connections with a multimeter in continuity mode &#8211; check that you haven&#8217;t inadvertently solder anything to the next pin.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"468\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/check-connections-capacitor-fix-timed-out-packet-header.jpg?resize=750%2C468&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"fix timed out waiting for packet header with capacitor testing\" class=\"wp-image-81084\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/check-connections-capacitor-fix-timed-out-packet-header.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/check-connections-capacitor-fix-timed-out-packet-header.jpg?resize=300%2C187&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>If everything is soldered properly, you won&#8217;t need to press the BOOT button  when uploading new code. You also won&#8217;t get the Fatal Error Occurred: &#8220;Failed to connect to ESP32: Timed out waiting for packet header&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"714\" height=\"386\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/done-uploading-esp32.png?resize=714%2C386&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-81078\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/done-uploading-esp32.png?w=714&amp;quality=100&amp;strip=all&amp;ssl=1 714w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/done-uploading-esp32.png?resize=300%2C162&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/done-uploading-esp32.png?resize=280%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 280w\" sizes=\"(max-width: 714px) 100vw, 714px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>We hope you&#8217;ve found this trick useful and it solved your problem. Thanks to Ben Hall for the suggestion.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>For more ESP32 troubleshooting tips, consult the <a href=\"https:\/\/randomnerdtutorials.com\/esp32-troubleshooting-guide\/\">ESP32 troubleshooting guide<\/a>.<\/li><li>To learn more about ESP32 enroll in the <strong><a href=\"https:\/\/randomnerdtutorials.com\/learn-esp32-with-arduino-ide\/\">Learn&nbsp;ESP32&nbsp;with&nbsp;Arduino&nbsp;IDE<\/a><\/strong> course. <\/li><li>More projects about ESP32: <a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32\/\"><strong>20+ ESP32 Projects and Tutorials<\/strong><\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to fix the: &#8220;Failed to connect to ESP32: Timed out waiting for packet header&#8221; error when trying to upload new code to your ESP32 board once for all. <\/p>\n<p class=\"read-more-container\"><a href=\"https:\/\/randomnerdtutorials.com\/solved-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header\/\" class=\"read-more button\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":81090,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[276,277,299,269,264],"tags":[],"class_list":["post-81076","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32","category-esp32-arduino-ide","category-0-esp32","category-guide-project","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/02\/esp32-waiting-for-packet-header-featured.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/81076","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=81076"}],"version-history":[{"count":0,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/81076\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/81090"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=81076"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=81076"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=81076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}