<p><b>@maribu</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/11929#discussion_r308447561">drivers/at24cxxx/at24cxxx.c</a>:</p>
<pre style='color:#555'>> +
+    _position_to_address_words(buffer, pos);
+
+    buffer[sizeof(buffer) - 1] = data;
+
+    int check;
+
+    check = i2c_write_bytes(dev->params.i2c, dev->params.dev_addr, buffer,
+                            sizeof(buffer), 0);
+    DEBUG("write_byte check: %d\n", check);
+    if (check < 0) {
+        //check is a negative errno value
+        return check;
+    }
+
+    xtimer_usleep(AT24CXXX_MAX_WRITE_CYCLE * US_PER_MS);
</pre>
<p>This seems to be a power consumption vs access time tradeoff to me. Continuously polling the I2C bus for up to 5 ms will keep the bus and the MCU busy, but could potentially lead to faster access times (when the write cycle is completed faster than the 5ms).</p>
<p>Also, I remeber from writing the <code>i2c_scan</code> shell command that "pinging" the device does not work reliable on all I2C hardware implementations. (If I remeber correctly, some MCUs required to actually read or write one byte of data, as the subsequent transfer always failed when only the address but now data was transferred.) So just waiting might also be more reliable? <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=19396439" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/MrKevinWeiss">@MrKevinWeiss</a> has superior insight into all the gory details due to his testing effort (afaik), maybe he can confirm or dismiss my doubt?</p>
<p>If waiting without polling will "win", I'd suggest to release the bus before the wait and acquire it again afterwards. That should allow the MCU to power down the bus or let other drivers access the potentially shared bus. (E.g. in I2C standard speed (100kbps) about 60 bytes of data could be transferred within the 5ms, so this can be considered as rather long.)</p>
<p>I'd personally prefer the worst case wait (with bus powered down / available for other tasks) over faster access time.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/11929?email_source=notifications&email_token=ABE7WYDSVJQMR6LTKIYSAKLQB5O47A5CNFSM4IHRRDRKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB75CXIY#discussion_r308447561">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYGPL3KNIIOC2GL3UPDQB5O47ANCNFSM4IHRRDRA">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABE7WYENVJRX3JEHKINOJXDQB5O47A5CNFSM4IHRRDRKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB75CXIY.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/11929?email_source=notifications\u0026email_token=ABE7WYDSVJQMR6LTKIYSAKLQB5O47A5CNFSM4IHRRDRKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB75CXIY#discussion_r308447561",
"url": "https://github.com/RIOT-OS/RIOT/pull/11929?email_source=notifications\u0026email_token=ABE7WYDSVJQMR6LTKIYSAKLQB5O47A5CNFSM4IHRRDRKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB75CXIY#discussion_r308447561",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>