{"id":5086,"date":"2019-09-16T20:18:59","date_gmt":"2019-09-16T19:18:59","guid":{"rendered":"https:\/\/www.purplemeanie.co.uk\/?p=5086"},"modified":"2020-08-13T02:34:58","modified_gmt":"2020-08-13T01:34:58","slug":"ecu-diagnostics-part-12-osi-7-layers-for-caterham-diagnostics","status":"publish","type":"post","link":"https:\/\/purplemeanie.co.uk\/index.php\/2019\/09\/16\/ecu-diagnostics-part-12-osi-7-layers-for-caterham-diagnostics\/","title":{"rendered":"ECU Diagnostics &#8211; part 12 : OSI 7 Layers for Caterham Diagnostics"},"content":{"rendered":"\n<p>Communications protocols are often called protocol stacks&#8230; they&#8217;re layers, or stacks, of different protocols&#8230; one layered on top of the other from lowest level (hardware\/physical) to highest level (software application).<\/p>\n\n\n\n<p>This is where the OSI 7 Layer model comes in&#8230; it standardises how we think about the layers and allows us to talk about where each protocol and hardware\/software sits in the layer stack.<\/p>\n\n\n\n<p>More info on the OSI 7 Layer Model can found <a href=\"https:\/\/en.wikipedia.org\/wiki\/OSI_model\">here<\/a>.<\/p>\n\n\n\n<p>If we now load the OSI model with the layers for the MBE ECU protocol stack then the table looks like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1282\" height=\"723\" data-attachment-id=\"5099\" data-permalink=\"https:\/\/purplemeanie.co.uk\/index.php\/2019\/09\/16\/ecu-diagnostics-part-12-osi-7-layers-for-caterham-diagnostics\/ecu-osi-layers\/\" data-orig-file=\"https:\/\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/ECU-OSI-Layers.png\" data-orig-size=\"1282,723\" 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=\"ECU OSI Layers\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/ECU-OSI-Layers.png\" src=\"https:\/\/www.purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/ECU-OSI-Layers.png\" alt=\"\" class=\"wp-image-5099\" srcset=\"https:\/\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/ECU-OSI-Layers.png 1282w, https:\/\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/ECU-OSI-Layers-600x338.png 600w, https:\/\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/ECU-OSI-Layers-768x433.png 768w\" sizes=\"auto, (max-width: 1282px) 100vw, 1282px\" \/><\/figure>\n\n\n\n<p>From the table above&#8230;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MBE ECU OSI Function<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Application<\/h4>\n\n\n\n<p>At the highest OSI level we have the application layer. This is what the user sees, turning all the lower level layers into something pretty to see.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">mbe.py<\/h4>\n\n\n\n<p>This is my helper class. It takes the more complicated layers below and provides a simpler abstraction layer for the application to use.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">MBE ISOTP<\/h4>\n\n\n\n<p>I&#8217;ve called this layer the MBE ISOTP layer. It adds a communication layer on top of the ISOTP packetization layer. This MBE ISOTP layer provides &#8220;commands&#8221; for config and data extraction from the ECU. It does so &#8220;on top&#8221; of the ISOTP layer&nbsp;below, or another way to think of it is to say the MBE ISOTP packets sit&nbsp;&#8220;inside of&#8221; of the ISOTP packets.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">ISOTP<\/h4>\n\n\n\n<p>This is the standard used to extend CAN bus packets from 8 bytes up to a maximum of 4095 bytes per packet and sits on top of the CAN bus protocol.<\/p>\n\n\n\n<p>It also provides for an additional paradigm called flow control. In theory flow-control should allow CAN bus devices to negotiate the timing between CAN bus frames that each device can support. &nbsp;<\/p>\n\n\n\n<p>HOWEVER &#8211; The MBE\/SBD Easimap and ECU&#8230; DO NOT USE FLOW CONTROL. This caused us some concern to start with and meant we had to adjust some of the ISOTP libraries we were using, see <a href=\"https:\/\/www.purplemeanie.co.uk\/index.php\/2019\/09\/15\/ecu-diagnostics-part-8-easimap-uses-isotp\/\">here<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">CAN Bus<\/h4>\n\n\n\n<p>We&#8217;ve talked about this layer a lot, the most relevant post about it can be found <a href=\"https:\/\/www.purplemeanie.co.uk\/index.php\/2019\/08\/31\/ecu-diagnostics-part-2-ecu-obd-and-can\/\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Communications protocols are often called protocol stacks&#8230; they&#8217;re layers, or stacks, of different protocols&#8230; one layered on top of the other from lowest level (hardware\/physical) to highest level (software application). This is where the OSI 7 Layer model comes in&#8230; it standardises how we think about the layers and allows us to talk about where [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5099,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_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}},"categories":[20],"tags":[34],"class_list":["post-5086","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ecu-diagnostics","tag-ecu-diagnostics"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/ECU-OSI-Layers.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8yl38-1k2","jetpack-related-posts":[{"id":4726,"url":"https:\/\/purplemeanie.co.uk\/index.php\/2019\/08\/31\/ecu-diagnostics-part-1-introduction\/","url_meta":{"origin":5086,"position":0},"title":"ECU Diagnostics &#8211; part 1 : Introduction","author":"John Martin","date":"August 31, 2019","format":false,"excerpt":"So here we go for a marathon series of posts. I'll update this page with links to the completed posts as they come along... IntroductionECUs, OBD and CANTest SetupWireshark Patching and OBD-II ResultsThe Correlator Dead-EndReading MaterialECU Maps and MappingEasimap uses ISOTP (sort of)The Easimap Protocol TheoryDecoding EC2 FilesLogic Analyzer on\u2026","rel":"","context":"In &quot;Caterham Blog&quot;","block_context":{"text":"Caterham Blog","link":"https:\/\/purplemeanie.co.uk\/index.php\/category\/caterham-blog\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5112,"url":"https:\/\/purplemeanie.co.uk\/index.php\/2019\/09\/20\/ecu-diagnostics-part-13-three-diagnostic-protocols-in-the-mbe-9a4-ecu\/","url_meta":{"origin":5086,"position":1},"title":"ECU Diagnostics &#8211; part 13 : Three Diagnostic Protocols in the MBE 9A4 ECU","author":"John Martin","date":"September 20, 2019","format":false,"excerpt":"This one's just a short post to introduce the next three posts. In our investigations of the MBE 9A4 ECU we've found three different diagnostics protocols supported on the OBD port. The following three posts will summarise what we've learnt about each protocol and will be updated with new information\u2026","rel":"","context":"In &quot;Caterham Blog&quot;","block_context":{"text":"Caterham Blog","link":"https:\/\/purplemeanie.co.uk\/index.php\/category\/caterham-blog\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4954,"url":"https:\/\/purplemeanie.co.uk\/index.php\/2019\/09\/07\/ecu-diagnostics-part-6-reading-material\/","url_meta":{"origin":5086,"position":2},"title":"ECU Diagnostics &#8211; part 6 : Reading Material","author":"John Martin","date":"September 7, 2019","format":false,"excerpt":"Another quick one, really quick this time... Mark (CTRMint) had been doing his research and had told us about a book he was buying, and I just couldn't resist... The Car Hacker's Handbook The book isn't the cheapest of purchases, at least not in the UK. But for me it\u2026","rel":"","context":"In &quot;Caterham Blog&quot;","block_context":{"text":"Caterham Blog","link":"https:\/\/purplemeanie.co.uk\/index.php\/category\/caterham-blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/51itpsaLlfL._SX376_BO1204203200_.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":5192,"url":"https:\/\/purplemeanie.co.uk\/index.php\/2019\/09\/20\/ecu-diagnostics-part-14-software-framework-mbe-py\/","url_meta":{"origin":5086,"position":3},"title":"ECU Diagnostics &#8211; part 14 : Software Framework mbe.py","author":"John Martin","date":"September 20, 2019","format":false,"excerpt":"This is hopefully a reasonably short post about the software framework I've developed to help read sensor data from the MBE 9A4 ECU. The software is written in Python 3 and is available here: Caterham-OBD. However, I'm going to talk about using one file only which is mbe.py.\u00a0 The idea\u2026","rel":"","context":"In &quot;Caterham Blog&quot;","block_context":{"text":"Caterham Blog","link":"https:\/\/purplemeanie.co.uk\/index.php\/category\/caterham-blog\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5155,"url":"https:\/\/purplemeanie.co.uk\/index.php\/2019\/09\/20\/ecu-diagnostics-part-13-3-mbe-isotp\/","url_meta":{"origin":5086,"position":4},"title":"ECU Diagnostics &#8211; part 13.3 : MBE-ISOTP","author":"John Martin","date":"September 20, 2019","format":false,"excerpt":"SUMMARY We now understand the communications protocol used by Easimap (the Windows software supplied by the ECU manufacturer) and can use it to ask the ECU for whatever data the car has to offer. We can then manipulate the responses we get back from the car and format them to\u2026","rel":"","context":"In &quot;Caterham Blog&quot;","block_context":{"text":"Caterham Blog","link":"https:\/\/purplemeanie.co.uk\/index.php\/category\/caterham-blog\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5050,"url":"https:\/\/purplemeanie.co.uk\/index.php\/2019\/09\/16\/ecu-diagnostics-part-11-logic-analyzer-on-the-can-bus\/","url_meta":{"origin":5086,"position":5},"title":"ECU Diagnostics &#8211; part 11 : Logic Analyzer on the CAN Bus","author":"John Martin","date":"September 16, 2019","format":false,"excerpt":"To test out my theories and the code I'd been writing, I needed a simple test and a way to make sure the code (and I) was doing what I thought it should be. The code part was easy, take the JSON files I'd created from the Easimap EC2 file\u2026","rel":"","context":"In &quot;Caterham Blog&quot;","block_context":{"text":"Caterham Blog","link":"https:\/\/purplemeanie.co.uk\/index.php\/category\/caterham-blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/img_2013.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/img_2013.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/img_2013.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/img_2013.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/img_2013.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/09\/img_2013.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/5086","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=5086"}],"version-history":[{"count":0,"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/5086\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/media\/5099"}],"wp:attachment":[{"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=5086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=5086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=5086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}