Skip to content

Commit

Permalink
samples: subsys: video: add arducam mega camera full-featured sample
Browse files Browse the repository at this point in the history
This example is a full-featured sample for the Arducam Mega camera
driver. By using serial communication with a PC software, it can
capture images, display them, and also control camera settings
such as exposure and gain.

Signed-off-by: Lee Jackson <lee.jackson@arducam.com>
  • Loading branch information
Lee Jackson committed May 22, 2024
1 parent 811014b commit 779062f
Show file tree
Hide file tree
Showing 6 changed files with 528 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(arducam_mega_full-featured)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
94 changes: 94 additions & 0 deletions samples/drivers/video/arducam_mega_full-featured/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
.. zephyr:code-sample:: video-arducam_mega_full-featured
:name: Arducam mega camera full-featured sample

Capture the image frame and send to the host over
the serial port.

Description
***********

This sample's function is to capture frames from Arducam mega camera and
send them to the host over the UART , Users can get arducam mega full
function's experience through the host.


Requirements
************

This sample requires a Arducam mega camera and USB-UART module.

- :ref:`rpi_pico`
- `Arducam mega camera module`_

Wiring
******

On :ref:`rpi_pico`, The Arducam mega camera module should be connected SPI0.
The PC should be connected to UART0 using a USB to UART cable.

.. note:: Be careful during connection!

Use separate wires to connect SPI pins with pins on the rpi_pico board.
Wiring connection is described in the table below.

+-----------------+----------------+
| Arducam mega | rpi_pico board |
| camera connector| SPI connector |
+=================+================+
| VCC | VCC |
+-----------------+----------------+
| GND | GND |
+-----------------+----------------+
| SCK | P18 |
+-----------------+----------------+
| MISO | P16 |
+-----------------+----------------+
| MOSI | P19 |
+-----------------+----------------+
| CS | P17 |
+-----------------+----------------+

For USB to UART cable, connect the rpi_pico board as below:

+-------------+----------------+
| USB to UART | rpi_pico board |
| cable | UART connector |
+=============+================+
| RX | P0 |
+-------------+----------------+
| TX | P1 |
+-------------+----------------+
| GND | GND |
+-------------+----------------+

Building and Running
********************

For :ref:`rpi_pico`, build this sample application with the following commands:

.. zephyr-app-commands::
:zephyr-app: samples/drivers/video/arducam_mega_full-featured
:board: pico
:goals: build
:compact:

Using UF2
---------

You can flash the Raspberry Pi Pico with a UF2 file. By default, building
an app for this board will generate a `build/zephyr/zephyr.uf2` file.
If the Pico is powered on with the `BOOTSEL` button pressed, it will appear
on the host as a mass storage device. The UF2 file should be drag-and-dropped
to the device, which will flash the Pico.

Sample Usge
=============

You can refer to the `Arducam mega GUI Guide`_ website to install and use
the host to enjoy all the functions of the Arducam mega camera.

References
**********

.. _Arducam mega camera module: https://www.arducam.com/camera-for-any-microcontroller/
.. _Arducam mega GUI Guide: https://www.arducam.com/docs/arducam-mega/arducam-mega-getting-started/packs/GuiTool.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright (c) 2023 Arducam Technology Co., Ltd. <www.arducam.com>
*
* SPDX-License-Identifier: Apache-2.0
*
*/

&uart0{
current-speed = <115200>;
};

&spi0 {
clock-frequency = <4000000>;
cs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
arducam_mega0:arducam-mega0@0 {
compatible = "arducam,mega";
reg = <0>;
spi-max-frequency = <4000000>;
status = "okay";
};
};
9 changes: 9 additions & 0 deletions samples/drivers/video/arducam_mega_full-featured/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CONFIG_PRINTK=y
CONFIG_LOG=y
CONFIG_SERIAL=y

CONFIG_SPI=y
CONFIG_VIDEO=y
CONFIG_VIDEO_INIT_PRIORITY=72
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=2048
CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=3
10 changes: 10 additions & 0 deletions samples/drivers/video/arducam_mega_full-featured/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sample:
name: arducam mega camera full-featured test
tests:
sample.video.arducam_mega_full-featured:
build_only: true
tags: video
platform_allow:
- rpi_pico
integration_platforms:
- rpi_pico
Loading

0 comments on commit 779062f

Please sign in to comment.