Camera

erhardd
Posts: 17
Joined: Mon Dec 05, 2016 9:16 am

Re: Camera

Postby erhardd » Sun Jan 08, 2017 10:44 am

I want to be as closed as possible to Krzysztofs
great
https://github.com/krzychb/esp32-cam-demo#connect ;
Only want to port the idf-project to Arduino-IDE without freeRTOS.
The famous DMA-transfer is good to look at for further use.
I think i would do the reading out of the GRAM-Display with this.
With a function "snapshoot" (triggered by touch) that contents will be saved at an SD-card.
At the moment i struggle with one line in the code:

timer_conf.bit_num = 3;

in function:
static void enable_out_clock();

I've to learn more about PERIPH_LEDC_MODULE..

:lol:

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: Camera

Postby rudi ;-) » Sun Jan 08, 2017 12:57 pm

erhardd wrote:
At the moment i struggle with one line in the code:

timer_conf.bit_num = 3;
short and dirty:

"handmade" 3_BIT LEDC PWM depth ( LEDC channel duty depth ) or bug.
:mrgreen:

struggle result long version:

Code: Select all

..
ledc_timer_config_t timer_conf;
    timer_conf.bit_num = 3;
..

timer_conf.bit_num
https://github.com/espressif/esp-idf/bl ... edc.h#L102

Code: Select all


typedef struct {
    ledc_mode_t speed_mode;         /*!< LEDC speed speed_mode, high-speed mode or low-speed mode*/
    ledc_timer_bit_t bit_num;       /*!< LEDC channel duty depth*/
    ledc_timer_t  timer_num;        /*!< The timer source of channel (0 - 3)*/
    uint32_t freq_hz;               /*!< LEDC timer frequency(Hz)*/
} ledc_timer_config_t;



ledc_timer_bit_t
https://github.com/espressif/esp-idf/bl ... ledc.h#L71

Code: Select all


typedef enum {
    LEDC_TIMER_10_BIT = 10, /*!< LEDC PWM depth 10Bit */
    LEDC_TIMER_11_BIT = 11, /*!< LEDC PWM depth 11Bit */
    LEDC_TIMER_12_BIT = 12, /*!< LEDC PWM depth 12Bit */
    LEDC_TIMER_13_BIT = 13, /*!< LEDC PWM depth 13Bit */
    LEDC_TIMER_14_BIT = 14, /*!< LEDC PWM depth 14Bit */
    LEDC_TIMER_15_BIT = 15, /*!< LEDC PWM depth 15Bit */
} ledc_timer_bit_t;


btw:
OV7670 was init, but wait endless for VSYNC ( missing clock? -> Rigol next step )
Not sure where the mistake is, i will search further.

must to do ( i play with wRover Kit V2 )
to do with OV7670 ( without FIFO Version ) to get I2C Addr Probe ( 0x21 ) :

- Pullup SCL 10KOhm ( enough )
- CAM RST to 3.3
- PWRDWN bridge Resistor to GND

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

erhardd
Posts: 17
Joined: Mon Dec 05, 2016 9:16 am

Re: Camera

Postby erhardd » Sun Jan 08, 2017 3:26 pm

This was the right hint.
I've changed it to :
timer_conf.bit_num = LEDC_TIMER_13_BIT;
and it compiled.
13-bit deep timer, i don't know, but seems to be right?

btw.:
The 8-bit Bus for the Display-Output Pins
-->d0 to d7
13,12,14,27,26,25,3,4
Don't use Pins 32 to 39.
These pins are the same for input-camera.
Only the direction has to change..
While the camera do the input the data will be written in GRAM(LCD).
Therefore befor the loop the
ucg.setPrintPos(0,0);
UCG_C10(0x0022) ; // LCD_WriteIndex(0x0022)
will perform that;

In the loop(Prgr.6) only the cam_out();
I use this camera(without reset and powerdown)


Image

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: Camera

Postby rudi ;-) » Sun Jan 08, 2017 4:48 pm

erhardd wrote:This was the right hint.
I've changed it to :
timer_conf.bit_num = LEDC_TIMER_13_BIT;
and it compiled.
13-bit deep timer, i don't know, but seems to be right?
timer_conf.bit_num = LEDC_TIMER_13_BIT;
failed bit depth
rudi monitoring wrote: ..
D (475) camera: Enabling XCLK output
E (475) ledc: requested frequency and bit depth can not be achieved, try reducing freq_hz or bit_num. div_param=0
E (485) camera: ledc_timer_config failed, rc=ffffffff
I (485) ledc: LEDC_PWM CHANNEL 0|GPIO 21|Duty 0004|Time 0
..
look at: or bit_num. div_param=0
LEDC_TIMER_0_BIT

:lol:

best wishes
rudi ;-)


