diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-12-10 11:12:22 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-12-10 11:12:22 -0600 |
commit | 53acf8f56667fe87781b054e86472b32732eeffa (patch) | |
tree | 0513cbcd50467eff8b318782d1ba1ef9918d3df5 | |
parent | c89f9dcebca9bded25a85d13c436219c7411e973 (diff) | |
download | nuttx-53acf8f56667fe87781b054e86472b32732eeffa.tar.gz nuttx-53acf8f56667fe87781b054e86472b32732eeffa.tar.bz2 nuttx-53acf8f56667fe87781b054e86472b32732eeffa.zip |
A little more SAMA5/OV2640 logic
-rw-r--r-- | nuttx/configs/sama5d3x-ek/README.txt | 67 | ||||
-rw-r--r-- | nuttx/configs/sama5d3x-ek/ov2640/defconfig | 58 | ||||
-rw-r--r-- | nuttx/configs/sama5d3x-ek/src/sam_ov2640.c | 90 |
3 files changed, 124 insertions, 91 deletions
diff --git a/nuttx/configs/sama5d3x-ek/README.txt b/nuttx/configs/sama5d3x-ek/README.txt index a981c8651..6fcdf2be9 100644 --- a/nuttx/configs/sama5d3x-ek/README.txt +++ b/nuttx/configs/sama5d3x-ek/README.txt @@ -2228,37 +2228,42 @@ OV2640 Camera Interface SAMA5D3x PIN SAMA5D3x-EK OV2640 PIO PER SIGNAL ISI Socket J11 - ---- --- ------------- --- ------------ ------------ - 1 VDDISI - 2 GND - 3 VDDISI - 4 GND - PE28 ? ? 5 ZB_SLPTR - PE29 ? ? 6 ZB_RST - PC27 B TWI1_CK 7 TWCK1 - PC26 B TWI1_D 8 TWD1 - 9 GND - PD31 B PCK1 (ISI_MCK) 10 ISI_MCK - 11 GND - PA30 C ISI_VSYNC 12 ISI_VSYNC - 13 GND - PA31 C ISI_HSYNC 14 ISI_HSYNC - 15 GND - PC30 C ISI_PCK 16 ISI_PCK - 17 GND - PA16 C ISI_D0 18 ISI_D0 - PA17 C ISI_D1 19 ISI_D1 - PA18 C ISI_D2 20 ISI_D2 - PA19 C ISI_D3 21 ISI_D3 - PA20 C ISI_D4 22 ISI_D4 - PA21 C ISI_D5 23 ISI_D5 - PA22 C ISI_D6 24 ISI_D6 - PA23 C ISI_D7 25 ISI_D7 - PC29 C ISI_D8 26 ISI_D8 - PC28 C ISI_D9 27 ISI_D9 - PC27 C ISI_D10 28 ISI_D10 - PC26 C ISI_D11 29 ISI_D11 - 30 GND + ---- --- ------------- --- ------------ ---------------------------------------- + --- 1 VDDISI --- + --- 2 GND --- + --- 3 VDDISI --- + --- 4 GND --- + PE28 ? ? 5 ZB_SLPTR ??? + PE29 ? ? 6 ZB_RST C6 RESETB Reset mode (?) + PC27 B TWI1_CK 7 TWCK1 C2 SIO_C SCCB serial interface clock input + PC26 B TWI1_D 8 TWD1 C1 SIO_D SCCB serial interface data I/O + --- 9 GND --- + PD31 B PCK1 (ISI_MCK) 10 ISI_MCK C4 XVCLK System clock input (?) + --- 11 GND --- + PA30 C ISI_VSYNC 12 ISI_VSYNC D2 VSYNC Vertical synchronization + --- 13 GND --- + PA31 C ISI_HSYNC 14 ISI_HSYNC C3 HREF Horizontal reference output (?) + --- 15 GND --- + PC30 C ISI_PCK 16 ISI_PCK E3 PCLK Pixel clock output + --- 17 GND --- + PA16 C ISI_D0 18 ISI_D0 E2 Y0 Video port output bit[0] + PA17 C ISI_D1 19 ISI_D1 E1 Y1 Video port output bit[1] + PA18 C ISI_D2 20 ISI_D2 F3 Y2 Video port output bit[2] + PA19 C ISI_D3 21 ISI_D3 G3 Y3 Video port output bit[3] + PA20 C ISI_D4 22 ISI_D4 F4 Y4 Video port output bit[4] + PA21 C ISI_D5 23 ISI_D5 G4 Y5 Video port output bit[5] + PA22 C ISI_D6 24 ISI_D6 E5 Y6 Video port output bit[6] + PA23 C ISI_D7 25 ISI_D7 G5 Y7 Video port output bit[7] + PC29 C ISI_D8 26 ISI_D8 F5 Y8 Video port output bit[8] + PC28 C ISI_D9 27 ISI_D9 G6 Y9 Video port output bit[9] + PC27 C ISI_D10 28 ISI_D10 --- + PC26 C ISI_D11 29 ISI_D11 --- + --- 30 GND --- + + ??? ?? A2 EXPST_B Snapshot exposure start trigger + ??? ?? A6 STROBE Flash control output + ??? ?? B2 FREX Snapshot trigger + ??? ?? B6 PWDN Power-down mode enable I2S Audio Support ================= diff --git a/nuttx/configs/sama5d3x-ek/ov2640/defconfig b/nuttx/configs/sama5d3x-ek/ov2640/defconfig index 80d5f4318..7f3297b72 100644 --- a/nuttx/configs/sama5d3x-ek/ov2640/defconfig +++ b/nuttx/configs/sama5d3x-ek/ov2640/defconfig @@ -488,63 +488,7 @@ CONFIG_DISABLE_MOUNTPOINT=y # # Graphics Support # -CONFIG_NX=y -CONFIG_NX_NPLANES=1 -# CONFIG_NX_WRITEONLY is not set - -# -# Supported Pixel Depths -# -CONFIG_NX_DISABLE_1BPP=y -CONFIG_NX_DISABLE_2BPP=y -CONFIG_NX_DISABLE_4BPP=y -CONFIG_NX_DISABLE_8BPP=y -# CONFIG_NX_DISABLE_16BPP is not set -CONFIG_NX_DISABLE_24BPP=y -CONFIG_NX_DISABLE_32BPP=y -CONFIG_NX_PACKEDMSFIRST=y - -# -# Input Devices -# -# CONFIG_NX_MOUSE is not set -# CONFIG_NX_KBD is not set - -# -# Framed Window Borders -# -CONFIG_NXTK_BORDERWIDTH=3 -CONFIG_NXTK_DEFAULT_BORDERCOLORS=y -# CONFIG_NXTK_AUTORAISE is not set - -# -# Font Selections -# -CONFIG_NXFONTS_CHARBITS=7 -# CONFIG_NXFONT_MONO5X8 is not set -# CONFIG_NXFONT_SANS17X22 is not set -# CONFIG_NXFONT_SANS20X26 is not set -# CONFIG_NXFONT_SANS23X27 is not set -# CONFIG_NXFONT_SANS22X29 is not set -# CONFIG_NXFONT_SANS28X37 is not set -# CONFIG_NXFONT_SANS39X48 is not set -CONFIG_NXFONT_SANS17X23B=y -# CONFIG_NXFONT_SANS20X27B is not set -# CONFIG_NXFONT_SANS22X29B is not set -# CONFIG_NXFONT_SANS28X37B is not set -# CONFIG_NXFONT_SANS40X49B is not set -# CONFIG_NXFONT_SERIF22X29 is not set -# CONFIG_NXFONT_SERIF29X37 is not set -# CONFIG_NXFONT_SERIF38X48 is not set -# CONFIG_NXFONT_SERIF22X28B is not set -# CONFIG_NXFONT_SERIF27X38B is not set -# CONFIG_NXFONT_SERIF38X49B is not set -# CONFIG_NXCONSOLE is not set - -# -# NX Multi-user only options -# -# CONFIG_NX_MULTIUSER is not set +# CONFIG_NX is not set # # Memory Management diff --git a/nuttx/configs/sama5d3x-ek/src/sam_ov2640.c b/nuttx/configs/sama5d3x-ek/src/sam_ov2640.c index 579a6a9e2..8d7b70bcc 100644 --- a/nuttx/configs/sama5d3x-ek/src/sam_ov2640.c +++ b/nuttx/configs/sama5d3x-ek/src/sam_ov2640.c @@ -51,6 +51,9 @@ #include "sam_periphclks.h" #include "sam_lcd.h" #include "sam_pck.h" +#include "sam_pio.h" +#include "chip/sam_pinmap.h" + #include "sama5d3x-ek.h" #ifdef HAVE_CAMERA @@ -58,7 +61,9 @@ /**************************************************************************** * Definitions ****************************************************************************/ -/* Configuration ************************************************************/ +/* Typical OV2640 XVCLK is 24MHz */ + +#define OV2640_FREQUENCY 24000000 /**************************************************************************** * Private Data @@ -97,11 +102,57 @@ static inline FAR struct fb_vtable_s *ov2640_lcd_initialize(void) /**************************************************************************** * Name: ov2640_camera_initialize + * + * Description: + * Initialize the OV2640 camera in the correct mode of operation + * + * OV2640 Camera Interface + * + * SAMA5D3x PIN SAMA5D3x-EK OV2640 + * PIO PER SIGNAL ISI Socket J11 + * ---- --- ------------- --- ------------ ---------------------------------------- + * --- 1 VDDISI --- + * --- 2 GND --- + * --- 3 VDDISI --- + * --- 4 GND --- + * PE28 ? ? 5 ZB_SLPTR ??? + * PE29 ? ? 6 ZB_RST C6 RESETB Reset mode (?) + * PC27 B TWI1_CK 7 TWCK1 C2 SIO_C SCCB serial interface clock input + * PC26 B TWI1_D 8 TWD1 C1 SIO_D SCCB serial interface data I/O + * --- 9 GND --- + * PD31 B PCK1 (ISI_MCK) 10 ISI_MCK C4 XVCLK System clock input (?) + * --- 11 GND --- + * PA30 C ISI_VSYNC 12 ISI_VSYNC D2 VSYNC Vertical synchronization + * --- 13 GND --- + * PA31 C ISI_HSYNC 14 ISI_HSYNC C3 HREF Horizontal reference output (?) + * --- 15 GND --- + * PC30 C ISI_PCK 16 ISI_PCK E3 PCLK Pixel clock output + * --- 17 GND --- + * PA16 C ISI_D0 18 ISI_D0 E2 Y0 Video port output bit[0] + * PA17 C ISI_D1 19 ISI_D1 E1 Y1 Video port output bit[1] + * PA18 C ISI_D2 20 ISI_D2 F3 Y2 Video port output bit[2] + * PA19 C ISI_D3 21 ISI_D3 G3 Y3 Video port output bit[3] + * PA20 C ISI_D4 22 ISI_D4 F4 Y4 Video port output bit[4] + * PA21 C ISI_D5 23 ISI_D5 G4 Y5 Video port output bit[5] + * PA22 C ISI_D6 24 ISI_D6 E5 Y6 Video port output bit[6] + * PA23 C ISI_D7 25 ISI_D7 G5 Y7 Video port output bit[7] + * PC29 C ISI_D8 26 ISI_D8 F5 Y8 Video port output bit[8] + * PC28 C ISI_D9 27 ISI_D9 G6 Y9 Video port output bit[9] + * PC27 C ISI_D10 28 ISI_D10 --- + * PC26 C ISI_D11 29 ISI_D11 --- + * --- 30 GND --- + * + * ??? ?? A2 EXPST_B Snapshot exposure start trigger + * ??? ?? A6 STROBE Flash control output + * ??? ?? B2 FREX Snapshot trigger + * ??? ?? B6 PWDN Power-down mode enable + * ****************************************************************************/ static inline int ov2640_camera_initialize(void) { FAR struct i2c_dev_s *i2c; + uint32_t actual; int ret; /* Get the I2C driver that interfaces with the camers (OV2640_BUS)*/ @@ -109,7 +160,7 @@ static inline int ov2640_camera_initialize(void) i2c = up_i2cinitialize(OV2640_BUS); if (!i2c) { - fdbg("ERROR: Failed to initialize TWI%d\n", OV2640_BUS); + gdbg("ERROR: Failed to initialize TWI%d\n", OV2640_BUS); return EXIT_FAILURE; } @@ -117,6 +168,39 @@ static inline int ov2640_camera_initialize(void) sam_isi_enableclk(); + /* Configure OV2640 pins + * + * ISI: + * - HSYNC, VSYNC, PCK + * - 8 data bits for 8-bit color + * PCK + * - PCK1 provides OV2640 system clock + */ + + sam_configpio(PIO_ISI_HSYNC); + sam_configpio(PIO_ISI_VSYNC); + sam_configpio(PIO_ISI_PCK); + + sam_configpio(PIO_ISI_D0); + sam_configpio(PIO_ISI_D1); + sam_configpio(PIO_ISI_D2); + sam_configpio(PIO_ISI_D3); + sam_configpio(PIO_ISI_D4); + sam_configpio(PIO_ISI_D5); + sam_configpio(PIO_ISI_D6); + sam_configpio(PIO_ISI_D7); + + sam_configpio(PIO_PMC_PCK1); + + /* Configure and enable the PCK1 output */ + + actual = sam_pck_configure(PCK1, OV2640_FREQUENCY); + gvdbg("Desired PCK1 frequency: %ld Actual: %ld\n", + (long)OV2640_FREQUENCY, (long)actual); + + sam_pck_enable(PCK1, true); + + /* Configure the ISI peripheral */ #warning Missing Logic /* Initialize the OV2640 camera */ @@ -124,7 +208,7 @@ static inline int ov2640_camera_initialize(void) ret = ov2640_initialize(i2c); if (ret < 0) { - fdbg("ERROR: Failed to initialize the OV2640: %d\n", ret); + gdbg("ERROR: Failed to initialize the OV2640: %d\n", ret); return EXIT_FAILURE; } |