{"id":48,"date":"2012-02-18T18:41:00","date_gmt":"2012-02-18T18:41:00","guid":{"rendered":"https:\/\/blog.hslracing.com\/3dprinters\/2012\/02\/18\/bootloading-and-arduino\/"},"modified":"2012-02-18T18:41:00","modified_gmt":"2012-02-18T18:41:00","slug":"bootloading-and-arduino","status":"publish","type":"post","link":"https:\/\/blog.hslracing.com\/3dprinters\/2012\/02\/bootloading-and-arduino.html","title":{"rendered":"Bootloading and Arduino"},"content":{"rendered":"<p>My USBasp programmer arrived in 3 days (wow that was fast), seems it came from a supplier just down the road from me, rather than direct from HK.<\/p>\n<p>I downloaded and installed the <a href=\"http:\/\/arduino.cc\/\">Arduino<\/a> 1.0 software, downloaded and configured the <a href=\"http:\/\/sanguino.cc\/\">Sanguino<\/a> add-on software, connected up the programmer to the breadboard, select the relevant options in Arduino and attempt to upload the bootloader.<\/p>\n<p>Well it barfed a lot but I think (after much googling) that it may have worked &#8211; no &#8220;successfully uploaded&#8221; messages, just a long pause, stops and then displays a load of messages about &#8220;pipe stalled&#8221;.<\/p>\n<p>I connected up the debug led to pin 1 and on power on or pressing the reset button, this flashes a couple of times &#8211; this apparently means that there is a bootloader present &#8211; yeah finally some progress.<\/p>\n<p>I also located some newer information relating to using this version with an ATmega644p at&nbsp;<a href=\"http:\/\/maniacbug.wordpress.com\/2011\/11\/27\/arduino-on-atmega1284p-4\/\">maniacbug&#8217;s<\/a>&nbsp;blog, along with a link for a version of the bootloader that will actually compile, since none of the other ones I can locate will.<\/p>\n<p>Next, I download <a href=\"https:\/\/github.com\/kliment\/Sprinter\">sprinter<\/a>&nbsp;from <a href=\"https:\/\/github.com\/\">github<\/a>&nbsp;and attempt to compile\/upload this to the newly bootloaded chip.<\/p>\n<p>First hurdle &#8211;&nbsp;<a href=\"http:\/\/arduino.cc\/\">Arduino<\/a>&nbsp;has had a major rewrite for version 1.0, and it would seem that the&nbsp;<a href=\"http:\/\/sanguino.cc\/\">Sanguino<\/a>&nbsp;and <a href=\"http:\/\/reprap.org\/\">reprap<\/a> community are somewhat behind the curve here.<\/p>\n<p>Downloaded&nbsp;<a href=\"http:\/\/arduino.cc\/\">Arduino<\/a>&nbsp;0.23 as this supposedly works with the most recent version of&nbsp;<a href=\"http:\/\/sanguino.cc\/\">Sanguino<\/a>, more tweaking, still no joy, bootload from this version fails outright as well.<\/p>\n<p>Apparently I am not alone with having issues with this version.<\/p>\n<p>Downloaded&nbsp;<a href=\"http:\/\/arduino.cc\/\">Arduino<\/a>&nbsp;0.18 and the appropriate version of&nbsp;<a href=\"http:\/\/sanguino.cc\/\">Sanguino<\/a>&nbsp;for this, well these actually compile the&nbsp;<a href=\"https:\/\/github.com\/kliment\/Sprinter\">sprinter<\/a>&nbsp;software, so that in itself is progress,<\/p>\n<p>The only version that seems capable of uploading the bootloader is 1.0, and the only version that will compile the software is 0.18 &#8211; oh joy.<\/p>\n<p>Also version 0.18 of&nbsp;<a href=\"http:\/\/arduino.cc\/\">Arduino<\/a>&nbsp;does not support the upload of software via the programmer unlike version 1.0, so a serial programmer is required.<\/p>\n<p>I have one, a PL2303 USB to RS232, however it does not have a pin for connecting to the reset pin of the ATmega644p chip, so another programmer is required, a CP2102, that is more compatible with AVR chips:<\/p>\n<div style=\"clear: both;text-align: center\"><a href=\"http:\/\/1.bp.blogspot.com\/-KiO2QVQ26CM\/Tz9wesH8CfI\/AAAAAAAAAMU\/YKZoybdNw6M\/s1600\/Serial_uart.jpg\" style=\"margin-left: 1em;margin-right: 1em\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"320\" src=\"http:\/\/1.bp.blogspot.com\/-KiO2QVQ26CM\/Tz9wesH8CfI\/AAAAAAAAAMU\/YKZoybdNw6M\/s320\/Serial_uart.jpg\" width=\"320\" \/><\/a><\/div>\n<div style=\"clear: both;text-align: left\">A massive \u00a31.82 spend on <a href=\"http:\/\/www.ebay.co.uk\/\">eBay<\/a> and a few more days wait later and I have the item and can hook it up to the board.<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\">My Mac does not recognise it, so a quick search for a CP2102 driver, which I located at <a href=\"http:\/\/www.silabs.com\/products\/mcu\/Pages\/USBtoUARTBridgeVCPDrivers.aspx\">Silicon Labs<\/a>&nbsp;website, install and restart &#8211; hey presto we have a new serial port called SLAB_USBtoUART that I can select within&nbsp;<a href=\"http:\/\/arduino.cc\/\">Arduino<\/a>.<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\">Some minor cabling updates to the breadboard and we try again &#8211; fails with stk500 errors cannot communicate.<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\">A bit more googling, and find a work around that suggests pressing the reset button 4 seconds after selecting the &#8220;upload to board&#8221; option from the software &#8211; this seems to have the desired effect, the debug light flashes quite a lot at varying speeds and eventually stops.<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\">Again, no nice &#8220;your upload was successful&#8221; message, but I believe it did actually upload something, so let&#8217;s test if we can talk to it.<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\">Locate my installation of <a href=\"https:\/\/github.com\/kliment\/Printrun\">Printrun<\/a>&nbsp;and fire it up, then after I locate the correct syntax to connect to my specific serial port, it claims that the printer is set up &#8211; wahey looks like we made it.<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\">Now you may ask &#8211; &#8220;why go to all this trouble and not just solder up the board already and then program it via the USB port like everyone else?&#8221;<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\">Well, partly because I don&#8217;t actually want to use the USB connection, I want to talk to the board via bluetooth, and if I solder the USB connector, it will prevent me from soldering on the pins for the TTL header, and partly, just to see if I can.<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\">I bought a couple of Bluetooth modules from&nbsp;&nbsp;<a href=\"http:\/\/www.ebay.co.uk\/\">eBay<\/a>,&nbsp;\u00a311.70 for two:<\/div>\n<div style=\"clear: both;text-align: center\"><a href=\"http:\/\/4.bp.blogspot.com\/-ISzKCAGDboY\/Tz93fFPVkQI\/AAAAAAAAAMc\/pOOJGjpQyvg\/s1600\/Bluetooth+Module.jpg\" style=\"margin-left: 1em;margin-right: 1em\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"298\" src=\"http:\/\/4.bp.blogspot.com\/-ISzKCAGDboY\/Tz93fFPVkQI\/AAAAAAAAAMc\/pOOJGjpQyvg\/s320\/Bluetooth+Module.jpg\" width=\"320\" \/><\/a><\/div>\n<div style=\"clear: both;text-align: left\">so much cheaper than the <a href=\"http:\/\/www.sparkfun.com\/products\/10268\">BlueSMiRF<\/a> items from <a href=\"http:\/\/www.sparkfun.com\/\">Sparkfun Electronics<\/a> at $64.95 a piece!<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\">I may yet find that the cheaper items cause issues, but we shall see, serial communication should only need transmit and receive &#8211; hell, I used to use a broken paperclip to cross connect RX and TX between the B serial port of one Sun Microsystems Sparc 5, 10, 20, etc machine to the A serial port of another to provide a makeshift console (no other pins connected), provided you selected the correct baud, parity, data, stop bits, etc it worked just fine.<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\">My Mac Mini and my work Windows laptop can both see the Bluetooth module quite happily, I just need to connect to it via something like <a href=\"http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/\">putty<\/a> and change the baud rate to something a bit faster than 9600, this was achieved by connecting it to my PL2303 adapter and then issuing some AT commands via copy and paste (as you can&#8217;t type them fast enough on a keyboard).<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\"><a href=\"https:\/\/github.com\/kliment\/Printrun\">Printrun<\/a>&nbsp;can connect to the bluetooth device, however cannot confirm the printer as online, let&#8217;s wait and see what it thinks when we actually have a FTDI TTL chip sat in between the ATmega644p and the Bluetooth module, when the <a href=\"http:\/\/reprap.org\/wiki\/Sanguinololu\">Sanguinololu<\/a> board is all soldered up.<\/div>\n<div style=\"clear: both;text-align: left\"><\/div>\n<div style=\"clear: both;text-align: left\">As a side note, I also discovered that if I have any kind of USB connection to my breadboard and connect up the 5V line, I don&#8217;t actually need the voltage regulator circuit, as it will be provided by the USB connection.<\/div>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>My USBasp programmer arrived in 3 days (wow that was fast), seems it came from a supplier just down the road from me, rather than direct from HK. I downloaded and installed the Arduino 1.0 software, downloaded and configured the Sanguino add-on software, connected up the programmer to the breadboard, select the relevant options in&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/blog.hslracing.com\/3dprinters\/wp-json\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.hslracing.com\/3dprinters\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hslracing.com\/3dprinters\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hslracing.com\/3dprinters\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hslracing.com\/3dprinters\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":0,"href":"https:\/\/blog.hslracing.com\/3dprinters\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.hslracing.com\/3dprinters\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hslracing.com\/3dprinters\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hslracing.com\/3dprinters\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}