at24cx write time delay not long enough

Aperta
#781 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
47/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
go
Ambito
embedded-iot

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Go
Stelle
756
Fork
251
Merge medio
7g 12h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tinygo-org/drivers

Tutte le issue di tinygo-org/drivers

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.