{"id":336,"date":"2023-08-17T17:16:02","date_gmt":"2023-08-17T15:16:02","guid":{"rendered":"https:\/\/bowfinger.de\/blog\/?p=336"},"modified":"2023-08-21T09:41:15","modified_gmt":"2023-08-21T07:41:15","slug":"arduino-and-a-custom-board","status":"publish","type":"post","link":"https:\/\/bowfinger.de\/blog\/2023\/08\/arduino-and-a-custom-board\/","title":{"rendered":"Arduino* and a custom board"},"content":{"rendered":"\n<p>At work a colleague developed a custom board in the <em>time of chip shortage<\/em>\u2122 and had to use a 20 MHz oscillator in place of a 16 MHz requiring a custom board configuration. The solution after searching the often misleading Arduino forums was to hack it into the <a href=\"https:\/\/arduino.github.io\/arduino-cli\/0.31\/platform-specification\/#hardware-folders-structure\" data-type=\"URL\" data-id=\"https:\/\/arduino.github.io\/arduino-cli\/0.31\/platform-specification\/#hardware-folders-structure\">global <code>platform.txt<\/code><\/a>. <\/p>\n\n\n\n<p>This is neither portable nor does it interact well with updates of the Core. Fortunately, there are very good, <a href=\"https:\/\/forum.arduino.cc\/t\/custom-isp-programmers-txt-on-2-x-and-macos-location-structure\/1116766\">not misleading forum posts<\/a>!<\/p>\n\n\n\n<p>A (hopefully more than just slightly) better solution is to use the <code>hardware\/<\/code> directory in the <a href=\"https:\/\/support.arduino.cc\/hc\/en-us\/articles\/4415103213714-Find-sketches-libraries-board-cores-and-other-files-on-your-computer\" data-type=\"URL\" data-id=\"https:\/\/support.arduino.cc\/hc\/en-us\/articles\/4415103213714-Find-sketches-libraries-board-cores-and-other-files-on-your-computer\"><code>Sketchbook<\/code> folder<\/a> and to reference the standard Arduino configurations (using the <a href=\"https:\/\/arduino.github.io\/arduino-cli\/0.33\/platform-specification\/#cores\" data-type=\"URL\" data-id=\"https:\/\/arduino.github.io\/arduino-cli\/0.33\/platform-specification\/#cores\"><code>VENDOR_ID:VARIANT_ID<\/code> notation<\/a>).<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Let&#8217;s name the board <code>gsino<\/code> since my colleague and I work at GSI.<\/li>\n\n\n\n<li>Then let&#8217;s create a folder structure <code>$SKETCHBOOK\/hardware\/gsi\/avr<\/code> and &#8230;<\/li>\n\n\n\n<li>&#8230; write a basic <code>boards.txt<\/code> shown below:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">gsino.name=GSino Board<br><br>gsino.upload.tool=arduino:avrdude<br>gsino.upload.protocol=arduino:arduino<br>gsino.upload.maximum_size=32256<br>gsino.upload.maximum_data_size=2048<br>gsino.upload.speed=144000<br><br>gsino.bootloader.tool=arduino:avrdude<br><br>gsino.build.mcu=atmega328p<br>gsino.build.f_cpu=20000000L<br>gsino.build.board=AVR_UNO<br>gsino.build.core=arduino:arduino<br>gsino.build.variant=arduino:standard<\/code><\/pre>\n\n\n\n<p>If the created folder contains only this <code>board.txt<\/code> file, the menu entry in the IDE for this board will be &#8220;Tools\/Board\/gsi-avr\/GSino Board&#8221;. If you want it a little prettier, create a <code>platform.txt<\/code> with<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">gsino.name=GSino<br>gsino.version=1.0.0<\/code><\/pre>\n\n\n\n<p>Voil\u00e0! If you need to take this to another computer or share it with a friend, just zip the relevant parts of the <code>$SKETCHBOOK\/hardware\/<\/code> folder and unpack it in its new location.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"693\" src=\"https:\/\/bowfinger.de\/blog\/wp-content\/uploads\/2023\/08\/ark_hardware-1-1024x693.png\" alt=\"Screenshot of the archive showing the folder hierarchy: &quot;hardware\/gsi\/avr\/&quot; with the three relevant files &quot;boards.txt&quot;, &quot;platform.txt&quot; and &quot;programmers.txt&quot;.\" class=\"wp-image-349\" srcset=\"https:\/\/bowfinger.de\/blog\/wp-content\/uploads\/2023\/08\/ark_hardware-1-1024x693.png 1024w, https:\/\/bowfinger.de\/blog\/wp-content\/uploads\/2023\/08\/ark_hardware-1-300x203.png 300w, https:\/\/bowfinger.de\/blog\/wp-content\/uploads\/2023\/08\/ark_hardware-1-768x520.png 768w, https:\/\/bowfinger.de\/blog\/wp-content\/uploads\/2023\/08\/ark_hardware-1.png 1107w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>And there you have a slightly more portable and cleaner solution to writing your own hardware platform.<\/p>\n\n\n\n<p>*) This was done on Arduino IDE version 1.8.19 and should work for quite a while (probably after version 1.5.x). AFAIK, this should work similarly with the new 2.0 IDE. But I did not test this.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At work a colleague developed a custom board in the time of chip shortage\u2122 and had to use a 20 MHz oscillator in place of a 16 MHz requiring a custom board configuration. The solution after searching the often misleading Arduino forums was to hack it into the global platform.txt. This is neither portable nor&hellip;<\/p>\n","protected":false},"author":1,"featured_media":337,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[88,38,17],"tags":[14,90,20,89,91],"class_list":["post-336","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-embedded","category-hardware","tag-arduino","tag-board","tag-hardware","tag-platform","tag-portability"],"_links":{"self":[{"href":"https:\/\/bowfinger.de\/blog\/wp-json\/wp\/v2\/posts\/336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bowfinger.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bowfinger.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bowfinger.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bowfinger.de\/blog\/wp-json\/wp\/v2\/comments?post=336"}],"version-history":[{"count":8,"href":"https:\/\/bowfinger.de\/blog\/wp-json\/wp\/v2\/posts\/336\/revisions"}],"predecessor-version":[{"id":351,"href":"https:\/\/bowfinger.de\/blog\/wp-json\/wp\/v2\/posts\/336\/revisions\/351"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bowfinger.de\/blog\/wp-json\/wp\/v2\/media\/337"}],"wp:attachment":[{"href":"https:\/\/bowfinger.de\/blog\/wp-json\/wp\/v2\/media?parent=336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bowfinger.de\/blog\/wp-json\/wp\/v2\/categories?post=336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bowfinger.de\/blog\/wp-json\/wp\/v2\/tags?post=336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}