{"id":313,"date":"2023-06-28T09:35:58","date_gmt":"2023-06-28T09:35:58","guid":{"rendered":"http:\/\/localhost\/embeddedwala\/?p=313"},"modified":"2023-07-27T04:13:46","modified_gmt":"2023-07-27T04:13:46","slug":"getting-started-with-i2c-what-is-bus-arbitration","status":"publish","type":"post","link":"https:\/\/embeddedwala.com\/beta\/blogs\/digital-communication\/getting-started-with-i2c-what-is-bus-arbitration\/","title":{"rendered":"Getting Started with I2C: What is Bus Arbitration"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"313\" class=\"elementor elementor-313\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t\t\t\t<section data-particle_enable=\"false\" data-particle-mobile-disabled=\"false\" class=\"elementor-section elementor-top-section elementor-element elementor-element-6a46ce9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6a46ce9\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b954f96\" data-id=\"b954f96\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<section data-particle_enable=\"false\" data-particle-mobile-disabled=\"false\" class=\"elementor-section elementor-inner-section elementor-element elementor-element-f48b3bb elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f48b3bb\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-b7fb051\" data-id=\"b7fb051\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a0263e5 elementor-widget elementor-widget-text-editor\" data-id=\"a0263e5\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<h2><span class=\"ez-toc-section\" id=\"1-What-is-I2C-Protocol\"><\/span><strong><span lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\">1. What is I2C Protocol?<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2><p><span lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><strong>I2C (Inter-Integrated Circuit)<\/strong>\u00a0is a widely used communication protocol that connects microcontrollers and other integrated circuits in embedded systems. Its primary purpose is to enable communication between different components within a system. It operates on a synchronous serial communication mechanism, using a single clock line and a data line to transfer data between devices.<\/span><\/p><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_51_1 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title ez-toc-toggle\" style=\"cursor: pointer\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\" role=\"button\"><label for=\"item-69d2aadc5a4f8\" ><span class=\"\"><span style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #337ab7;color:#337ab7\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #337ab7;color:#337ab7\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input aria-label=\"Toggle\" aria-label=\"item-69d2aadc5a4f8\"  type=\"checkbox\" id=\"item-69d2aadc5a4f8\"><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/embeddedwala.com\/beta\/blogs\/digital-communication\/getting-started-with-i2c-what-is-bus-arbitration\/#1-What-is-I2C-Protocol\" title=\"1. What is I2C Protocol?\">1. What is I2C Protocol?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/embeddedwala.com\/beta\/blogs\/digital-communication\/getting-started-with-i2c-what-is-bus-arbitration\/#2-What-is-I2C-protocol-bus-arbitration\" title=\"2. What is I2C protocol bus arbitration?\">2. What is I2C protocol bus arbitration?<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"2-What-is-I2C-protocol-bus-arbitration\"><\/span><strong><span lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\">2. What is I2C protocol bus arbitration?<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2><p><span class=\"TextRun SCXO186744652 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXO186744652 BCX8\">One of the key features of the I2C protocol is\u00a0<strong>arbitration<\/strong>, which allows multiple devices to communicate on the same bus. In I2C communication, arbitration is used to resolve conflicts that occur when two or more devices attempt to transmit data at the same time. The arbitration mechanism ensures that only one device has control of the bus at any given time, and that data is transmitted without any errors.<\/span><\/span><span class=\"EOP SCXO186744652 BCX8\">\u00a0<\/span><\/p><p>When\u00a0<strong>two or more devices<\/strong>\u00a0try to communicate with each other on the I2C bus at the same time, an arbitration process occurs to determine which device has priority to transmit data on the bus. This is known as<strong>\u00a0I2C bus arbitration<\/strong>.<\/p><p>The arbitration process in I2C is based on a\u00a0<strong>wired-AND<\/strong>\u00a0logic system. In this system, each device on the bus can pull the bus lines low (logic 0), but cannot pull them high (logic 1). Therefore, if two or more devices try to transmit data at the same time, they will both try to pull the bus lines low. The device that pulls the bus lines low first will win the arbitration and will be able to transmit its data on the bus.<\/p><p>To understand I2C bus arbitration, let&#8217;s consider an example where two<strong>\u00a0I2C Master<\/strong>\u00a0devices, Master 0 and Master 1, are connected to the same I2C bus (SDA and SCL). Both\u00a0masters are attempting to transmit data on the bus simultaneously with the goal of sending the data frame to a same sensor acting as an<strong>\u00a0I2C Slave<\/strong>.<\/p><p>At the beginning of communication, both Master &#8216;0&#8217; and Master &#8216;1&#8217; will inspect the bus to determine if it is free. If the bus is available, both masters will commence transmitting their data simultaneously. Nonetheless, if both masters attempt to lower the bus lines concurrently, an\u00a0<strong>arbitration<\/strong> procedure will take place, which is illustrated in the figure below.<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-314\" src=\"http:\/\/localhost\/embeddedwala\/wp-content\/uploads\/2023\/06\/I2C-Attribution.png\" alt=\"\" width=\"1920\" height=\"1080\" \/><\/p><p>During this\u00a0<strong>arbitration<\/strong>\u00a0process, both masters will persist in lowering the bus lines until one of them successfully pulls them down first, as seen in the figure above. At the outset, both Master 0 and 1 were transmitting identical data. However,\u00a0<strong>when Master &#8216;0&#8217; transmitted data 0x2A while Master &#8216;1&#8217; sent 0x2F, Master &#8216;0&#8217; emerged as the winner of the arbitration by pulling down the SDA line first as 0x2A is 0x00101010<\/strong>. Therefore, Master &#8216;0&#8217; will proceed to transmit its data on the bus. Meanwhile, Master &#8216;1&#8217; recognized that the bus was no longer free and hence backed off, waiting for the next opportunity to transmit its data.<\/p><p>In summary,\u00a0<strong>I2C bus arbitration<\/strong>\u00a0is a process used to determine which device has priority to transmit data on the bus when multiple devices try to transmit data at the same time. The device that pulls the bus lines low first wins the arbitration and is able to transmit its data on the bus. The other device backs off and waits for the next opportunity to transmit its data.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>1. What is I2C Protocol? I2C (Inter-Integrated Circuit)&nbsp;is a widely used communication protocol that connects&#8230;<\/p>\n","protected":false},"author":1,"featured_media":315,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[81,54,83,74,77],"class_list":["post-313","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-digital-communication","tag-bus-arbitration","tag-i2c","tag-multi-master","tag-multi-slave","tag-serial-communications"],"acf":[],"views":429,"featured_image_urls":{"full":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",1920,1080,false],"thumbnail":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",150,84,false],"medium":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",300,169,false],"medium_large":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",640,360,false],"large":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",640,360,false],"1536x1536":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",1536,864,false],"2048x2048":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",1920,1080,false],"tp-image-grid":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",700,394,false],"covernews-slider-full":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",1115,627,false],"covernews-slider-center":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",800,450,false],"covernews-featured":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",1024,576,false],"covernews-medium":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",540,304,false],"covernews-medium-square":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",400,225,false],"_nx_notification_thumb":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png",100,56,false]},"author_info":{"display_name":"embeddedwala","author_link":"https:\/\/embeddedwala.com\/beta\/author\/embeddedwala\/"},"category_info":"<a href=\"https:\/\/embeddedwala.com\/beta\/category\/blogs\/digital-communication\/\" rel=\"category tag\">Digital Communication<\/a>","tag_info":"Digital Communication","comment_count":"0","_links":{"self":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts\/313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/comments?post=313"}],"version-history":[{"count":5,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts\/313\/revisions"}],"predecessor-version":[{"id":6202,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts\/313\/revisions\/6202"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/media\/315"}],"wp:attachment":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/media?parent=313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/categories?post=313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/tags?post=313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}