edit:
(OV7670) btw:
rudi monitoring OV7670 wrote:
ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x1e (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x1e (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3ffc0008,len:4
load:0x3ffc000c,len:1960
load:0x40078000,len:3724
load:0x40080000,len:260
entry 0x40080034
I (416) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (416) heap_alloc_caps: At 3FFB1C80 len 0002E380 (184 KiB): DRAM
I (418) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (427) heap_alloc_caps: At 4008F9BC len 00010644 (65 KiB): IRAM
I (436) cpu_start: Pro cpu up.
I (440) cpu_start: Single core mode
I (445) cpu_start: Pro cpu start user code
D (474) intr_alloc: Connected src 56 to int 2 (cpu 0)
I (477) cpu_start: Starting scheduler on PRO CPU.
D (482) camera: Enabling XCLK output
I (482) ledc: LEDC_PWM CHANNEL 0|GPIO 21|Duty 0004|Time 0
D (482) camera: Initializing SSCB
I (482) gpio: GPIO[26]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (492) gpio: GPIO[27]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (502) gpio: GPIO[26]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (512) gpio: GPIO[27]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
D (522) camera: Resetting camera
D (532) camera: Searching for camera address
..................................
D (532) camera: Detected camera at address=0x21
D (532) camera: Camera PID=0x76 VER=0x73 MIDL=0x7f MIDH=0xa2

D (542) camera: Doing SW reset of sensor
D (592) camera: Setting frame size
set_framesize: h=320 v=240
D (622) camera: Allocating frame buffer (320x240, 76800 bytes)
D (622) camera: Initializing I2S and DMA
I (622) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (622) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (632) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (642) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (652) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (652) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (662) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (672) gpio: GPIO[4]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (682) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (692) gpio: GPIO[23]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (702) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
D (702) camera: Allocating DMA buffer #0, size=1280
D (712) camera: Allocating DMA buffer #1, size=1280
D (712) camera: Init done
D (722) camera: Waiting for VSYNC
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

erhardd
Posts: 17
Joined: Mon Dec 05, 2016 9:16 am

Re: Camera

Postby erhardd » Sun Jan 08, 2017 8:10 pm

You can take GPIO32..39 as Input. That's right!
But I need an 8-bit Output for the ILI9325 (ucg-lib) and the pseudo-Input for CAM at the same pins..
p.s.:
Have you found the missing Vsync ?
Use you the VSPI for your ILI9341?
At Prgr.3 I display the contents of the SD-card(not included-->see http://esp32.com/viewtopic.php?f=19&t=702).
It is slow in VSPI (but right for slideshow)..

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: Camera

Postby rudi ;-) » Sun Jan 08, 2017 8:44 pm

erhardd wrote: You can take GPIO32..39 as Input. That's right!
But I need an 8-bit Output for the ILI9325 (ucg-lib) and the pseudo-Input for CAM at the same pins..
p.s.:
Have you found the missing Vsync ?
Use you the VSPI for your ILI9341?
At Prgr.3 I display the contents of the SD-card(not included-->see http://esp32.com/viewtopic.php?f=19&t=702).
It is slow in VSPI (but right for slideshow)..
i build with DevKitC/Nano32 again and the OV7670, prinzipal works now.
must study the shematic from wRover kit V2,
there was a change on few pins,
one thing ,more, the QV7670 need pullups on SCL and RST must be pulled up ( 3.3 ) , the PWRDWN must pulled down ( GND ).
then OV7670 is talking SCCB, this result comes from "long night" testing,
for flashing with OV7670, break short RST from 3.3

http://esp32.com/viewtopic.php?f=12&t=344
compare.png
compare.png (77.16 KiB) Viewed 16901 times
btw the lcd D/C is same like Xclk.


best wishes
rudi ;-)

( from SPI Flash )
"animated help service with audio" 8-)
on right side comes a live vid frame later.
- NoArduinoCode - its bareCode -
FastPic.jpg
FastPic.jpg (152.05 KiB) Viewed 16901 times
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: Camera

Postby rudi ;-) » Mon Jan 09, 2017 9:32 am

erhardd wrote:
With a function "snapshoot" (triggered by touch) that contents will be saved at an SD-card.
have you tried this?
https://github.com/espressif/esp-idf/tr ... 27_sd_card

(parts)
https://github.com/espressif/esp-idf/bl ... mmc_host.c
https://github.com/espressif/esp-idf/bl ... _private.h
https://github.com/espressif/esp-idf/bl ... nsaction.c

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

erhardd
Posts: 17
Joined: Mon Dec 05, 2016 9:16 am

Re: Camera

Postby erhardd » Mon Jan 09, 2017 11:01 am

Thanks for your hints!
At this point i decide to roll-back my Arduino-IDE.
Unexpectedly where everywhere Arduino15 folder are filed under Windows.
If there were no hardware i need like PC-Scope/Generator(Vellemann) and anymore I would prefer a Linux-Distri.

HLK+++
Posts: 1
Joined: Fri Oct 21, 2016 10:26 am

Re: Camera

Postby HLK+++ » Fri Jan 13, 2017 12:23 am

HI @ all,
I did a port of the Arducam Mini 2MP OV2640 Arduino. Maybe that easy example some are looking for.
https://github.com/H-LK/ESP32_Arducam_Port

Anyway a direct access to the OV2640 would be awesome. Any progress yet?

BORISBRITWA
Posts: 9
Joined: Thu May 03, 2018 10:43 am

Re: Camera

Postby BORISBRITWA » Sat Jun 16, 2018 6:53 am

THIS IS MY RESULTS https://youtu.be/EdIFQ_LUx3Y

Who is online

Users browsing this forum: No registered users and 80 guests