This is an old revision of the document!


see also multicam for raspberry/arducam more demanding tasks.

at their core this modules uses external RAM (psram to buffer an ov2640 camera module that does jpeg at 10fps on-board. the external ram is not strictly necessary, but going fwd its the right way to go, beware of modules without one

note: current M5Stack modules DO NOT come with the PSRAM chip and are limited in performance and by heat issues.
while the M5Stack doesnt have the #PSRAM, out of the box it outputs a working image stream. unlike the ESP32-CAM

modules tested
ESP32-CAM - glitching ATM the best ever!
TTGO T-Journal - comes with arduino support, works out of the box
M5Stack - works out of box, lacks PSRAM

untested
ESP32-wrover-kit
ESP32-WROVER-B
TTGO T8

AI-thinker has released a QR-code reading example.

<html> <ul><li>Wireless Module- ESP32-S WiFi 802.11 b/g/n + Bluetooth 4.2 LE module with PCB antenna, u.FL connector, 32Mbit SPI flash, 4MBit PSRAM</li> <li>External Storage – micro SD card slot <strong>up to 4GB</strong></li> <li>Camera <ul><li>FPC connector</li> <li>Support for OV2640 (sold with board) or OV7670 cameras</li> <li>Image Format – JPEG(&nbsp;OV2640 support only ), BMP, grayscale</li> <li>LED flash light</li> </ul></li> <li>Expansion – 16x through-holes with UART, SPI, I2C, PWM</li> <li>Misc – Reset button</li> <li>Power Supply – 5V via pin header</li> <li>Power Consumption <ul><li>Flash LED off – 180mA @ 5V</li> <li>Flash LED on to maximum brightness- 310mA @ 5V</li> <li>Deep-sleep – 6mA @ 5V min.</li> <li>Modem-sleep – 20mA @ 5V min.</li> <li>Light-sleep – 6.7mA @ 5V min.</li> </ul></li> <li>Dimensions – 40.5 x 27 x 4.5 mm</li> <li>Weight- 10 grams</li> <li>Temperature Range – Operating: -20 ℃ ~ 85 ℃; storage: -40 ℃ ~ 90 ℃ @ &lt;&nbsp;90%RH</li> </ul> </html>

spec gathered and formatted by cnx-software, check his feed for the latest in embedded open designs interesting, might be a seeedstudio design, but abandoned (cache).

gettting it going

#install esp-idf on system
https://docs.espressif.com/projects/esp-idf/en/latest/get-started/#get-esp-idf

#get esp-who repo, it will also pull submodule esp32-camera component
git clone --recursive https://github.com/espressif/esp-who.git
#if you didnt pull the submodules run  $ git submodule update --init 
cd esp/esp-who/examples/single_chip/camera_web_server/


# change camera module to ai-thinker in sdkconfig
# Camera Pins
#
CONFIG_CAMERA_MODEL_WROVER_KIT=
CONFIG_CAMERA_MODEL_M5STACK_PSRAM=
CONFIG_CAMERA_MODEL_AI_THINKER=y
CONFIG_CAMERA_MODEL_CUSTOM=
CONFIG_ESP_FACE_DETECT_ENABLED=y
CONFIG_ESP_FACE_RECOGNITION_ENABLED=y
make menuconfig
make flash

M5Stack host it's product page on github and on their site.

M5Stack warn not to use the cam module for extended time as “it might over heat"!
also as this github issues #1,#2 mention it does not come with the PSRAM extra memory so it cannot run some demos and is generally slower. as the answer is

If you have the non-psram model, then the max you can stream is 800×600, 1 frame buffer and quality around 10 or more.
With PSRAM you can do full res, full quality and 2 or more frame buffers.

note: they recently forked a github with psram support so expect it to be available sometime soon.

<html> <ul> <li>ESP32 specifications<ul> <li>Dual-core Tensilica LX6 microprocessor</li> <li>Up to 240MHz clock frequency</li> <li>512K internal SRAM</li> <li>4MB Flash memory</li> <li>Integrated 802.11 BGN WiFi transceiver</li> <li>Integrated dual-mode Bluetooth (classic and BLE)</li> <li>Hardware accelerated encryption (AES, SHA2, ECC, RSA-4096)</li> </ul> </li> <li>CP2104 USB TTL</li> <li>OV2640 sensor<ul> <li>Output Formats(8-bit):<ul> <li>YUV(422/420)/YCbCr422</li> <li>RGB565/555</li> <li>8-bit compressed data</li> <li>8-/10-bit Raw RGB data</li> </ul> </li> <li>Maximum Image Transfer Rate<ul> <li>UXGA/SXGA: 15fps</li> <li>SVGA: 30fps</li> <li>CIF: 60fps</li> </ul> </li> <li>Scan Mode: Progressive</li> </ul> </li> <li>Camera specifications<ul> <li>CCD size : 1/4inch</li> <li>Field of View : 78 degree</li> <li>Maxmium Pixel: 200W</li> </ul> </li> <li>Sensor best resolution: 1600 * 1200</li> <li>Dimension: 25mm x 24mm</li> <li>Weight: 5g</li> </ul> </html>


notable addons

demo code: github - this actually worked
Has the MPU6050 & bme280 pads on the board, can do DIY solder easily.
3. Has IP5306, can connect with lithium battery

make defconfig
make flash
I (309) boot: Loaded app from partition at offset 0x10000
I (309) boot: Disabling RNG early entropy source...
E (312) spiram: Expected 4096KiB chip but found 8192KiB chip. Bailing out..
E (319) cpu_start: Failed to init external RAM!

  • Chipset ESPRESSIF-ESP32-PCIO-D4 240MHz Xtensa® single-/dual-core 32-bit LX6 microprocessor
  • FLASH QSPI flash/SRAM, up to 4 x 16 MB
  • SRAM 520 kB SRAM
  • dispaly 0.91 SSD1306
  • USB to TTL CP2104
  • Camera OV2640 2Megapixel
  • Steering engine analog servo (PWM?)
  • working voltage 2.3V-3.6V
  • working current about 160mA
  • size 64.57mm*23.98mm
  • Power Supply USB 5V/1A
  • charging current 1A - battery 3.7V lithium battery

store
github

getting image

the TTGO T-Journal comes with arduino support github repo

configure arduino with esp32 support
using the board type ESP32 Dev Module

unzip Downloads/esp8266-oled-ssd1306-master.zip -d ~/Arduino/libraries/
cd ~/Arduino/libraries/
git clone https://github.com/LilyGO/ESP32-Camera
#(re)open arduino 
File>Examples>Examples from customs libraries>ESP32 camear>ESP32_Station_Cam.ino

the TTGO is the best one.
comes pre-flashed out of the box and was able to reflash with their example.
missing are schematics.

click image for the mjpeg_stream output

do not use for for new designs (see comment on wrover-b bellow) video released by espressif shows pattern detection capabilities.github
it uses the esp-wrover-kit

  • Dual core 240 MHz CPU;
  • with 4 MB SPI PSRAM (Pseudo static RAM);
  • Built-in USB-JTAG Debugger;
  • 3.2” SPI LCD panel;
  • Micro-SD card interface
  • VGA camera interface
  • I/O expansion
  • DOOM enabled (jpg)
  • getting started guide by io-bits

the ESP32-WROVER-B Module has the 8MB PSRAM but lacks some peripherals.
note the diff between qrover and wrover-b, which has the extra 8MB. better not use less then 4MB.

the T8 has the PSRAM with all the peripherals but the camera connector. store

the PSRAM is “a cheaper cost­-per-­bit cache and buffered memory solution” (link)

from ESP-PSRAM64 datasheet

“the ESP32 SDK at the moment only supports the ESP-PSRAM32 chip.” (doc), post#1.post#2

note: current M5Stack modules DO NOT come with the PSRAM chip and are limited in performance and by heat issues. TBD check your board

OV2640 datasheet

an earlier source code shows how to stream MJPEG to a browser. in video is an example of that with a few ov modules with ribbon connectors

here is a reddit comment about working with the ov2640 and the arduino platform

relate to all the above.

ESP32-CAM

  • SDcard storage

M5Satck

with help of me-no-dev i got the esp32-cam working!, below is just all i tried before this nudge i got.


TLDR: this module comes with a bootloader, but no app. and flashing one didn't get me the results i can work with ATM.

esp32-cam delivery via coolcomponents (3dayups), started by powering it with ftdi breakout (3v/5v) switch.
but it couldn't get over the startup peaks (after it stabilize on ~160mA).

using cam-qr code arch and esf-idf are in package war. went with esp32env docker

PRO TIP - You can change the baud rate and other properties with make menuconfig which will drop you in esp-idf's project configuration menu.
I recommend selecting a baud rate of 921600 as it will reduce flashing times to around 4-5 seconds.

espfuse looks cute to probe > https://esp32.com/viewtopic.php?t=6743

Click to display ⇲

Click to hide ⇱

systemctl start docker
sudo systemctl start docker
echo N | sudo tee /sys/module/overlay/parameters/metacopy
#forking my own as original had several issues
git clone git@github.com:idiot-io/esp32env.git
cd esp32env
make 
make install
sudo cp esp32env /usr/local/bin
sudo chmod a+x /usr/local/bin/esp32env

git clone https://github.com/donny681/ESP32_CAMERA_QR
cd ESP32_CAMERA_QR
esp32env make menuconfig  # Instead of the traditional `make menuconfig`
esp32env make flash  # Instead of `make flash`
esp32env make monitor # serial comm built in esp-idf, cute see https://docs.espressif.com/projects/esp-idf/en/latest/get-started/#monitor

it's still not there, had to fix kernel line and massage the dockerfile.

Click to display ⇲

Click to hide ⇱

esptool.py v2.6-beta1
Flashing binaries to serial port /dev/tty.SLAB_USBtoUART (app at offset 0x10000 )...
esptool.py v2.6-beta1
Serial port /dev/tty.SLAB_USBtoUART
Traceback (most recent call last):
  File "/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 2865, in <module>
    _main()
  File "/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 2858, in _main
    main()
  File "/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 2565, in main
    esp = chip_class(each_port, initial_baud, args.trace)
  File "/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 213, in __init__
    self._port = serial.serial_for_url(port)
  File "/usr/lib/python2.7/dist-packages/serial/__init__.py", line 85, in serial_for_url
    instance.open()
  File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 294, in open
    raise SerialException(msg.errno, "could not open port %s: %s" % (self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/tty.SLAB_USBtoUART: [Errno 2] No such file or directory: '/dev/tty.SLAB_USBtoUART'
/esp/esp-idf/components/esptool_py/Makefile.projbuild:62: recipe for target 'flash' failed

solved by this comment

then

Click to display ⇲

Click to hide ⇱

esptool.py v2.6-beta1
Flashing binaries to serial port /dev/ttyUSB0 (app at offset 0x10000 )...
esptool.py v2.6-beta1
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet content
/esp/esp-idf/components/esptool_py/Makefile.projbuild:62: recipe for target 'flash' failed
make: *** [flash] Error 2

short GP0&GP2 to ground and disconnect camera
dont forget you have to reset the esp32 (btn) when you want to flash

then disconnect GP0 and GP2 , reconnect camera, boot and…
YAY!

but…

to get the serial data run (monitor)

esp32env make monitor

on first boot i get the following log

Click to display ⇲

Click to hide ⇱

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5868
load:0x40078000,len:9176
load:0x40080000,len:6064
entry 0x40080330
I (28) boot: ESP-IDF v3.1.1 2nd stage bootloader
I (28) boot: compile time 14:22:34
I (28) boot: Enabling RNG early entropy source...
0;32mI (33) boot: SPI Speed      : 40MHz
I (37) boot: SPI Mode       : DIO
I (41) boot: SPI Flash Size : 4MB
I (45) boot: Partition Table:
I (48) boot: ## Label            Usage          Type ST Offset   Length
I (56) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (63) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (71) boot:  2 factory          factory app      000 00010000 00100000
I (78) boot: End of partition table
I (82) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x16240 ( 90688) map
[0;32mI (123) esp_image: segment 1: paddr=0x00026268 vaddr=0x3ffb0000 size=0x034d0 ( 13520) load
I (128) esp_image: segment 2: paddr=0x00029740 vaddr=0x3ffb34d0 size=0x00000 (     0) load
I (130) esp_image: segment 3: paddr=0x00029748 vaddr=0x40080000 size=0x00400 (  1024) load
I (139) esp_image: segment 4: paddr=0x00029b50 vaddr=0x40080400 size=0x064c0 ( 25792) load
I (158) esp_image: segment 5: paddr=0x00030018 vaddr=0x400d0018 size=0x6e4b8 451768) map
I (317) esp_image: segment 6: paddr=0x0009e4d8 vaddr=0x400868c0 size=0x0ab48 ( 43848) load
I (335) esp_image: segment 7: paddr=0x000a9028 vaddr=0x400c0000 size=0x00000 (     0) load
I (336) esp_image: segment 8: paddr=0x000a9030 vaddr=0x50000000 size=0x00000 (     0) load
I (352) boot: Loaded app from partition at offset 0x10000
I (352) boot: Disabling RNG early entropy source...
I (354) cpu_start: Pro cpu up.
I (357) cpu_start: Starting app cpu, entry point is 0x40081034
I (0) cpu_start: App cpu up.
I (368) heap_init: Initializing. RAM available for dynamic allocation:
I (375) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (381) heap_init: At 3FFB9500 len 00026B00 (154 KiB): DRAM
I (387) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (393) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (400) hea_init: At 40091408 len 0000EBF8 (58 KiB): IRAM
I (406) cpu_start: Pro cpu start user code
I (200) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
[0;32mI (246) I2S: DMA Malloc info, datalen=blocksize=256, dma_buf_count=8
I (246) I2S: PLL_D2: Req RATE: 78125, real rate: 78125.000, BITS: 16, CLKM: 8, BCK: 8, MCLK: 20000000.000, SCLK: 2500000.000000, diva: 64, divb: 0
I (256) camera_xclk: PIN_CTRL before:3ff
I (266) camera_xclk: PIN_CTRL after:7fff
[0;32mI (4326) camera_demo: Detected OV2640 camera, using JPEG format
[0;32mI (4546) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (4546) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
[0;32mI (4636) phy: phy_version: 400, b6198fa, Sep  3 2018, 15:11:06, 0, 0
I (4636) camera_demo: Connecting to "tomato-2.4GHz"
[0;32mI (6546) event: sta ip: 192.168.0.93, mask: 2.255.255.0, gw: 192.168.0.1
I (6546) camera_demo: Connected
I (6546) camera_demo: Open http://192.168.0.93/jpg for single image/jpg image
I (6556) camera_demo: Open http://192.168.0.93/jpg_stream for multipart/x-mixed-replace stream of JPEGs
I (6566) camera_demo: Free heap: 188012
I (6566) camera_demo: Camera demo ready
I (28746) camera: Frame 0 done in 158 ms
[0;32mI (28906) camera: Frame 1 done in 155 ms
I (29066) camera: Frame 2 done in 156 ms

trying to run esptool (the flasher) without building to faster debug, bin is here /esp/project/build/esp32-cam-demo.bin
to build the app only, without the bootloader you can run (see docs)

esp32env make app-flash

first image from the moon…

this datamush was also apprant in the ENABLE_TEST_PATTERN

phase2

now the image i got is pretty bad.
im now learning the config system for make and specificly kconfig

esp32env vi /esp/project/sdkconfig

i later used the recommended

esp32env make makeconfig 

for an ncurses text editor. upped the logging to debug instead of the default info and enabled esp32-cam> test pattern

I (208210) camera: Frame 262 done in 138 ms
D (211100) camera: Waiting for positive edge on VSYNC
D (211170) camera: Got VSYNC
D (211170) camera: Waiting for frame

but hey, thats not the test pattern i was looking for

config ENABLE_TEST_PATTERN
	bool "Enable test pattern on camera output"
	default n
	help
		Configure the camera module to output test pattern instead of live image.
		
		Use this option to troubleshoot image issues like noise,
		distortion, not legible and missing live image.
		Instead, module will generate regular vertical bars 
		in shades from dark to white.

Click to display ⇲

Click to hide ⇱

I (4720) phy: phy_version: 4000, b6198fa, Sep  3 2018, 15:11:06, 0, 0
D (4720) event: SYSTEM_EVENT_STA_START
I (4720) camera_demo: Connecting to "tomato-2.4GHz"
D (5550) nvs: nvs_set sta.chan 1 1
D (5550) nvs: nvs_set_blob sta.apinfo 700
D (5550) event: SYSTEM_EVENT_STA_CONNECTED, ssid:tomato-2.4GHz, ssid_len:13, bssid:80:26:89:0d:55:04, channel:1, authmode:3
D (5550) tcpip_adapter: dhcp client init ip/mask/gw to all-0
D (5560) tcpip_adapter: if0 start ip lost tmr: enter
D (5560) tcpip_adapter: if0 start ip lost tmr: no need start because netif=0x3ffcffa0 interval=120 ip=0
D (5570) tcpip_adapter: dhcp client start successfully
D (6970) tcpip_adapter: if0 dhcpc cb
D (6970) tcpip_adapter: if0 ip changed=1
D (6970) event: SYSTEM_EVENT_STA_GOT_IP, ip:192.168.0.89, mask:255.255.255.0, gw:192.168.0.1
I (6970) event: sta ip: 192.168.0.89, mask: 255.255.255.0, gw: 192.168.0.1
I (6980) camera_demo: Connected
I (6980) camera_demo: Open http://192.168.0.89/jpg for single image/jpg image
I (6990) camera_demo: Open http://192.168.0.89/jpg_stream for multipart/x-mixed-replace stream of JPEGs
I (7000) camera_demo: Free heap: 188320
I (7000) camera_demo: Camera demo ready
D (24580) http_server: Got URI: '/jpg_stream'
D (24580) http_server: Got header: 'Host': '192.168.0.89'
D (24580) http_server: Got header: 'Connection': 'keep-alive'
D (24580) http_server: Got header: 'Upgrade-Insecure-Requests': '1'
D (24590) http_server: Got header: 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36'
D (24600) http_server: Got header: 'DNT': '1'
D (24610) http_server: Got header: 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8'
D (24620) http_server: Got header: 'Accept-Encoding': 'gzip, deflate'
D (24630) http_server: Got header: 'Accept-Language': 'en-US,en;q=0.9,he;q=0.8,und;q=0.7'
D (29630) camera: Waiting for positive edge on VSYNC
D (29650) camera: Got VSYNC
D (29650) camera: Waiting for frame
I (29730) camera: Frame 0 done in 108 ms
D (29740) camera: Waiting for positive edge on VSYNC
D (29810) camera: Got VSYNC
D (29810) camera: Waiting for frame
I (29890) camera: Frame 1 done in 155 ms
D (29900) camera: Waiting for positive edge on VSYN

digging some dirt on the esp32 floating point performance, source

phase 3

micropython?

micropython on esp32 guide

sudo pip3 install esptool adafruit-ampy
esptool.py --chip esp32 -p /dev/ttyUSB0 --baud 921600 write_flash \
-z 0x1000 esp32-20181215-v1.9.4-757-g39eef2708.bin 
ampy /dev/ttyUSB0 ls
picocom /dev/ttyUSB0 -b 115200

if you get wired curropt messages

#Try resetting the filesystem using:
import uos
import flashbdev
uos.VfsFat.mkfs(flashbdev.bdev)

but why bother, no i2s support yet in micropython

phase 4

so.. i gave up on the ESP32_CAMERA_QR github and went looking for another code
found a another projects fork that actually outputs an image
tmrttmrt/esp32-cam-demo.
but super slowly (1600×1200)…

revisiting ESP32_CAM_QR i went ahead and in sdkconfig enabled

CONFIG_SPIRAM_SUPPORT=y

running now

esp32env make app-flash

opened a few more options related to SPRAM

Click to display ⇲

Click to hide ⇱

* SPI RAM config
*
Initialize SPI RAM when booting the ESP32 (SPIRAM_BOOT_INIT) [Y/n/?] (NEW) 
  Ignore PSRAM when not found (SPIRAM_IGNORE_NOTFOUND) [N/y/?] (NEW) 
SPI RAM access method
  1. Integrate RAM into ESP32 memory map (SPIRAM_USE_MEMMAP) (NEW)
  2. Make RAM allocatable using heap_caps_malloc(..., MALLOC_CAP_SPIRAM) (SPIRAM_USE_CAPS_ALLOC) (NEW)
> 3. Make RAM allocatable using malloc() as well (SPIRAM_USE_MALLOC) (NEW)
choice[1-3?]: 
Type of SPI RAM chip in use
> 1. ESP-PSRAM32 or IS25WP032 (SPIRAM_TYPE_ESPPSRAM32) (NEW)
choice[1]: 1
Set RAM clock speed
> 1. 40MHz clock speed (SPIRAM_SPEED_40M) (NEW)
choice[1]: 1
Run memory test on SPI RAM initialization (SPIRAM_MEMTEST) [Y/n/?] (NEW) 
Enable workaround for bug in SPI RAM cache for Rev1 ESP32s (SPIRAM_CACHE_WORKAROUND) [Y/n/?] (NEW) 
Maximum malloc() size, in bytes, to always put in internal memory (SPIRAM_MALLOC_ALWAYSINTERNAL) [16384] (NEW) 
Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, allocate internal memory (WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST) [N/y/?] (NEW) 
Reserve this amount of bytes for data that specifically needs to be in DMA or internal memory (SPIRAM_MALLOC_RESERVE_INTERNAL) [32768] (NEW) 
Allow external memory as an argument to xTaskCreateStatic (SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY) [N/y/?] (NEW) 
*
* FreeRTOS
*
Run FreeRTOS only on first core (FREERTOS_UNICORE) [N/y/?] n
Xtensa timer to use as the FreeRTOS tick source
> 1. Timer 0 (int 6, level 1) (FREERTOS_CORETIMER_0)
  2. Timer 1 (int 15, level 3) (FREERTOS_CORETIMER_1)
choice[1-2?]: 1
Tick rate (Hz) (FREERTOS_HZ) [100] 100
Halt when an SMP-untested function is called (FREERTOS_ASSERT_ON_UNTESTED_FUNCTION) [Y/n/?] y
Check for stack overflow
  1. No checking (FREERTOS_CHECK_STACKOVERFLOW_NONE)
  2. Check by stack pointer value (FREERTOS_CHECK_STACKOVERFLOW_PTRVAL)
> 3. Check using canary bytes (FREERTOS_CHECK_STACKOVERFLOW_CANARY)
choice[1-3?]: 3
Set a debug watchpoint as a stack overflow check (FREERTOS_WATCHPOINT_END_OF_STACK) [N/y/?] n
Enable backtrace from interrupt to task context (FREERTOS_INTERRUPT_BACKTRACE) [Y/n/?] y
Number of thread local storage pointers (FREERTOS_THREAD_LOCAL_STORAGE_POINTERS) [1] 1
FreeRTOS assertions
> 1. abort() on failed assertions (FREERTOS_ASSERT_FAIL_ABORT)
  2. Print and continue failed assertions (FREERTOS_ASSERT_FAIL_PRINT_CONTINUE)
  3. Disable FreeRTOS assertions (FREERTOS_ASSERT_DISABLE)
choice[1-3?]: 1
Idle Task stack size (FREERTOS_IDLE_TASK_STACKSIZE) [1024] 1024
ISR stack size (FREERTOS_ISR_STACKSIZE) [1536] 1536
Use FreeRTOS legacy hooks (FREERTOS_LEGACY_HOOKS) [N/y/?] n
Maximum task name length (FREERTOS_MAX_TASK_NAME_LEN) [16] 16
Enable FreeRTOS static allocation API (SUPPORT_STATIC_ALLOCATION) [Y/?] y
  Enable static task clean up hook (ENABLE_STATIC_TASK_CLEAN_UP_HOOK) [N/y/?] (NEW) 
FreeRTOS timer task priority (TIMER_TASK_PRIORITY) [1] 1
FreeRTOS timer task stack size (TIMER_TASK_STACK_DEPTH) [2048] 2048
FreeRTOS timer queue length (TIMER_QUEUE_LENGTH) [10] 10
FreeRTOS queue registry size (FREERTOS_QUEUE_REGISTRY_SIZE) [0] 0
Enable FreeRTOS trace facility (FREERTOS_USE_TRACE_FACILITY) [N/y/?] n
Enable FreeRTOS to collect run time stats (FREERTOS_GENERATE_RUN_TIME_STATS) [N/y/?] n
#
# configuration written to /esp/project/sdkconfig

i will copy relevant options from the tmrttmrt fork mentioned above, as best i can

-CONFIG_SPIRAM_SUPPORT=
+CONFIG_SPIRAM_SUPPORT=y
+
+#
+# SPI RAM config
+#
+CONFIG_SPIRAM_BOOT_INIT=y
+CONFIG_SPIRAM_IGNORE_NOTFOUND=
+CONFIG_SPIRAM_USE_MEMMAP=
+CONFIG_SPIRAM_USE_CAPS_ALLOC=
+CONFIG_SPIRAM_USE_MALLOC=y
+CONFIG_SPIRAM_TYPE_ESPPSRAM32=y
+CONFIG_SPIRAM_SIZE=4194304
+CONFIG_SPIRAM_SPEED_40M=y
+CONFIG_SPIRAM_MEMTEST=y
+CONFIG_SPIRAM_CACHE_WORKAROUND=y
+CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384
+CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST=
+CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
+CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=

and then start log looks like this

Click to display ⇲

Click to hide ⇱

rst:0x1 (POWERON_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5868
load:0x40078000,len:9288
load:0x40080000,len:6064
entry 0x40080330
I (28) boot: ESP-IDF v3.1.1 2nd stage bootloader
I (28) boot: compile time 20:25:53
I (28) boot: Enabling RNG early entropy source...
I (33) boot: SPI Speed      : 40MHz
I (37) boot: SPI Mode       : DIO
I (41) boot: SPI Flash Size : 4MB
I (45) boot: Partition Table:
I (48) boot: ## Label            Usage          Type ST Offset   Length
I (56) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (63) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (71) boot:  2 factory          factory app      00 00 00010000 00100000
I (78) boot: End of partition table
I (82) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x1c0c0 (114880) map
I (131) esp_image: segment 1: paddr=0x0002c0e8 vaddr=0x3ffb0000 size=0x036f8 ( 14072) load
I (137) esp_image: segment 2: paddr=0x0002f7e8 vaddr=0x3ffb36f8 size=0x00000 (     0) load
I (138) esp_image: segment 3: paddr=0x0002f7f0 vaddr=0x40080000 size=0x00400 (  1024) load
I (148) esp_image: segment 4: paddr=0x0002fbf8 vaddr=0x40080400 size=0x00418 (  1048) load
I (157) esp_image: segment 5: paddr=0x00030018 vaddr=0x400d0018 size=0x77ea8 (491176) map
I (337) esp_image: segment 6: paddr=0x000a7ec8 vaddr=0x40080818 size=0x15b30 ( 88880) load
I (374) esp_image: segment 7: paddr=0x000bda00 vaddr=0x400c0000 size=0x00000 (     0) load
I (374) esp_image: segment 8: paddr=0x000bda08 vaddr=0x50000000 size=0x00000 (     0) load
I (394) boot: Loaded app from partition at offset 0x10000
I (394) boot: Disabling RNG early entropy source...
I (396) spiram: SPI RAM mode: flash 40m sram 40m
I (400) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (407) cpu_start: Pro cpu up.
I (411) cpu_start: Starting app cpu, entry point is 0x4008136c
I (0) cpu_start: App cpu up.
I (1310) spiram: SPI SRAM memory test OK
I (1311) heap_init: Initializing. RAM available for dynamic allocation:
D (1311) heap_init: New heap initialised at 0x3ffae6e0
I (1316) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (1322) heap_init: New heap initialised at 0x3ffb97b0
I (1327) heap_init: At 3FFB97B0 len 00026850 (154 KiB): DRAM
I (1334) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (1340) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (1347) heap_init: New heap initialised at 0x40096348
I (1352) heap_init: At 40096348 len 00009CB8 (39 KiB): IRAM
I (1358) cpu_start: Pro cpu start user code
I (1363) spiram: Adding pool of 4096K of external SPI memory to heap allocator
I (1371) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
D (1387) clk: RTC_SLOW_CLK calibration value: 3185024
D (54) intr_alloc: Connected src 46 to int 2 (cpu 0)
D (55) intr_alloc: Connected src 57 to int 3 (cpu 0)
D (55) intr_alloc: Connected src 24 to int 9 (cpu 0)
I (60) cpu_start: Starting scheduler on PRO CPU.
D (0) intr_alloc: Connected src 25 to int 2 (cpu 1)
I (0) cpu_start: Starting scheduler on APP CPU.
D (75) heap_init: New heap initialised at 0x3ffe0440
D (85) heap_init: New heap initialised at 0x3ffe4350
D (95) nvs: nvs_flash_init_custom partition=nvs start=9 count=6
D (105) camera: Enabling XCLK output
D (105) intr_alloc: Connected src 33 to int 12 (cpu 0)
D (105) I2S: Addr[0] = 1073471164
D (115) I2S: Addr[1] = 1073471424
D (115) I2S: Addr[2] = 1073471684
D (115) I2S: Addr[3] = 1073471944
D (125) I2S: Addr[4] = 1073472204
D (125) I2S: Addr[5] = 1073472464
D (125) I2S: Addr[6] = 1073472724
D (135) I2S: Addr[7] = 1073472984
I (135) I2S: DMA Malloc info, datalen=blocksize=256, dma_buf_count=8
I (145) I2S: PLL_D2: Req RATE: 78125, real rate: 78125.000, BITS: 16, CLKM: 8, BCK: 8, MCLK: 20000000.000, SCLK: 2500000.000000, diva: 64, divb: 0
D (155) I2S: data: out 189, in: -1, ws: 26, bck: 24
I (165) camera_xclk: PIN_CTRL before:3ff
I (165) camera_xclk: PIN_CTRL after:7fff
D (165) camera: Initializing SSCB
D (175) camera: Resetting camera
D (4175) camera: Searching for camera address
D (4185) camera: Detected camera at address=0x30
D (4195) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
D (4195) camera: Doing SW reset of sensor
I (4235) camera_demo: Detected OV2640 camera, using JPEG format
D (4265) camera: Setting frame size to 160x120
D (4325) camera: Test pattern enabled
D (4325) camera: in_bpp: 2, fb_bpp: 2, fb_size: 3840, mode: 0, width: 160 height: 120
D (4325) camera: Allocating frame buffer (3840 bytes)
D (4325) camera: Initializing I2S and DMA
D (4335) intr_alloc: Connected src 32 to int 13 (cpu 0)
D (4335) camera: Line width (for DMA): 1280 bytes
D (4345) camera: DMA buffer size: 1280, DMA buffers per line: 1
D (4345) camera: DMA buffer count: 4
D (4355) camera: Allocating DMA buffer #0, size=1280
D (4355) camera: Allocating DMA buffer #1, size=1280
D (4365) camera: Allocating DMA buffer #2, size=1280
D (4365) camera: Allocating DMA buffer #3, size=1280
D (4375) camera: Initializing GPIO interrupts
D (4375) intr_alloc: Connected src 22 to int 17 (cpu 0)
D (4455) camera: Init done
D (4455) nvs: nvs_open_from_partition misc 1
D (4455) nvs: nvs_get_str_or_blob log
I (4455) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (4465) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
D (4475) nvs: nvs_open_from_partition nvs.net80211 1
D (4475) nvs: nvs_get opmode 1
D (4475) nvs: nvs_get_str_or_blob sta.ssid
D (4485) nvs: nvs_get_str_or_blob sta.mac
D (4485) nvs: nvs_get sta.authmode 1
D (4495) nvs: nvs_get_str_or_blob sta.pswd
D (4495) nvs: nvs_get_str_or_blob sta.pmk
D (4495) nvs: nvs_get sta.chan 1
D (4505) nvs: nvs_get auto.conn 1
D (4505) nvs: nvs_get bssid.set 1
D (4505) nvs: nvs_get_str_or_blob sta.bssid
D (4515) nvs: nvs_get sta.lis_intval 2
D (4515) nvs: nvs_get sta.phym 1
D (4525) nvs: nvs_get sta.phybw 1
D (4525) nvs: nvs_get_str_or_blob sta.apsw
D (4525) nvs: nvs_get_str_or_blob sta.apinfo
D (4535) nvs: nvs_get sta.scan_method 1
D (4535) nvs: nvs_get sta.sort_method 1
D (4545) nvs: nvs_get sta.minrssi 1
D (4545) nvs: nvs_get sta.minauth 1
D (4545) nvs: nvs_get_str_or_blob ap.ssid
D (4555) nvs: nvs_get_str_or_blob ap.mac
D (4555) nvs: nvs_get_str_or_blob ap.passwd
D (4565) nvs: nvs_get_str_or_blob ap.pmk
D (4565) nvs: nvs_get ap.chan 1
D (4565) nvs: nvs_get ap.authmode 1
D (4575) nvs: nvs_get ap.hidden 1
D (4575) nvs: nvs_get ap.max.conn 1
D (4575) nvs: nvs_get bcn.interval 2
D (4585) nvs: nvs_get ap.phym 1
D (4585) nvs: nvs_get ap.phybw 1
D (4585) nvs: nvs_get ap.sndchan 1
D (4595) nvs: nvs_get lorate 1
D (4595) nvs: nvs_set_blob sta.mac 6
D (4595) nvs: nvs_set_blob ap.mac 6
D (4605) nvs: nvs_set_blob sta.ssid 36
D (4605) nvs: nvs_set_blob sta.pswd 65
D (4615) nvs: nvs_set bssid.set 1 0
D (4615) nvs: nvs_set sta.lis_intval 2 3
D (4615) nvs: nvs_set sta.scan_method 1 0
D (4625) nvs: nvs_set sta.sort_method 1 0
D (4625) nvs: nvs_set sta.minrssi 1 -127
D (4625) nvs: nvs_set sta.minauth 1 0
D (4635) nvs: nvs_set_blob sta.apsw 2
D (4635) nvs: nvs_set_blob sta.apinfo 700
D (4645) RTC_MODULE: Wi-Fi takes adc2 lock.
D (4645) phy_init: loading PHY init data from application binary
D (4645) nvs: nvs_open_from_partition phy 0
D (4655) nvs: nvs_get cal_version 4
D (4655) nvs: nvs_get_str_or_blob cal_mac
D (4655) nvs: nvs_get_str_or_blob cal_data
D (4665) nvs: nvs_close 3
I (4745) phy: phy_version: 4000, b6198fa, Sep  3 2018, 15:11:06, 0, 0
D (4745) event: SYSTEM_EVENT_STA_START
I (4745) camera_demo: Connecting to "tomato-2.4GHz"
D (5715) nvs: nvs_set sta.chan 1 1
D (5715) nvs: nvs_set_blob sta.apinfo 700
D (5715) event: SYSTEM_EVENT_STA_CONNECTED, ssid:tomato-2.4GHz, ssid_len:13, bssid:80:26:89:0d:55:04, channel:1, authmode:3
D (5715) tcpip_adapter: dhcp client init ip/mask/gw to all-0
D (5725) tcpip_adapter: if0 start ip lost tmr: enter
D (5725) tcpip_adapter: if0 start ip lost tmr: no need start because netif=0x3ffd054c interval=120 ip=0
D (5735) tcpip_adapter: dhcp client start successfully
D (6985) tcpip_adapter: if0 dhcpc cb
D (6985) tcpip_adapter: if0 ip changed=1
D (6985) event: SYSTEM_EVENT_STA_GOT_IP, ip:192.168.0.89, mask:255.255.255.0, gw:192.168.0.1
I (6985) event: sta ip: 192.168.0.89, mask: 255.255.255.0, gw: 192.168.0.1
I (6995) camera_demo: Connected
I (6995) camera_demo: Open http://192.168.0.89/jpg for single image/jpg image
I (7005) camera_demo: Open http://192.168.0.89/jpg_stream for multipart/x-mixed-replace stream of JPEGs
I (7015) camera_demo: Free heap: 4381092
I (7025) camera_demo: Camera demo ready

still debug doesnt look as expected (lines), and disabling its still shit…

back to ttmmtt fork, now with a change at app_main.c

#define CAMERA_FRAME_SIZE CAMERA_FS_QQVGA //CAMERA_FS_UXGA

i suspect the slow framerate (0.05fps) and finkness is just there.
ESP8266 was winXP, ESP32 is windows vista!

phase#5

now i found esp32-camera espresiff github repo, maybe it's the key.
it needs an SPRAM board so i will return to the ESP32-CAM module, that gave me lots of grief
this one needs more work to adapt to my virtual dev environment (esp32env), as in

clone the hello-world example

mkdir -p ~/dev/esp32-camera-test/components
cp /esp-idf-master/examples/get-started/hello_world/ ~/dev/esp32-camera-test

add the repo to it

cd ~/dev/esp32-camera-test/components
git clone https://github.com/espressif/esp32-camera

compile/flash

esp32env make menuconfig
esp32env make -j4 all
esp32env make -j4 flash

fuck this shit, arduino support for the esp32-camera is out!
but…. still not fully backed.

trying a fork of esp32-camera by M5 Stack didn't result in much , 0x20001 error

error 
I (102) camera: Searching for camera address
E (112) camera: Camera probe failed with error 0x20001
E (112) camera: Camera Init Failed 

full boot log

Click to display ⇲

Click to hide ⇱

  rst:0x1 (POWERON_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5980
load:0x40078000,len:8964
load:0x40080400,len:6360
entry 0x40080728
I (28) boot: ESP-IDF v3.3-beta1-44-gda2116f55 2nd stage bootloader
I (28) boot: compile time 22:57:44
I (28) boot: Enabling RNG early entropy source...
I (34) boot: SPI Speed      : 40MHz
I (38) boot: SPI Mode       : DIO
I (42) boot: SPI Flash Size : 4MB
I (47) boot: Partition Table:
I (50) boot: ## Label            Usage          Type ST Offset   Length
I (57) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (65) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (72) boot:  2 factory          factory app      00 00 00010000 00100000
I (80) boot: End of partition table
I (84) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x1b5dc (112092) map
I (132) esp_image: segment 1: paddr=0x0002b604 vaddr=0x3ff80000 size=0x00000 (     0) load
I (132) esp_image: segment 2: paddr=0x0002b60c vaddr=0x3ff80000 size=0x00000 (     0) load
I (139) esp_image: segment 3: paddr=0x0002b614 vaddr=0x3ffb0000 size=0x03088 ( 12424) load
I (152) esp_image: segment 4: paddr=0x0002e6a4 vaddr=0x3ffb3088 size=0x00000 (     0) load
I (156) esp_image: segment 5: paddr=0x0002e6ac vaddr=0x40080000 size=0x00400 (  1024) load
0x40080000: _WindowOverflow4 at /home/yair/esp/esp-idf/components/freertos/xtensa_vectors.S:1685

I (166) esp_image: segment 6: paddr=0x0002eab4 vaddr=0x40080400 size=0x0155c (  5468) load
I (176) esp_image: segment 7: paddr=0x00030018 vaddr=0x400d0018 size=0x72208 (467464) map
0x400d0018: _stext at ??:?

I (345) esp_image: segment 8: paddr=0x000a2228 vaddr=0x4008195c size=0x13558 ( 79192) load
0x4008195c: timer_list_unlock at /home/yair/esp/esp-idf/components/esp32/esp_timer.c:256

I (376) esp_image: segment 9: paddr=0x000b5788 vaddr=0x400c0000 size=0x00000 (     0) load
I (377) esp_image: segment 10: paddr=0x000b5790 vaddr=0x50000000 size=0x00000 (     0) load
I (383) esp_image: segment 11: paddr=0x000b5798 vaddr=0x50000000 size=0x00000 (     0) load
I (404) boot: Loaded app from partition at offset 0x10000
I (404) boot: Disabling RNG early entropy source...
I (407) spiram: Found 64MBit SPI RAM device
I (411) spiram: SPI RAM mode: flash 40m sram 40m
I (416) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (423) cpu_start: Pro cpu up.
I (427) cpu_start: Application information:
I (432) cpu_start: Project name:     camera
I (437) cpu_start: App version:      3435ff5-dirty
I (442) cpu_start: Compile time:     22:57:47
I (447) cpu_start: Compile date:     Dec 17 2018
I (453) cpu_start: ESP-IDF:          v3.3-beta1-44-gda2116f55
I (459) cpu_start: Starting app cpu, entry point is 0x400812f4
0x400812f4: call_start_cpu1 at /home/yair/esp/esp-idf/components/esp32/cpu_start.c:261

I (0) cpu_start: App cpu up.
I (1325) spiram: SPI SRAM memory test OK
I (1325) heap_init: Initializing. RAM available for dynamic allocation:
I (1325) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1331) heap_init: At 3FFBB068 len 00024F98 (147 KiB): DRAM
I (1338) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1344) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1351) heap_init: At 40094EB4 len 0000B14C (44 KiB): IRAM
I (1357) cpu_start: Pro cpu start user code
I (1362) spiram: Adding pool of 4096K of external SPI memory to heap allocator
I (41) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (42) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (82) camera: Enabling XCLK output
I (82) camera: Initializing SSCB
I (82) camera: Resetting camera
I (102) camera: Searching for camera address
E (112) camera: Camera probe failed with error 0x20001
E (112) camera: Camera Init Failed
I (152) wifi: wifi driver task: 3ffca96c, prio:23, stack:3584, core=0
I (152) wifi: wifi firmware version: 328353e
I (152) wifi: config NVS flash: enabled
I (162) wifi: config nano formating: disabled
I (162) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (172) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (192) wifi: Init dynamic tx buffer num: 32
I (192) wifi: Init data frame dynamic rx buffer num: 32
I (192) wifi: Init management frame dynamic rx buffer num: 32
I (202) wifi: Init static tx buffer num: 16
I (202) wifi: Init static rx buffer size: 1600
I (212) wifi: Init static rx buffer num: 10
I (212) wifi: Init dynamic rx buffer num: 32
I (302) phy: phy_version: 4000, b6198fa, Sep  3 2018, 15:11:06, 0, 0
I (302) wifi: mode : sta (24:0a:c4:29:a6:34)
I (302) camera: wifi_init_sta finished.
I (302) camera: connect to ap SSID:tomato-2.4GHz password:lastfall
I (422) wifi: new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
I (1112) wifi: state: init -> auth (b0)
I (1112) wifi: state: auth -> assoc (0)
I (1122) wifi: state: assoc -> run (10)
I (1132) wifi: connected with tomato-2.4GHz, channel 1, bssid = 80:26:89:0d:55:04
I (1142) wifi: pm start, type: 1

I (2612) event: sta ip: 192.168.0.89, mask: 255.255.255.0, gw: 192.168.0.1
I (2612) camera: got ip:192.168.0.89