{"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":"2026-05-28T11:50:53","modified_gmt":"2026-05-28T10:50:53","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=\"Layered diagram mapping the MBE ECU protocol stack to OSI layers and CAN bus.\" 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>Maps the Caterham diagnostics stack onto the OSI model, from CAN bus hardware through MBE ISO-TP layers up to Python tooling and applications.<\/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_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},"jetpack_post_was_ever_published":false},"categories":[20],"tags":[58,66,34,60,62],"class_list":["post-5086","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ecu-diagnostics","tag-can-bus","tag-caterham","tag-ecu-diagnostics","tag-mbe","tag-python"],"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":"Introduction and index for the Caterham ECU diagnostics series, covering MBE ECU traffic, CAN bus, OBD-II, ISO-TP, test setup, protocol decoding, and supporting Python and Wireshark tooling.","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":"Introduces the three diagnostic protocols found on the Caterham MBE 9A4 ECU: MBE-Broadcast, OBD-II, and the MBE ISO-TP protocol used by Easimap.","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":5192,"url":"https:\/\/purplemeanie.co.uk\/index.php\/2019\/09\/20\/ecu-diagnostics-part-14-software-framework-mbe-py\/","url_meta":{"origin":5086,"position":2},"title":"ECU Diagnostics &#8211; part 14 : Software Framework mbe.py","author":"John Martin","date":"September 20, 2019","format":false,"excerpt":"Introduces the Python mbe.py framework for sending requests to the Caterham MBE 9A4 ECU and formatting diagnostic responses into readable values.","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":4765,"url":"https:\/\/purplemeanie.co.uk\/index.php\/2019\/08\/31\/ecu-diagnostics-part-2-ecu-obd-and-can\/","url_meta":{"origin":5086,"position":3},"title":"ECU Diagnostics \u2013 part 2 : ECU, OBD and CAN","author":"John Martin","date":"August 31, 2019","format":false,"excerpt":"Explains the Caterham MBE 9A4 ECU, how it exposes diagnostic data, and how OBD and CAN bus concepts fit into the ECU diagnostics project.","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":"MBE 9A4 ECU module label on a purple background.","src":"https:\/\/i0.wp.com\/purplemeanie.co.uk\/wp-content\/uploads\/2019\/08\/9A4.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4954,"url":"https:\/\/purplemeanie.co.uk\/index.php\/2019\/09\/07\/ecu-diagnostics-part-6-reading-material\/","url_meta":{"origin":5086,"position":4},"title":"ECU Diagnostics &#8211; part 6 : Reading Material","author":"John Martin","date":"September 7, 2019","format":false,"excerpt":"Notes how The Car Hacker\u2019s Handbook helped frame the Caterham ECU diagnostics work, especially CAN bus, ISO-TP, UDS, and request-response protocol ideas.","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":"Cover of The Car Hacker's Handbook.","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":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":"Uses a Saleae logic analyser on the CAN bus to validate Caterham MBE ECU diagnostic code and compare captured traffic with expected requests and responses.","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":"Saleae logic analyser connected to a Raspberry Pi PiCAN board on a purple mat.","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":2,"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/5086\/revisions"}],"predecessor-version":[{"id":11526,"href":"https:\/\/purplemeanie.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/5086\/revisions\/11526"}],"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}]}}