{"id":3209,"date":"2018-02-23T11:30:55","date_gmt":"2018-02-23T11:30:55","guid":{"rendered":"http:\/\/grodansparadis.com\/wordpress\/?p=3209"},"modified":"2018-02-23T14:25:06","modified_gmt":"2018-02-23T14:25:06","slug":"esp8266-vscp-development-intro-part-1","status":"publish","type":"post","link":"https:\/\/grodansparadis.com\/wordpress\/?p=3209","title":{"rendered":"#ESP8266 #VSCP Development Intro &#8211; part 1"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/Screenshot-from-2018-02-09-12-02-43.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3103\" data-permalink=\"https:\/\/grodansparadis.com\/wordpress\/?attachment_id=3103\" data-orig-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/Screenshot-from-2018-02-09-12-02-43.png?fit=618%2C566&amp;ssl=1\" data-orig-size=\"618,566\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot from 2018-02-09 12-02-43\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/Screenshot-from-2018-02-09-12-02-43.png?fit=580%2C531&amp;ssl=1\" class=\"alignnone size-full wp-image-3103\" src=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/Screenshot-from-2018-02-09-12-02-43.png?resize=580%2C531\" alt=\"\" width=\"580\" height=\"531\" srcset=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/Screenshot-from-2018-02-09-12-02-43.png?w=618&amp;ssl=1 618w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/Screenshot-from-2018-02-09-12-02-43.png?resize=300%2C275&amp;ssl=1 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<h3>Serial port<\/h3>\n<p>Connect the USB cable to the board.\u00a0 You will get a new CDC serial port. You can check which one you get with<\/p>\n<pre>ls \/dev\/tty*<\/pre>\n<p>Normally you get <strong>\/dev\/ttyUSB0<\/strong> or <strong>\/dev\/ttyUSB1<\/strong> or the like. To make them usable for you you should add yourself to the dialout group<\/p>\n<pre>addgroup user dialout<\/pre>\n<p>where &#8220;user&#8221; is your username. You can also do this manually in the \/etc\/group file or<\/p>\n<pre>chmod a+rw \/dev\/ttyUSB0<\/pre>\n<p>if you like brute force.<\/p>\n<h3>Loading code to the ESP8266<\/h3>\n<p>The ESP8266 CPU can be booted in three different ways:<\/p>\n<ul>\n<li><strong>Flash Mode:<\/strong> default booting mode. Firmware is read and executed from the flash memory. <strong>Pins need to be set to:<\/strong> GPIO15=0, GPIO0=0, GPIO2=1<\/li>\n<li><strong>UART Mode:<\/strong> used to program our board (through a Serial-to-Usb adapter). <strong>Pins need to be set to:<\/strong>\u00a0 GPIO15=0, GPIO0=1, GPIO2=1<\/li>\n<li><strong>SDIO Mode:<\/strong> loads firmware from an SDIO card? <strong>Pins need to be set to:<\/strong>\u00a0 GPIO15=1, GPIO0=0\/1, GPIO2=0\/1<\/li>\n<\/ul>\n<p>The boot process is described <a href=\"https:\/\/github.com\/esp8266\/esp8266-wiki\/wiki\/Boot-Process\">here<\/a>.<\/p>\n<p>Switching from a mode to another requires to reset the module while the pin states listed is set.<\/p>\n<p>With the nodemcu board and esptool flash uploader all this is handle automatically but if you have another board you must handle this yourself.<\/p>\n<h2>esp-open-sdk<\/h2>\n<p>You find it <a href=\"https:\/\/github.com\/pfalcon\/esp-open-sdk\">here<\/a>.<\/p>\n<h3><strong>Fetch it<br \/>\n<\/strong><\/h3>\n<pre id=\"crayon-5a8f35b6543e9620869522-7\" class=\"crayon-line\"><span class=\"crayon-e\">sudo <\/span><span class=\"crayon-e\">git <\/span><span class=\"crayon-r\">clone<\/span> <span class=\"crayon-v\">https<\/span><span class=\"crayon-o\">:<\/span><span class=\"crayon-c\">\/\/github.com\/pfalcon\/esp-open-sdk.git<\/span>\r\n\r\n<span class=\"crayon-e\">cd <\/span><span class=\"crayon-v\">esp<\/span><span class=\"crayon-o\">-<\/span><span class=\"crayon-v\">open<\/span><span class=\"crayon-o\">-<\/span><span class=\"crayon-e\">sdk<\/span><\/pre>\n<h3><strong>Install it<\/strong><\/h3>\n<pre><span class=\"\">apt-get install make unrar autoconf automake libtool libtool-bin gcc g++ gperf flex bison texinfo gawk ncurses-dev libexpat-dev python sed<\/span>\r\n\r\n<span class=\"\">git clone --recursive https<\/span><span class=\"co1\">:\/\/github.com\/pfalcon\/esp-open-sdk<\/span>\r\n\r\n<span class=\"\">cd esp-open-sdk\/<\/span>\r\n\r\n<span class=\"\">make\r\n<\/span><\/pre>\n<div><strong>Error when building?<\/strong>\u00a0 <a href=\"http:\/\/grodansparadis.com\/wordpress\/?p=2802\">See this post<\/a><\/div>\n<div><\/div>\n<div>This builds the standalone version of the SDK (Non FreeRTOS)<\/div>\n<div><\/div>\n<div>You should add the bin directory to he path<\/div>\n<pre id=\"crayon-5a8f35b6543e9620869522-11\" class=\"crayon-line\"><span class=\"crayon-i\">echo<\/span> <span class=\"crayon-s\">'PATH=$PATH:<span class=\"\">~\/development\/esp8266<\/span>\/esp-open-sdk\/xtensa-lx106-elf\/bin'<\/span> <span class=\"crayon-o\">&gt;&gt;<\/span> <span class=\"crayon-o\">~<\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-e\">profile<\/span>\r\n\r\n<span class=\"crayon-i\">echo<\/span> <span class=\"crayon-s\">'PATH=$PATH:<span class=\"\">~\/development\/esp8266<\/span>\/esp-open-sdk\/esptool'<\/span> <span class=\"crayon-o\">&gt;&gt;<\/span> <span class=\"crayon-o\">~<\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-e\">profile<\/span>\r\n\r\n<span class=\"crayon-v\">PATH<\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">PATH<\/span><span class=\"crayon-o\">:<\/span><span class=\"crayon-v\"><span class=\"\">~\/development\/esp8266<\/span><\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-v\">esp<\/span><span class=\"crayon-o\">-<\/span><span class=\"crayon-v\">open<\/span><span class=\"crayon-o\">-<\/span><span class=\"crayon-v\">sdk<\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-v\">xtensa<\/span><span class=\"crayon-o\">-<\/span><span class=\"crayon-v\">lx106<\/span><span class=\"crayon-o\">-<\/span><span class=\"crayon-v\">elf<\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-e\">bin<\/span>\r\n<span class=\"crayon-v\">PATH<\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">PATH<\/span><span class=\"crayon-o\">:<\/span><span class=\"crayon-v\"><span class=\"\">~\/development\/esp8266<\/span><\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-v\">esp<\/span><span class=\"crayon-o\">-<\/span><span class=\"crayon-v\">open<\/span><span class=\"crayon-o\">-<\/span><span class=\"crayon-v\">sdk<\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-v\">esptool<\/span><\/pre>\n<p><span class=\"\">I have installed the toolchain in<br \/>\n<\/span><\/p>\n<pre><span class=\"\"> ~\/development\/esp8266\/ \r\n<\/span><\/pre>\n<p>so change paths above for your installation folders.<\/p>\n<h3><strong>Update it (when updates are available)<br \/>\n<\/strong><\/h3>\n<pre id=\"crayon-5a8f35b6543f2322646920-2\" class=\"crayon-line crayon-striped-line\"><span class=\"crayon-e\">make <\/span><span class=\"crayon-e\">clean<\/span>\r\n<span class=\"crayon-e\">git <\/span><span class=\"crayon-e\">pull<\/span>\r\n<span class=\"crayon-e\">git <\/span><span class=\"crayon-e\">submodule <\/span><span class=\"crayon-v\">update<\/span><\/pre>\n<h2>Firmware upload tool<\/h2>\n<div><\/div>\n<div>You need the <strong>esptool.py<\/strong> to upliad firmware to the module, you find it <a href=\"https:\/\/github.com\/espressif\/esptool\">here<\/a><\/div>\n<div><\/div>\n<div>Install with<\/div>\n<div>\n<pre><code>pip install esptool<\/code><\/pre>\n<h2>First code (blinky)<\/h2>\n<\/div>\n<p>You find it here<\/p>\n<pre>cd ~\/development\/esp8266\/esp-open-sdk\/examples\/blinky<\/pre>\n<p>Type<\/p>\n<pre>make<\/pre>\n<p>to build it. Remember that the paths above must have been set. You may get some warnings. No problem.<\/p>\n<p>For your information. If you build from source code should be loaded like this:<\/p>\n<ul>\n<li><code>bin\/0x00000.bin<\/code> to 0x00000<\/li>\n<li><code>bin\/0x10000.bin<\/code> to 0x10000<\/li>\n<\/ul>\n<p>That is just what we do here. Upload to your module with<\/p>\n<pre>esptool.py --port \/dev\/ttyUSB1 write_flash 0x00000 blinky-0x00000.bin 0x10000 blinky-0x10000.bin<\/pre>\n<p>No need to press any buttons during flashing. It is handled automatically by the USB DTR circuitry.<\/p>\n<p>Now we are ready to do some real work for our VSCP system with the ESP8266.\u00a0 If you rather prefer Arduino <a href=\"http:\/\/grodansparadis.com\/wordpress\/?p=3102\">this howto<\/a> may be the one you should go for instead of this one. Life is much simpler in the Arduino world. But the degrees of freedom is better if you do it all by yourself. The penalty for freedom is more problems of course. As always.<\/p>\n<p>Another intro is here <a href=\"http:\/\/www.electrodragon.com\/w\/ESP8266_Open_SDK\">http:\/\/www.electrodragon.com\/w\/ESP8266_Open_SDK<\/a><br \/>\nesp8266 wiki is <a href=\"https:\/\/github.com\/esp8266\/esp8266-wiki\/wiki\">here<\/a>.<\/p>\n<p>Part 2 will follow.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Serial port Connect the USB cable to the board.\u00a0 You will get a new CDC serial port. You can check which one you get with ls \/dev\/tty* Normally you get \/dev\/ttyUSB0 or \/dev\/ttyUSB1 or the like. To make them usable for you you should add yourself to the dialout group addgroup user dialout where &#8220;user&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[62,12,53],"tags":[],"class_list":["post-3209","post","type-post","status-publish","format-standard","hentry","category-esp8266","category-general","category-howtos"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4raCZ-PL","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3209"}],"version-history":[{"count":12,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3209\/revisions"}],"predecessor-version":[{"id":3224,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3209\/revisions\/3224"}],"wp:attachment":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}