ov3660: add a driver for the OV3660 camera (ESP32 camera boards)
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 22/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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!
- Ngôn ngữ chính
- Go
- Star
- 756
- Fork
- 251
- Merge trung bình
- 7 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tinygo-org/drivers
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
tinygo-org/drivers#946 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
tinygo-org/drivers#927 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
tinygo-org/drivers#886 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
tinygo-org/drivers#877 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
240Mhz Support For ESP32-S3Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
tinygo-org/drivers#876 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của tinygo-org/drivers
Issue tương tự
-
release
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
github/gh-aw-mcpg#17603 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
avr: SPI Mode2 runs as mode 1Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
tinygo-org/tinygo#6727 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
help wanted
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
oras-project/oras-go#1827 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: database/sql Sessions example never commits its batch, and its "Full Example" link is a 404Đang mởdocumentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
ClickHouse/clickhouse-go#2185 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs triage receiver/podman
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
open-telemetry/opentelemetry-collector-contrib#53700 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày