{"id":461,"date":"2016-07-08T15:35:28","date_gmt":"2016-07-08T13:35:28","guid":{"rendered":"https:\/\/blog.ramses-pyramidenbau.de\/?p=461"},"modified":"2016-07-08T19:25:18","modified_gmt":"2016-07-08T17:25:18","slug":"reverse-engineering-the-i2c-protocol-of-the-mikrokopter-platform","status":"publish","type":"post","link":"https:\/\/blog.vmexit.de\/?p=461","title":{"rendered":"Reverse Engineering the I2C Protocol of the Mikrokopter Platform"},"content":{"rendered":"<p>We bought a <a href=\"http:\/\/wiki.mikrokopter.de\/MK-OktoXL\">Miktokopter Okto XL<\/a> for our <a href=\"http:\/\/github.com\/lfd\">laboratory<\/a>. I chose the Mikrokopter project because I had in mind, that a few years ago everything was developed in a community driven open source way. Unfortunately, it turned out that things changed and that the source code of recent versions of the Mikrokopter software is <a href=\"http:\/\/svn.mikrokopter.de\/websvn\/listing.php?repname=BL-Ctrl\">closed source<\/a>, they only provide precompiled firmware images. Shame on you! A short look at older versions of the code probably reveals the reasons why the chose to close the code&#8230;<\/p>\n<p>Anyway, our plan is to replace the FlightCtrl by our own Linux-driven Hardware while we want to keep the Brushless controllers. So we had to reverse engineer the I\u00b2C protocol of the <a href=\"http:\/\/wiki.mikrokopter.de\/Okto-BL-Ctrl_3\">Brushless Controllers<\/a> (BL-Ctrl V3). Developer information available on the <a href=\"http:\/\/wiki.mikrokopter.de\/BlCtrlProtocol\">Mikrokopter Wiki<\/a> was not very helpful.<\/p>\n<p>This is a short overview of the I\u00b2C protocol of the Oktokopter XL V3: We made a capture of the communication FlightCtrl <> BL-Ctrl.<\/p>\n<ul>\n<li>Speed: max. 200kHz<\/li>\n<li>Addresses: 0x52-0x62<\/li>\n<li>Write: Either one Byte (0-255) or two Bytes (0-2048) denote the speed of the motor<\/li>\n<li>Read: On read, a controller returns six Byte:\n<ul>\n<li>1: Current in 100mA steps<\/li>\n<li>2: Status (see table below)<\/li>\n<li>3: Temperature in degrees Celsius<\/li>\n<li>4: Raw RPM value (some correction factor needed??)<\/li>\n<li>5: Unused \/ Reserved \/ Voltage for BL_CTRL V3<\/li>\n<li>6: Voltage in 100mV steps<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Possible status values that we observed:<\/p>\n<ul>\n<li> 255: running<\/li>\n<li> 248: not running but ready<\/li>\n<\/ul>\n<p>There are more possible status values but we did not observe them yet.<\/p>\n<p>After Digging a bit deeper, we found out, that it is not possible to directly jump from 0 RPM to maximum RPM. Speed has to increase &#8216;slowly&#8217; in smaller steps. Furthermore, the motor settings must consequently be transmitted, even if they do not change. If a controller doesn&#8217;t receive I\u00b2C signals any longer, it automatically stops motors after ~500ms.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We bought a Miktokopter Okto XL for our laboratory. I chose the Mikrokopter project because I had in mind, that a few years ago everything was developed in a community driven open source way. Unfortunately, it turned out that things changed and that the source code of recent versions of the Mikrokopter software is closed &hellip; <a href=\"https:\/\/blog.vmexit.de\/?p=461\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Reverse Engineering the I2C Protocol of the Mikrokopter Platform<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,9],"tags":[],"class_list":["post-461","post","type-post","status-publish","format-standard","hentry","category-electronics","category-embedded"],"_links":{"self":[{"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/posts\/461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=461"}],"version-history":[{"count":26,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/posts\/461\/revisions"}],"predecessor-version":[{"id":487,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/posts\/461\/revisions\/487"}],"wp:attachment":[{"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}