ov3660: add a driver for the OV3660 camera (ESP32 camera boards)
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 22/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- embedded-iot
Direzione di ricerca
This is a proposal, not a ready task: the author asks three design questions (one package per chip or a shared camera package, JPEG-only first version, and deferring the capture example). Read the proposed Config/Device API and the register-table generator idea, then wait for a maintainer decision on those questions before starting. Done means an agreed API and an approved first pull request.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The short version
I want to add a driver for the OV3660 camera. It is the camera on many cheap ESP32 camera boards, for example the Freenove ESP32-WROVER CAM. Your CONTRIBUTING.md asks for an issue first, so here it is, with the API, the status and some questions.
The ESP32 side (the camera input that catches the picture bytes) is a separate proposal in TinyGo: https://github.com/tinygo-org/tinygo/issues/5820
Fun fact first
The Freenove book says the board has an OV2640. Mine has an OV3660. The chip ID register says 0x3660. So check yours before you trust the box!
What the driver does
It sets up the camera over I2C (the camera calls it SCCB):
- finds the chip (product ID
0x3660) - resets it and loads the setup tables
- sets the picture size, from 160 x 120 up to 2048 x 1536
- JPEG output, with a quality setting
- flip, mirror, and the colour bar test pattern
It does not read the pictures. That is the job of the camera input in TinyGo (see the link above).
The proposed API
It follows the driver design guide: a Config, a Device, New with a drivers.I2C, and no allocations.
package ov3660
const Address = 0x3C
type Size uint8 // QQVGA (160 x 120), QVGA, CIF, VGA, SVGA, XGA, UXGA, QXGA (2048 x 1536)
type Format uint8 // JPEG
type Config struct {
Size Size
Format Format
Quality uint8 // JPEG quality, 0 to 63, lower is better
XCLK uint32 // the camera input clock in Hz
}
func DefaultConfig(xclk uint32) Config // 320 x 240, JPEG, quality 12
func (c Config) Validate() error
func New(bus drivers.I2C) Device
func (d *Device) Connected() bool
func (d *Device) Configure(cfg Config) error
func (d *Device) SetSize(s Size) error
func (d *Device) SetQuality(q uint8) error
func (d *Device) SetFlip(vertical, horizontal bool) error
func (d *Device) SetColorBar(on bool) error
Two details I am happy about
- The register tables are generated, not typed by hand. A small generator (
go generate) reads Espressif's esp32-camera header and writestables.go. So we can compare with the source, and nobody has to check 200 lines of hex by eye. - The clock settings stay inside the datasheet limits. Espressif's values for the internal PLL are outside the range that the OV3660 datasheet allows, at the 10 MHz input clock the ESP32 can make. The driver computes values inside the range. On my board it gives about 27 pictures per second, against 14 with the Espressif values.
Status
- Driver plus 8 unit tests with a fake I2C bus: all pass.
- Tested on the Freenove ESP32-WROVER CAM: real JPEG pictures at 160 x 120, 320 x 240 and 640 x 480, plus 10 minutes non-stop without an error.
- An example that finds and sets up the camera. It builds with TinyGo 0.42.
One honest known problem
In about 2 of 80 test runs, real pictures came out green. The JPEG is complete and valid, but its colour planes copy the brightness plane. The colour bar test pattern was always perfect. I could not trigger it again on purpose, so I did not "fix" it with a guess. If you have seen this with an OV3660 before, I would love a hint!
Questions for you
- One package per chip (
ov3660, and laterov2640), or first a small sharedcamerapackage that detects which chip is there? - JPEG only for a first version. OK?
- The capture example. An example that also takes pictures needs the new TinyGo camera input. The CI uses released TinyGo, so I would add that example in a later pull request, after a TinyGo release. OK?
Thanks for reading!
- Lingua principale
- Go
- Stelle
- 756
- Fork
- 251
- Merge medio
- 7g 12h
- PR unite (30g)
- 8
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tinygo-org/drivers
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
tinygo-org/drivers#946 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
tinygo-org/drivers#927 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
tinygo-org/drivers#886 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
tinygo-org/drivers#877 ·
I maintainer di solito rispondono entro 3 giorni
-
240Mhz Support For ESP32-S3Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
tinygo-org/drivers#876 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di tinygo-org/drivers
Issue simili
-
release
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
github/gh-aw-mcpg#17603 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tinygo-org/tinygo#6727 ·
I maintainer di solito rispondono entro 1 giorno
-
help wanted
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 94/100
oras-project/oras-go#1827 ·
I maintainer di solito rispondono entro 1 giorno
-
docs: database/sql Sessions example never commits its batch, and its "Full Example" link is a 404Apertadocumentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
ClickHouse/clickhouse-go#2185 ·
I maintainer di solito rispondono entro 1 giorno
-
bug needs triage receiver/podman
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
open-telemetry/opentelemetry-collector-contrib#53700 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno