{"id":12317,"date":"2015-02-14T16:42:27","date_gmt":"2015-02-14T23:42:27","guid":{"rendered":"http:\/\/ainslies.net\/?p=12317"},"modified":"2015-02-15T09:10:14","modified_gmt":"2015-02-15T16:10:14","slug":"recovering-a-bricked-cc3d-board-using-a-bus-blaster","status":"publish","type":"post","link":"https:\/\/ainslies.net\/?p=12317","title":{"rendered":"Recovering a bricked CC3D board using a bus blaster"},"content":{"rendered":"<p><a href=\"http:\/\/ainslies.net\/wp-content\/uploads\/2015\/02\/IMG_20150214_155435.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/ainslies.net\/wp-content\/uploads\/2015\/02\/IMG_20150214_155435-169x300.jpg\" alt=\"IMG_20150214_155435\" width=\"169\" height=\"300\" class=\"alignleft size-medium wp-image-12324\" srcset=\"https:\/\/ainslies.net\/wp-content\/uploads\/2015\/02\/IMG_20150214_155435-169x300.jpg 169w, https:\/\/ainslies.net\/wp-content\/uploads\/2015\/02\/IMG_20150214_155435-576x1024.jpg 576w, https:\/\/ainslies.net\/wp-content\/uploads\/2015\/02\/IMG_20150214_155435.jpg 1836w\" sizes=\"auto, (max-width: 169px) 100vw, 169px\" \/><\/a>A few months ago I went to upgrade my OpenPilot CC3D board an something went amiss and I ended up trashing the bootloader. I didn&#8217;t have a SWD dongle to reprogram it with so its been collecting dust. I just purchased a <a href=\"http:\/\/www.seeedstudio.com\/depot\/Bus-Blaster-v3-p-1415.html\" title=\"Bus blaster v3\" target=\"_blank\">v3 bus blaster<\/a> for a different project I&#8217;m working on and it has a SWD firmware so I thought I&#8217;d try and recover the CC3D. Below are the steps I used.<\/p>\n<p><strong>Download and install the latest OpenOCD<\/strong><\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">git clone git:\/\/git.code.sf.net\/p\/openocd\/code openocd<br \/>\ncd openocd\/<br \/>\n.\/bootstrap<br \/>\n.\/configure --prefix=\/usr<br \/>\nmake<br \/>\nsudo make install<\/div><\/div>\n<p>\n<strong>Re-flash the Bus Blaster v3 for KT-link buffer<\/strong><\/p>\n<p>The instructions below came from <a href=\"http:\/\/bgamari.github.io\/posts\/2014-08-23-swd-with-busblaster-and-openocd.html\">here<\/a><\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">git clone https:\/\/github.com\/bharrisau\/busblaster.git<br \/>\ncd busblaster\/synthesis<br \/>\nopenocd -f board\/dp_busblaster_v3.cfg -c &quot;adapter_khz 1000; init; svf system.svf; shutdown&quot;<\/div><\/div>\n<p><strong>Getting\/Building the bootloader<\/strong><\/p>\n<p>Now you need to get a bootloader to flash into the CC3D. You might be able to download bl_coptercontrol.hex but I&#8217;ve already got the OpenPilot development environment installed so I just built it using<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">make all_bl all_bu<\/div><\/div>\n<p>If you don&#8217;t have the dev environment setup there are <a href=\"https:\/\/wiki.openpilot.org\/display\/WIKI\/OpenPilot+Developer+Manual\">build<\/a> instructions.<\/p>\n<p>Here is the file I used <a href=\"http:\/\/akkea.ca\/files\/bl_coptercontrol.hex\">bl_coptercontrol.hex<\/a> but the regular disclaimers apply, if this file damages or bricks your CC3D I am not responsible.<\/p>\n<p><strong>OpenOCD config file<\/strong><\/p>\n<p>You need create a flashing script &#8220;cc3d-swd.cfg&#8221; to pass to OpenOCD.<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">source \/usr\/share\/openocd\/scripts\/interface\/ftdi\/dp_busblaster_kt-link.cfg<br \/>\ntransport select swd<br \/>\nsource [find target\/stm32f1x.cfg]<br \/>\n<br \/>\nproc program_device () {<br \/>\n&nbsp; &nbsp; reset init<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; sleep 50<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; flash probe 0<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; sleep 50<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; flash protect 0 0 last off<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; sleep 50<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; flash write_image erase unlock &quot;path_to_hex_file\/bl_coptercontrol.hex&quot;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; sleep 50<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; reset run<br \/>\n}<br \/>\n<br \/>\ninit<br \/>\nprogram_device ()<br \/>\nexit<\/div><\/div>\n<p>Obiously replace &#8220;path_to_hex_file&#8221; to where you built or downloaded bl_coptercontrol.hex<\/p>\n<p><strong>Connect the bus blaster to the CC3d<\/strong><\/p>\n<p>I got the cable connections from <a href=\"http:\/\/bgamari.github.io\/posts\/2014-08-23-swd-with-busblaster-and-openocd.html\">here<\/a>.<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">&nbsp; &nbsp; &nbsp;adapter &nbsp; &nbsp; &nbsp; &nbsp; \u250a &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;target<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u250a<br \/>\n&nbsp; &nbsp; &nbsp;GND \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 GND<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u250a<br \/>\n&nbsp; &nbsp; &nbsp;TCK \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 SWCK<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u250a<br \/>\n&nbsp; &nbsp; &nbsp;TMS \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 SWDAT<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u250a<\/div><\/div>\n<p><strong>Finally reflashing the CC3D bootloader<\/strong><\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">openocd -f cc3d-swd.cfg<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>A few months ago I went to upgrade my OpenPilot CC3D board an something went amiss and I ended up trashing the bootloader. I didn&#8217;t have a SWD dongle to reprogram it with so its been collecting dust. I just &hellip; <a href=\"https:\/\/ainslies.net\/?p=12317\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,1],"tags":[],"class_list":["post-12317","post","type-post","status-publish","format-standard","hentry","category-multirotors","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts\/12317","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12317"}],"version-history":[{"count":9,"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts\/12317\/revisions"}],"predecessor-version":[{"id":12326,"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts\/12317\/revisions\/12326"}],"wp:attachment":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}