at24cx write time delay not long enough

オープン
#781 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
47/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
go
領域
embedded-iot

調査の方向性

Read at24cx/at24cx.go, focusing on WriteByte and writeAt, and compare their delays with the datasheet’s documented 10 ms maximum write time. Check the at24cx example’s repeated WriteByte calls to understand how the missing delay affects callers. Done means both write paths reliably allow the chip’s write cycle to complete; the issue reports no test file.

索引モデルが issue の本文から書いたものです。

説明

First, thank you for the amazing tinygo work - am having much success on both Raspberry Pi Pico and Seeed Studio XIAO RP2040 boards.

The documented maximum write time in the datasheet is 10 milliseconds.

In file:

https://github.com/tinygo-org/drivers/blob/v0.32.0/at24cx/at24cx.go

The method "WriteByte" there is no write time delay so the engineer using this driver must know to include a write time delay when calling iteratively (as demonstrated by the at24cx example main.go file)

The method "writeAt" contains a write time delay but it is only 2 milliseconds - this obviously works for many/most at24cx chips but not all as i have one at24cx which must be on the slower-side to complete the write cycle.

In my local copy of the driver, i added the following to the two appropriate locations, in "WriteByte" before "return d.bus.Tx(d.Address, address, nil)" which results in the delay when iteratively called and is less disruptive to the code than trying to add afterward (though it would be better to delay afterward), and replacing the existing 2 millisecond write time delay in the "writeAt" method:

	// The required time delay should be in the driver and preferably not the responsibility of the application
	//time.Sleep(2 * time.Millisecond)  // empirically NOT enough sleep time
	//time.Sleep(3 * time.Millisecond)  // empirically YES enough sleep time
	//time.Sleep(10 * time.Millisecond) // DATASHEET-REQUIRED sleep time
	time.Sleep(11 * time.Millisecond)   // DATASHEET-REQUIRED-SAFETY-MARGIN sleep time

Again, thank you for all the great work on tinygo!

I hope this helps others in the future.

主要言語
Go
スター
756
フォーク
251
平均マージ
7日 12時間
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tinygo-org/drivers のほかの issue

tinygo-org/drivers の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。