Giter Site home page Giter Site logo

maximkulkin / esp32-homekit-camera Goto Github PK

View Code? Open in Web Editor NEW
393.0 48.0 78.0 2.96 MB

Firmware for esp32-camera module to act as Apple Homekit IP camera

License: MIT License

Makefile 0.22% C 76.50% Roff 0.50% Shell 2.01% SAS 0.22% Smalltalk 0.10% WebAssembly 0.22% Assembly 18.53% Module Management System 0.21% Perl 0.68% Python 0.72% CMake 0.03% StringTemplate 0.07%

esp32-homekit-camera's Introduction

esp32-homekit-camera

Firmware for esp32-camera module to act as Apple Homekit IP camera.

Based on esp-homekit.

Prerequisites

esp-idf

esp32-homekit-camera code

  • Clone this repository git clone https://github.com/maximkulkin/esp32-homekit-camera.git
  • Work out of this directory going forward cd esp32-homekit-camera
  • Initialize and sync all submodules (recursively) git submodule update --init --recursive

Configuration

Before compiling, you need to alter several settings in menuconfig. Make sure you save this file, as it will be used in the build section to configure ESP32-CAM as well as your network/Homekit settings.

  • Open the menuconfiguration with the command make menuconfig
  • Scroll through each section of the menu, and make these changes:
  • Serial flasher config
    • Default serial port
    • Flash size = 4 MB
  • Partition Table
    • Partition Table = Custom partition table CSV
    • Custom partition CSV file = partitions.csv
  • Component config
    • Driver configuration
      • RTCIO configuration
        • Support array rtc_gpio_desc for ESP32 = check
    • ESP32-specific
      • Support for external, SPI-connected RAM = check
      • SPI RAM config
        • Initialize SPI RAM during startup = check
        • SPI RAM access method = Make RAM allocatable using malloc() as well
    • Camera configuration
      • OV2640 Support = check
    • HomeKit
      • SPI flash address for storing HomeKit data = 0x3A0000
  • ESP32 HomeKit Camera
    • WiFi SSID
    • WiFi Password
    • Select Camera Pinout
      • Select Camera Pinout = your variant of module
    • LED Pin
      • PIN = your variant of module
        • ESP32-CAM by AI-Thinker == 33
    • Image sensor vertical flip (optional)
      • Toggle if HomeKit app has video feed upside down
    • Image sensor horizontal mirror (optional)
      • Toggle if HomeKit app has video feed mirrored
    • Image sensor enhance settings (optional)
      • EXPERIMENTAL: adjusts contrast, saturation, etc for better image quality
    • HomeKit Device Setup Code (optional)
    • HomeKit Device Manufacturer (optional)
    • HomeKit Device model name (optional)
    • HomeKit Device model number (optional)
    • HomeKit Device Serial number (optional)
    • HomeKit Device Firmware version (optional)

Build instructions ESP32

  1. Make sure you have followed the Configuration changes above
  2. Apply esp32-camera.patch patch:
    • git apply --directory="components/esp32-camera" esp32-camera.patch
    • This is only required once.
  3. Compile code make all
  4. To prevent any effects from previous firmware (e.g. firmware crashing right at start), highly recommend to erase flash:
    • make erase_flash
  5. Upload Upload firmware to ESP32
    • make flash monitor
    • Note, ESP32 GPIO0 pin needs to be connected to GND pin to enable flashing
    • To exit monitor, on mac control+]

Add camera to HomeKit app

  1. Open Home app
  2. Click + sign to add accessory
  3. On Add Accessory screen, click I Don't Have a Code or Cannot Scan button
  4. The ESP camera accessory should be shown, click the icon
  5. On Uncertified Accessory prompt, select Add Anyway
  6. On Enter HomeKit Setup Code, enter setup code
    • Default is 111-11-111
    • Found in the HomeKit Configuration section above
  7. Click Continue button
  8. Select camera location, continue
  9. Enter camera name, continue
  10. Click Done
  11. Camera ready to use

Troubleshooting

While not HomeKit specific, good amount of troubleshooting information for flashing ESP32 devices can be found at https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/

Other

Device runs a webserver on HTTP port 5556

esp32-homekit-camera's People

Contributors

florianrehm avatar hire-vladimir avatar jangolen avatar maximkulkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32-homekit-camera's Issues

Couldn't compile

Hi,

I cloned "esp32-homekit-camera" example inside esp32-homekit-camera folder which I created with that path "esp-homekit-demo/examples/esp32-homekit-camera"

I cloned with that command -> git clone --recursive https://github.com/maximkulkin/esp32-homekit-camera.git .

Then, my direction like that:
components
main
.gitignore
.gitmodules
LICENSE
Makefile
README.md
esp32-camera.patch

I tried to make menuconfig command got that:
make: *** test: No such file or directory. Stop.

I tried same thing inside of main folder and got same respond.

make -C . test didn't work for me. make -C . erase_flash either. What do I miss? Now, my linux machine can compile and flash any esp8266. Should I install anything for esp32?

Addition:

I guess, I need to install ESP-IDF? I am new in linux environment, I don't want to destroy my esp8266 files and its compiling capability.

Can you help me line by line which codes should I run to install until compiling esp32-homekit-camera example?

setup endpoint response should refer to self, not controller

in my opinion on reading the apple specs, the response of setup endpoints need to refer to the camera, not the controller.
This means that e.g. this line in app_main near line 268 is wrong and all that stems from it

    tlv_add_tlv_value(response, 3, controller_address);

Wrover Kit - SCCB_Write failed

Hello Maxim,

I used a Wrover Kit camera and if I started the monitor, I got this error:

WiFI ready
I (4821) esp32_camera: Free heap: 230212
I (4821) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (4831) gpio: GPIO[14]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
SCCB_Write [ff]=01 failed
SCCB_Write [12]=80 failed
E (4871) camera: Camera probe failed with error 0x20001
E (4871) esp32_camera: Camera init failed with error 0x20001
>>> HomeKit: Starting server

What can I do?

camera init failed on esp-eye board

I have updated esp32-homekit-camera code, and make flash to esp-eye board, but seems camera init failed:

...
E (11963) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=3
E (11983) camera_xclk: ledc_timer_config failed, rc=ffffffff 
SCCB_Write [ff]=01 failed
SCCB_Write [12]=80 failed
E (12013) camera: Camera probe failed with error 0x20001
E (12013) esp32_camera: Camera init failed with error 0x20001
...

sensor is OV2640, could you help me

Error while compiling

I am using mingw32 on Windows as my development environment for esp-idf.
I was able to successfully compile the LED example for esp32 from esp-homekit-demo but I am getting the following error while trying to compile esp32-homekit-camera.

I did use the --recursive flag while cloning esp-idf & esp32-homekit-camera repository.
I also performed git submodule update --init --recursive after the repositories were cloned.

compile error

Is there a default setup code?

I can see the ESP32 camera accessory in HomeKit, but I don't know the setup code when I try to add it. I tried the default 12345678 that is in the HomeKit readme, but that's not working. When I enter an incorrect code, serial console says 'Failed to verify peer's proof (code -219)'.

Setting log level to debug doesn't reveal the code either.

Is there a default setup code, and if so, what is it, and if not, how do I specify the code at build time?

Runtime Error in esp_flash_write in esp_flash_api

Hello,

I download the new version of esp32-homekit-cam and compiled it successfully after I changed this:
I got this error:

AR build/lwip/liblwip.a
CC build/x264/x264-snapshot-20181221-2245-stable/common/base.o
cc1: error: -Werror=format-truncation=: no option -Wformat-truncation=
cc1: warning: unrecognized command line option '-Wno-frame-address'
make[1]: *** [x264-snapshot-20181221-2245-stable/common/base.o] Error 1
make: *** [component-x264-build] Error 2

I changed */x264/component.mk:

# ESP_IDF
x264_THIRDPARTY_ROOT = x264-snapshot-20181221-2245-stable

COMPONENT_SRCDIRS = $(x264_THIRDPARTY_ROOT)/common $(x264_THIRDPARTY_ROOT)/encoder
COMPONENT_ADD_INCLUDEDIRS = . $(x264_THIRDPARTY_ROOT)

#CFLAGS += -Wno-error=format-truncation=      <- This did not work for me

$(eval $(call compile_exclude, $(addprefix $(x264_THIRDPARTY_ROOT)/, \
    common/opencl.o \
    common/threadpool.o \
    common/win32thread.o \
    encoder/rdo.o \
    encoder/slicetype.o \
)))

The program started at esp32 and the connection to homekit started. At Pair Setup Step 3/3 I got this error:

...
I (6142) camera: Allocating 2 frame buffers (75 KB total)
I (6152) camera: Allocating 37 KB frame buffer in OnBoard RAM
I (6162) camera: Allocating 37 KB frame buffer in OnBoard RAM
>>> HomeKit: Starting server
>>> HomeKit: Using existing accessory ID: C0:B1:A8:09:BF:ED
>>> HomeKit: Configuring mDNS
>>> HomeKit: Got new client connection: 55
>>> HomeKit: [Client 55] Pair Setup Step 1/3
>>> HomeKit: [Client 55] Pair Setup Step 2/3
>>> HomeKit: [Client 55] Pair Setup Step 3/3
abort() was called at PC 0x400833d9 on core 0
0x400833d9: esp_flash_write at /Users/username/esp/esp-idf/components/spi_flash/esp_flash_api.c:609


ELF file SHA256: 259834b78efd7d0bfd0a74940c1c5bf4f4c8c4149ca0a202f5863d1e3bc23397

Backtrace: 0x4008bb55:0x3ffe6f50 0x4008bec5:0x3ffe6f70 0x400833d9:0x3ffe6f90 0x400e6bed:0x3ffe6fe0 0x4017f386:0x3ffe7000 0x4017e41f:0x3ffe7080 0x4017ef19:0x3ffe71d0 0x40183091:0x3ffe71f0 0x4017c757:0x3ffe7250 0x4017dc03:0x3ffe7280 0x4017ed32:0x3ffe72c0 0x4008e06d:0x3ffe72e0
0x4008bb55: invoke_abort at /Users/username/esp/esp-idf/components/esp32/panic.c:719

0x4008bec5: abort at /Users/username/esp/esp-idf/components/esp32/panic.c:719

0x400833d9: esp_flash_write at /Users/username/esp/esp-idf/components/spi_flash/esp_flash_api.c:609

0x400e6bed: spi_flash_write at /Users/username/esp/esp-idf/components/spi_flash/esp_flash_api.c:657

0x4017f386: homekit_storage_add_pairing at /Users/username/esp/esp32-homekit-camera/components/homekit/src/storage.c:247

0x4017e41f: homekit_server_on_pair_setup at /Users/username/esp/esp32-homekit-camera/components/homekit/src/server.c:1353

0x4017ef19: homekit_server_on_message_complete at /Users/username/esp/esp32-homekit-camera/components/homekit/src/server.c:2925

0x40183091: http_parser_execute at /Users/username/esp/esp32-homekit-camera/components/http-parser/http-parser/http_parser.c:2335

0x4017c757: homekit_client_process at /Users/username/esp/esp32-homekit-camera/components/homekit/src/server.c:3149

0x4017dc03: homekit_run_server at /Users/username/esp/esp32-homekit-camera/components/homekit/src/server.c:3257

0x4017ed32: homekit_server_task at /Users/username/esp/esp32-homekit-camera/components/homekit/src/server.c:3425

0x4008e06d: vPortTaskWrapper at /Users/username/esp/esp-idf/components/freertos/port.c:403


Rebooting...
... 

Can anyone help me? Which version of esp-idf did you use? Did you use Mac Catalina?

Failed to dump SPR public key (code -199)

Hi Maxim,
I'm impressed about your Homekit implementation. However I get the following error.

`
[0;32mI (29) boot: ESP-IDF v3.3 2nd stage bootloader�[0m
�[0;32mI (29) boot: compile time 22:11:44�[0m
�[0;32mI (29) boot: Enabling RNG early entropy source...�[0m
�[0;32mI (33) boot: SPI Speed : 40MHz�[0m
�[0;32mI (37) boot: SPI Mode : DIO�[0m
�[0;32mI (41) boot: SPI Flash Size : 4MB�[0m
�[0;32mI (45) boot: Partition Table:�[0m
�[0;32mI (49) boot: ## Label Usage Type ST Offset Length�[0m
�[0;32mI (56) boot: 0 nvs WiFi data 01 02 00009000 00006000�[0m
�[0;32mI (64) boot: 1 phy_init RF data 01 01 0000f000 00001000�[0m
�[0;32mI (71) boot: 2 factory factory app 00 00 00010000 00200000�[0m
�[0;32mI (79) boot: End of partition table�[0m
�[0;32mI (83) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0xb0d4c (724300) map�[0m
�[0;32mI (346) esp_image: segment 1: paddr=0x000c0d74 vaddr=0x3ffb0000 size=0x03e00 ( 15872) load�[0m
�[0;32mI (352) esp_image: segment 2: paddr=0x000c4b7c vaddr=0x40080000 size=0x00400 ( 1024) load�[0m
�[0;32mI (353) esp_image: segment 3: paddr=0x000c4f84 vaddr=0x40080400 size=0x0b08c ( 45196) load�[0m
�[0;32mI (380) esp_image: segment 4: paddr=0x000d0018 vaddr=0x400d0018 size=0x11f920 (1177888) map�[0m
�[0;32mI (794) esp_image: segment 5: paddr=0x001ef940 vaddr=0x4008b48c size=0x0c884 ( 51332) load�[0m
�[0;32mI (829) boot: Loaded app from partition at offset 0x10000�[0m
�[0;32mI (830) boot: Disabling RNG early entropy source...�[0m
�[0;32mI (830) psram: This chip is ESP32-D0WD�[0m
�[0;32mI (836) spiram: Found 64MBit SPI RAM device�[0m
�[0;32mI (839) spiram: SPI RAM mode: flash 40m sram 40m�[0m
�[0;32mI (844) spiram: PSRAM initialized, cache is in low/high (2-core) mode.�[0m
�[0;32mI (852) cpu_start: Pro cpu up.�[0m
�[0;32mI (855) cpu_start: Application information:�[0m
�[0;32mI (860) cpu_start: Project name: esp32-homekit-camera�[0m
�[0;32mI (866) cpu_start: App version: v3.3�[0m
�[0;32mI (871) cpu_start: Compile time: Dec 1 2019 22:11:47�[0m
�[0;32mI (877) cpu_start: ELF file SHA256: 13212f43026bdf65...�[0m
�[0;32mI (883) cpu_start: ESP-IDF: v3.3�[0m
�[0;32mI (888) cpu_start: Starting app cpu, entry point is 0x40081520�[0m
�[0;32mI (0) cpu_start: App cpu up.�[0m
�[0;32mI (1779) spiram: SPI SRAM memory test OK�[0m
�[0;32mI (1779) heap_init: Initializing. RAM available for dynamic allocation:�[0m
�[0;32mI (1779) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM�[0m
�[0;32mI (1786) heap_init: At 3FFBBC88 len 00024378 (144 KiB): DRAM�[0m
�[0;32mI (1792) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM�[0m
�[0;32mI (1798) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM�[0m
�[0;32mI (1805) heap_init: At 40097D10 len 000082F0 (32 KiB): IRAM�[0m
�[0;32mI (1811) cpu_start: Pro cpu start user code�[0m
�[0;32mI (1816) spiram: Adding pool of 4096K of external SPI memory to heap allocator�[0m
�[0;32mI (160) cpu_start: Chip Revision: 1�[0m
�[0;33mW (160) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it.�[0m
�[0;32mI (164) cpu_start: Starting scheduler on PRO CPU.�[0m
�[0;32mI (0) cpu_start: Starting scheduler on APP CPU.�[0m
�[0;32mI (174) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations�[0m
I (234) wifi: wifi driver task: 3ffcb8d0, prio:23, stack:3584, core=0
�[0;32mI (234) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
�[0;32mI (234) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
I (274) wifi: wifi firmware version: aeed694
I (274) wifi: config NVS flash: enabled
I (274) wifi: config nano formating: disabled
I (274) wifi: Init dynamic tx buffer num: 32
I (274) wifi: Init data frame dynamic rx buffer num: 32
I (284) wifi: Init management frame dynamic rx buffer num: 32
I (284) wifi: Init management short buffer num: 32
I (294) wifi: Init static tx buffer num: 16
I (294) wifi: Init static rx buffer size: 1600
I (294) wifi: Init static rx buffer num: 10
I (304) wifi: Init dynamic rx buffer num: 32
�[0;32mI (404) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0�[0m
I (404) wifi: mode : sta (xxxxxxxxxxxxxx)
�[0;32mI (404) esp32_camera: STA start�[0m
I (524) wifi: new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (1654) wifi: state: init -> auth (b0)
I (1664) wifi: state: auth -> assoc (0)
I (1674) wifi: state: assoc -> run (10)
I (1684) wifi: connected with xxxxxxxxxxx, channel 1, HT20, bssid = xxxxxxxx
I (1684) wifi: pm start, type: 1

�[0;32mI (2224) event: sta ip: 192.168.xxx.xxx, mask: 255.255.255.0, gw: xxxxxxxxxxx�[0m
�[0;32mI (2224) esp32_camera: WiFI ready�[0m
�[0;32mI (2224) esp32_camera: Free heap: 4364024�[0m
�[0;32mI (2234) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2244) gpio: GPIO[14]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2254) sccb: pin_sda 26 pin_scl 27
�[0m
�[0;32mI (2254) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
�[0;31mE (2284) sccb: SCCB_Write Failed addr:0x3c, reg:0xff, data:0x01, ret:-1�[0m
�[0;31mE (2284) sccb: SCCB_Write Failed addr:0x3c, reg:0x12, data:0x80, ret:-1�[0m
�[0;32mI (2364) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2364) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2374) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2384) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2394) gpio: GPIO[21]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2404) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2414) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2424) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2434) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2444) gpio: GPIO[23]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2454) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (2464) camera: Allocating 2 frame buffers (75 KB total)�[0m
�[0;32mI (2474) camera: Allocating 37 KB frame buffer in OnBoard RAM�[0m
�[0;32mI (2484) camera: Allocating 37 KB frame buffer in OnBoard RAM�[0m

HomeKit: Starting server
HomeKit: Using existing accessory ID: 72:3E:79:92:B6:29
�[0;32mI (2674) esp32_camera: Initializing streaming�[0m
HomeKit: Configuring mDNS
�[0;32mI (2684) esp32_camera: Streaming initialized�[0m
HomeKit: Got new client connection: 56 from 192.168.xxx.xxx
HomeKit: [Client 56] Pair Setup Step 1/3
!!! HomeKit: [Client 56] Failed to dump SPR public key (code -199)
HomeKit: [Client 56] Closing client connection
`

Incomplete boot - pairing code?

Hello Maxim, I just flashed your FW to my ESP32 and I am stucked on this:

>>> HomeKit: Starting server
>>> HomeKit: Using existing accessory ID: AD:B3:70:E8:D9:36
>>> HomeKit: Configuring mDNS

I can see cam in my HomeKit, but I am not able to add, becuse I am missing pairing code. I think that boot of my ESP32 is not complete?

Re-add cam to homekit

I have removed the cam in homekit, now I would like to re-add it, but it is not listed in homekit, so how can I find out the code for manual entering?

Crash camera

Camera shows pictures in each 10 seconds on favorite page (main page of homekit)

When I press the camera view to see stream, it gives that output and crashes:

�[0;32mI (437617) esp32_camera: Resource payload: {"image-width":640,"image-height":480,"resource-type":"image"}�[0m
>>> HomeKit: [Client 56] Resource
�[0;32mI (439657) esp32_camera: Resource payload: {"image-width":640,"image-height":480,"resource-type":"image"}�[0m
>>> HomeKit: [Client 57] Get Characteristics
>>> HomeKit: [Client 57] Update Characteristics
>>> HomeKit: [Client 57] Get Characteristics
�[0;32mI (440787) esp32_camera: Creating setup endpoints response�[0m
>>> HomeKit: [Client 57] Update Characteristics
�[0;32mI (440997) esp32_camera: Processing session command 1�[0m
�[0;32mI (440997) esp32_camera: Adding streaming session�[0m
�[0;32mI (440997) esp32_camera: Starting streaming�[0m
�[0;32mI (440997) esp32_camera: Total free memory: 4203648�[0m
x264 [info]: using cpu capabilities: none!
x264 [info]: profile Constrained Baseline, level 1.0
�[0;32mI (441097) esp32_camera: Executing streaming loop�[0m
�[0;32mI (441107) esp32_camera: Total free memory: 3635344�[0m
�[0;32mI (441107) esp32_camera: Getting a frame�[0m
�[0;32mI (441107) esp32_camera: Total free memory: 3635344�[0m
�[0;32mI (441117) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (441167) esp32_camera: JPEG finishing�[0m
�[0;32mI (441167) esp32_camera: JPEG destroying�[0m
�[0;32mI (441167) esp32_camera: Returning frame buffer�[0m
�[0;32mI (441167) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (441167) esp32_camera: Encoding a frame�[0m
�[0;32mI (441177) esp32_camera: Total free memory: 3635252�[0m
�[0;32mI (441387) esp32_camera: Encoded frame, size = 2495�[0m
�[0;32mI (441387) esp32_camera: Sending RTCP sender report�[0m
�[0;32mI (441407) esp32_camera: Done sending frame data�[0m
�[0;32mI (441427) esp32_camera: Getting a frame�[0m
�[0;32mI (441427) esp32_camera: Total free memory: 3550928�[0m
�[0;32mI (441427) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (441477) esp32_camera: JPEG finishing�[0m
�[0;32mI (441477) esp32_camera: JPEG destroying�[0m
�[0;32mI (441477) esp32_camera: Returning frame buffer�[0m
�[0;32mI (441477) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (441477) esp32_camera: Encoding a frame�[0m
�[0;32mI (441487) esp32_camera: Total free memory: 3550928�[0m
�[0;32mI (441557) esp32_camera: Encoded frame, size = 25�[0m
�[0;32mI (441557) esp32_camera: Done sending frame data�[0m
�[0;32mI (441577) esp32_camera: Getting a frame�[0m
�[0;32mI (441577) esp32_camera: Total free memory: 3426096�[0m
�[0;32mI (441577) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (441627) esp32_camera: JPEG finishing�[0m
�[0;32mI (441627) esp32_camera: JPEG destroying�[0m
�[0;32mI (441627) esp32_camera: Returning frame buffer�[0m
�[0;32mI (441627) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (441637) esp32_camera: Encoding a frame�[0m
�[0;32mI (441637) esp32_camera: Total free memory: 3426096�[0m
�[0;32mI (441727) esp32_camera: Encoded frame, size = 29�[0m
�[0;32mI (441727) esp32_camera: Done sending frame data�[0m
�[0;32mI (441747) esp32_camera: Getting a frame�[0m
�[0;32mI (441747) esp32_camera: Total free memory: 3426096�[0m
�[0;32mI (441747) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (441797) esp32_camera: JPEG finishing�[0m
�[0;32mI (441797) esp32_camera: JPEG destroying�[0m
�[0;32mI (441797) esp32_camera: Returning frame buffer�[0m
�[0;32mI (441797) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (441807) esp32_camera: Encoding a frame�[0m
�[0;32mI (441807) esp32_camera: Total free memory: 3426096�[0m
�[0;32mI (441897) esp32_camera: Encoded frame, size = 51�[0m
�[0;32mI (441907) esp32_camera: Done sending frame data�[0m
�[0;32mI (441917) esp32_camera: Getting a frame�[0m
�[0;32mI (441917) esp32_camera: Total free memory: 3425716�[0m
�[0;32mI (441917) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (442017) esp32_camera: JPEG finishing�[0m
�[0;32mI (442017) esp32_camera: JPEG destroying�[0m
�[0;32mI (442017) esp32_camera: Returning frame buffer�[0m
�[0;32mI (442017) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (442027) esp32_camera: Encoding a frame�[0m
�[0;32mI (442027) esp32_camera: Total free memory: 3425716�[0m
�[0;32mI (442187) esp32_camera: Encoded frame, size = 178�[0m
�[0;32mI (442187) esp32_camera: Done sending frame data�[0m
�[0;32mI (442207) esp32_camera: Getting a frame�[0m
�[0;32mI (442207) esp32_camera: Total free memory: 3425716�[0m
�[0;32mI (442207) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (442307) esp32_camera: JPEG finishing�[0m
�[0;32mI (442307) esp32_camera: JPEG destroying�[0m
�[0;32mI (442307) esp32_camera: Returning frame buffer�[0m
�[0;32mI (442307) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (442317) esp32_camera: Encoding a frame�[0m
�[0;32mI (442317) esp32_camera: Total free memory: 3425716�[0m
�[0;32mI (442487) esp32_camera: Encoded frame, size = 394�[0m
�[0;32mI (442497) esp32_camera: Done sending frame data�[0m
�[0;32mI (442507) esp32_camera: Getting a frame�[0m
�[0;32mI (442507) esp32_camera: Total free memory: 3425340�[0m
�[0;32mI (442507) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (442597) esp32_camera: JPEG finishing�[0m
�[0;32mI (442597) esp32_camera: JPEG destroying�[0m
�[0;32mI (442597) esp32_camera: Returning frame buffer�[0m
�[0;32mI (442607) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (442607) esp32_camera: Encoding a frame�[0m
�[0;32mI (442617) esp32_camera: Total free memory: 3425340�[0m
�[0;32mI (442777) esp32_camera: Encoded frame, size = 257�[0m
�[0;32mI (442777) esp32_camera: Done sending frame data�[0m
�[0;32mI (442797) esp32_camera: Getting a frame�[0m
�[0;32mI (442797) esp32_camera: Total free memory: 3425340�[0m
�[0;32mI (442797) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (442887) esp32_camera: JPEG finishing�[0m
�[0;32mI (442887) esp32_camera: JPEG destroying�[0m
�[0;32mI (442897) esp32_camera: Returning frame buffer�[0m
�[0;32mI (442897) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (442897) esp32_camera: Encoding a frame�[0m
�[0;32mI (442907) esp32_camera: Total free memory: 3425340�[0m
�[0;32mI (443097) esp32_camera: Encoded frame, size = 418�[0m
�[0;32mI (443097) esp32_camera: Done sending frame data�[0m
�[0;32mI (443117) esp32_camera: Getting a frame�[0m
�[0;32mI (443117) esp32_camera: Total free memory: 3424964�[0m
�[0;32mI (443117) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (443167) esp32_camera: JPEG finishing�[0m
�[0;32mI (443167) esp32_camera: JPEG destroying�[0m
�[0;32mI (443167) esp32_camera: Returning frame buffer�[0m
�[0;32mI (443167) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (443177) esp32_camera: Encoding a frame�[0m
�[0;32mI (443177) esp32_camera: Total free memory: 3424964�[0m
�[0;32mI (443347) esp32_camera: Encoded frame, size = 331�[0m
�[0;32mI (443357) esp32_camera: Done sending frame data�[0m
�[0;32mI (443367) esp32_camera: Getting a frame�[0m
�[0;32mI (443367) esp32_camera: Total free memory: 3424964�[0m
�[0;32mI (443367) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (443407) esp32_camera: JPEG finishing�[0m
�[0;32mI (443407) esp32_camera: JPEG destroying�[0m
�[0;32mI (443407) esp32_camera: Returning frame buffer�[0m
�[0;32mI (443417) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (443417) esp32_camera: Encoding a frame�[0m
�[0;32mI (443427) esp32_camera: Total free memory: 3424460�[0m
�[0;32mI (443597) esp32_camera: Encoded frame, size = 371�[0m
�[0;32mI (443597) esp32_camera: Done sending frame data�[0m
�[0;32mI (443617) esp32_camera: Getting a frame�[0m
�[0;32mI (443617) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (443617) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (443667) esp32_camera: JPEG finishing�[0m
�[0;32mI (443667) esp32_camera: JPEG destroying�[0m
�[0;32mI (443667) esp32_camera: Returning frame buffer�[0m
�[0;32mI (443667) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (443667) esp32_camera: Encoding a frame�[0m
�[0;32mI (443677) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (443917) esp32_camera: Encoded frame, size = 2516�[0m
W (443927) wifi: alloc eb len=24 type=3 fail, heap:3424424

W (443927) wifi: m f null

�[0;32mI (443937) esp32_camera: Done sending frame data�[0m
�[0;32mI (443947) esp32_camera: Getting a frame�[0m
�[0;32mI (443947) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (443947) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (443997) esp32_camera: JPEG finishing�[0m
�[0;32mI (443997) esp32_camera: JPEG destroying�[0m
�[0;32mI (443997) esp32_camera: Returning frame buffer�[0m
�[0;32mI (443997) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (443997) esp32_camera: Encoding a frame�[0m
�[0;32mI (444007) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (444147) esp32_camera: Encoded frame, size = 468�[0m
�[0;32mI (444147) esp32_camera: Done sending frame data�[0m
�[0;32mI (444167) esp32_camera: Getting a frame�[0m
�[0;32mI (444167) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (444167) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (444207) esp32_camera: JPEG finishing�[0m
�[0;32mI (444207) esp32_camera: JPEG destroying�[0m
�[0;32mI (444207) esp32_camera: Returning frame buffer�[0m
�[0;32mI (444217) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (444217) esp32_camera: Encoding a frame�[0m
�[0;32mI (444227) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (444377) esp32_camera: Encoded frame, size = 503�[0m
�[0;32mI (444377) esp32_camera: Done sending frame data�[0m
�[0;32mI (444387) esp32_camera: Getting a frame�[0m
�[0;32mI (444387) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (444387) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (444427) esp32_camera: JPEG finishing�[0m
�[0;32mI (444437) esp32_camera: JPEG destroying�[0m
�[0;32mI (444437) esp32_camera: Returning frame buffer�[0m
�[0;32mI (444437) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (444437) esp32_camera: Encoding a frame�[0m
�[0;32mI (444447) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (444597) esp32_camera: Encoded frame, size = 526�[0m
�[0;32mI (444597) esp32_camera: Done sending frame data�[0m
�[0;32mI (444617) esp32_camera: Getting a frame�[0m
�[0;32mI (444617) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (444617) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (444657) esp32_camera: JPEG finishing�[0m
�[0;32mI (444667) esp32_camera: JPEG destroying�[0m
�[0;32mI (444667) esp32_camera: Returning frame buffer�[0m
�[0;32mI (444667) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (444667) esp32_camera: Encoding a frame�[0m
�[0;32mI (444677) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (444827) esp32_camera: Encoded frame, size = 480�[0m
�[0;32mI (444827) esp32_camera: Done sending frame data�[0m
�[0;32mI (444847) esp32_camera: Getting a frame�[0m
�[0;32mI (444847) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (444847) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (444897) esp32_camera: JPEG finishing�[0m
�[0;32mI (444897) esp32_camera: JPEG destroying�[0m
�[0;32mI (444897) esp32_camera: Returning frame buffer�[0m
�[0;32mI (444897) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (444907) esp32_camera: Encoding a frame�[0m
�[0;32mI (444907) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (445057) esp32_camera: Encoded frame, size = 382�[0m
�[0;32mI (445057) esp32_camera: Done sending frame data�[0m
�[0;32mI (445077) esp32_camera: Getting a frame�[0m
�[0;32mI (445077) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (445077) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (445127) esp32_camera: JPEG finishing�[0m
�[0;32mI (445127) esp32_camera: JPEG destroying�[0m
�[0;32mI (445127) esp32_camera: Returning frame buffer�[0m
�[0;32mI (445127) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (445137) esp32_camera: Encoding a frame�[0m
�[0;32mI (445137) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (445287) esp32_camera: Encoded frame, size = 259�[0m
�[0;32mI (445297) esp32_camera: Done sending frame data�[0m
�[0;32mI (445307) esp32_camera: Getting a frame�[0m
�[0;32mI (445307) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (445307) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (445347) esp32_camera: JPEG finishing�[0m
�[0;32mI (445347) esp32_camera: JPEG destroying�[0m
�[0;32mI (445347) esp32_camera: Returning frame buffer�[0m
�[0;32mI (445347) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (445357) esp32_camera: Encoding a frame�[0m
�[0;32mI (445357) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (445517) esp32_camera: Encoded frame, size = 308�[0m
�[0;32mI (445517) esp32_camera: Done sending frame data�[0m
�[0;32mI (445537) esp32_camera: Getting a frame�[0m
�[0;32mI (445537) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (445537) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (445577) esp32_camera: JPEG finishing�[0m
�[0;32mI (445577) esp32_camera: JPEG destroying�[0m
�[0;32mI (445577) esp32_camera: Returning frame buffer�[0m
�[0;32mI (445587) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (445587) esp32_camera: Encoding a frame�[0m
�[0;32mI (445597) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (445757) esp32_camera: Encoded frame, size = 379�[0m
�[0;32mI (445757) esp32_camera: Done sending frame data�[0m
�[0;32mI (445777) esp32_camera: Getting a frame�[0m
�[0;32mI (445777) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (445777) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (445817) esp32_camera: JPEG finishing�[0m
�[0;32mI (445827) esp32_camera: JPEG destroying�[0m
�[0;32mI (445827) esp32_camera: Returning frame buffer�[0m
�[0;32mI (445827) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (445827) esp32_camera: Encoding a frame�[0m
�[0;32mI (445837) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (446007) esp32_camera: Encoded frame, size = 433�[0m
�[0;32mI (446007) esp32_camera: Done sending frame data�[0m
�[0;32mI (446027) esp32_camera: Getting a frame�[0m
�[0;32mI (446027) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (446027) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (446067) esp32_camera: JPEG finishing�[0m
�[0;32mI (446067) esp32_camera: JPEG destroying�[0m
�[0;32mI (446067) esp32_camera: Returning frame buffer�[0m
�[0;32mI (446067) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (446077) esp32_camera: Encoding a frame�[0m
�[0;32mI (446077) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (446317) esp32_camera: Encoded frame, size = 2404�[0m
�[0;32mI (446337) esp32_camera: Done sending frame data�[0m
�[0;32mI (446347) esp32_camera: Getting a frame�[0m
�[0;32mI (446347) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (446347) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (446387) esp32_camera: JPEG finishing�[0m
�[0;32mI (446387) esp32_camera: JPEG destroying�[0m
�[0;32mI (446387) esp32_camera: Returning frame buffer�[0m
�[0;32mI (446387) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (446397) esp32_camera: Encoding a frame�[0m
�[0;32mI (446397) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (446487) esp32_camera: Encoded frame, size = 35�[0m
�[0;32mI (446487) esp32_camera: Done sending frame data�[0m
�[0;32mI (446497) esp32_camera: Getting a frame�[0m
�[0;32mI (446497) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (446497) esp32_camera: JPEG output size: 80x60�[0m
�[0;32mI (446547) esp32_camera: JPEG finishing�[0m
�[0;32mI (446547) esp32_camera: JPEG destroying�[0m
�[0;32mI (446547) esp32_camera: Returning frame buffer�[0m
�[0;32mI (446547) esp32_camera: Done grabbing a frame�[0m
�[0;32mI (446557) esp32_camera: Encoding a frame�[0m
�[0;32mI (446557) esp32_camera: Total free memory: 3424580�[0m
�[0;32mI (446647) esp32_camera: Encoded frame, size = 59�[0m
�[0;32mI (446657) esp32_camera: Done sending frame data�[0m
�[0;31mE (446657) esp32_camera: Failed to send encrypted packet (code 12)�[0m
�[0;31mE (446657) esp32_camera: Failed to send RTP packet (code -2)�[0m
x264 [info]: frame I:3     Avg QP:17.67  size:  2472
x264 [info]: frame P:20    Avg QP:20.75  size:   294
x264 [info]: mb I  I16..4: 100.0%  0.0%  0.0%
x264 [info]: mb P  I16..4:  0.2%  0.0%  0.0%  P16..4: 73.2%  0.0%  0.0%  0.0%  0.0%    skip:26.5%
x264 [info]: coded y,uvDC,uvAC intra: 100.0% 100.0% 98.4% inter: 44.2% 56.9% 27.1%
x264 [info]: i16 v,h,dc,p: 10% 49% 41%  0%
x264 [info]: i8c dc,h,v,p: 51% 31%  7% 11%
x264 [info]: kb/s:115.66
�[0;32mI (446707) esp32_camera: Done with stream�[0m
ets Jun  8 2016 00:22:57

Colored Snow

Hello Maxim,
I downloaded the last version and started from scratch.
I use a "M5Stack Camera with PSRAM" and the picture mode worked fine. If I started stream, I got only colored snow:

image

Some days ago I tested the version with date 18.10.19. This stream worked a short time like you described it. The old version was ok. Did the M5Stack Camera with PSRAM" work at your new enviroment?

Compile error

Debian 9.8 x64

mcpat@debian:~/esp/esp32-homekit-camera$ make all
Toolchain path: /home/mcpat/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: esp32-2019r1
Compiler version: 8.2.0
Python requirements from /home/mcpat/esp/esp-idf/requirements.txt are satisfied.

App "esp32-homekit-camera" version: ab7d9e5
CC build/homekit/src/storage.o
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c: In function 'homekit_storage_init':
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c:56:38: error: argument to 'sizeof' in 'strncpy' call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
         strncpy(magic, magic1, sizeof(magic1));
                                      ^
In file included from /home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c:6:
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c: In function 'homekit_storage_can_add_pairing':
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/port.h:20:85: warning: value computed is not used [-Wunused-value]
 #define spiflash_read(addr, buffer, size) (spi_flash_read((addr), (buffer), (size)) == ESP_OK)
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c:149:9: note: in expansion of macro 'spiflash_read'
         spiflash_read(PAIRINGS_ADDR + sizeof(data)*i, (byte *)&data, sizeof(data));
         ^~~~~~~~~~~~~
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c: In function 'find_empty_block':
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/port.h:20:85: warning: value computed is not used [-Wunused-value]
 #define spiflash_read(addr, buffer, size) (spi_flash_read((addr), (buffer), (size)) == ESP_OK)
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c:202:9: note: in expansion of macro 'spiflash_read'
         spiflash_read(PAIRINGS_ADDR + sizeof(data)*i, data, sizeof(data));
         ^~~~~~~~~~~~~
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c: In function 'homekit_storage_add_pairing':
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c:233:39: error: argument to 'sizeof' in 'strncpy' call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
     strncpy(data.magic, magic1, sizeof(magic1));
                                       ^
In file included from /home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c:6:
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c: In function 'homekit_storage_update_pairing':
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/port.h:20:85: warning: value computed is not used [-Wunused-value]
 #define spiflash_read(addr, buffer, size) (spi_flash_read((addr), (buffer), (size)) == ESP_OK)
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c:257:9: note: in expansion of macro 'spiflash_read'
         spiflash_read(PAIRINGS_ADDR + sizeof(data)*i, (byte *)&data, sizeof(data));
         ^~~~~~~~~~~~~
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c: In function 'homekit_storage_remove_pairing':
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/port.h:20:85: warning: value computed is not used [-Wunused-value]
 #define spiflash_read(addr, buffer, size) (spi_flash_read((addr), (buffer), (size)) == ESP_OK)
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c:294:9: note: in expansion of macro 'spiflash_read'
         spiflash_read(PAIRINGS_ADDR + sizeof(data)*i, (byte *)&data, sizeof(data));
         ^~~~~~~~~~~~~
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c: In function 'homekit_storage_find_pairing':
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/port.h:20:85: warning: value computed is not used [-Wunused-value]
 #define spiflash_read(addr, buffer, size) (spi_flash_read((addr), (buffer), (size)) == ESP_OK)
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c:315:9: note: in expansion of macro 'spiflash_read'
         spiflash_read(PAIRINGS_ADDR + sizeof(data)*i, (byte *)&data, sizeof(data));
         ^~~~~~~~~~~~~
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c: In function 'homekit_storage_next_pairing':
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/port.h:20:85: warning: value computed is not used [-Wunused-value]
 #define spiflash_read(addr, buffer, size) (spi_flash_read((addr), (buffer), (size)) == ESP_OK)
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/home/mcpat/esp/esp32-homekit-camera/components/homekit/src/storage.c:363:9: note: in expansion of macro 'spiflash_read'
         spiflash_read(PAIRINGS_ADDR + sizeof(data)*id, (byte *)&data, sizeof(data));
         ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [src/storage.o] Error 1
make: *** [component-homekit-build] Error 2

No Streaming

After successful configuration (e.g. use partition.csv, ...) I can connect to cam with passcode "11111111". Used Mingw32 but with warnings :

WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-80-g6c4433a5
Expected to see version: esp32-2019r1
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 5.2.0
Expected to see version(s): 8.2.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.

I can see the image, but no stream:

>>> HomeKit: [Client 55] Get Characteristics
>>> HomeKit: [Client 55] Update Characteristics
>>> HomeKit: [Client 55] Get Characteristics
�[0;32mI (36574) esp32_camera: Creating setup endpoints response�[0m
>>> HomeKit: [Client 55] Update Characteristics
Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x40091e1e  PS      : 0x00060633  A0      : 0x8008ee85  A1      : 0x3ffeb9e0  
A2      : 0xae000000  A3      : 0x0000abab  A4      : 0xb33fffff  A5      : 0x00000001  
A6      : 0x00060620  A7      : 0x0000cdcd  A8      : 0x0000abab  A9      : 0x3ffeb9d0  
A10     : 0x3ffe1150  A11     : 0x00000000  A12     : 0x00000000  A13     : 0x00000000  
A14     : 0x0ccccccc  A15     : 0x00000057  SAR     : 0x00000001  EXCCAUSE: 0x0000001d  
EXCVADDR: 0xae000000  LBEG    : 0x4008fce4  LEND    : 0x4008fcef  LCOUNT  : 0x00000000  

ELF file SHA256: 72220c74427bced1167afde84c2e1c1f714251865ec72db1176668e78b55651f

Backtrace: 0x40091e1e:0x3ffeb9e0 0x4008ee82:0x3ffeba10 0x40084d2d:0x3ffeba30 0x40084d7f:0x3ffeba50 0x4008a98d:0x3ffeba70 0x400d7af5:0x3ffeba90 0x40093101:0x3ffec2e0

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_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:6500
load:0x40078000,len:11356
load:0x40080400,len:6664
entry 0x40080764
�[0;32mI (29) boot: ESP-IDF v4.0-dev-804-g70b2c86ff 2nd stage bootloader�[0m
�[0;32mI (29) boot: compile time 20:35:17�[0m
�[0;32mI (29) boot: Enabling RNG early entropy source...�[0m
�[0;32mI (35) boot: SPI Speed      : 40MHz�[0m
�[0;32mI (39) boot: SPI Mode       : DIO�[0m
�[0;32mI (43) boot: SPI Flash Size : 4MB�[0m
�[0;32mI (47) boot: Partition Table:�[0m
�[0;32mI (51) boot: ## Label            Usage          Type ST Offset   Length�[0m
�[0;32mI (58) boot:  0 nvs              WiFi data        01 02 00009000 00006000�[0m
�[0;32mI (66) boot:  1 phy_init         RF data          01 01 0000f000 00001000�[0m
�[0;32mI (73) boot:  2 factory          factory app      00 00 00010000 001f0000�[0m
�[0;32mI (81) boot: End of partition table�[0m
�[0;32mI (85) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0xb0180 (721280) map�[0m
�[0;32mI (346) esp_image: segment 1: paddr=0x000c01a8 vaddr=0x3ffb0000 size=0x03ba4 ( 15268) load�[0m
�[0;32mI (352) esp_image: segment 2: paddr=0x000c3d54 vaddr=0x40080000 size=0x00400 (  1024) load�[0m
�[0;32mI (353) esp_image: segment 3: paddr=0x000c415c vaddr=0x40080400 size=0x0beb4 ( 48820) load�[0m
�[0;32mI (382) esp_image: segment 4: paddr=0x000d0018 vaddr=0x400d0018 size=0x11de38 (1171000) map�[0m
�[0;32mI (792) esp_image: segment 5: paddr=0x001ede58 vaddr=0x4008c2b4 size=0x0a1e4 ( 41444) load�[0m
�[0;32mI (823) boot: Loaded app from partition at offset 0x10000�[0m
�[0;32mI (823) boot: Disabling RNG early entropy source...�[0m
�[0;32mI (824) psram: This chip is ESP32-D0WD�[0m
�[0;32mI (829) spiram: Found 64MBit SPI RAM device�[0m
�[0;32mI (833) spiram: SPI RAM mode: flash 40m sram 40m�[0m
�[0;32mI (838) spiram: PSRAM initialized, cache is in low/high (2-core) mode.�[0m
�[0;32mI (845) cpu_start: Pro cpu up.�[0m
�[0;32mI (849) cpu_start: Application information:�[0m
�[0;32mI (854) cpu_start: Project name:     esp32-homekit-camera�[0m
�[0;32mI (860) cpu_start: App version:      ab7d9e5�[0m
�[0;32mI (865) cpu_start: Compile time:     Jun 25 2019 20:35:48�[0m
�[0;32mI (871) cpu_start: ELF file SHA256:  72220c74427bced1...�[0m
�[0;32mI (877) cpu_start: ESP-IDF:          v4.0-dev-804-g70b2c86ff�[0m
�[0;32mI (883) cpu_start: Starting app cpu, entry point is 0x40081400�[0m
�[0;32mI (875) cpu_start: App cpu up.�[0m
�[0;32mI (1774) spiram: SPI SRAM memory test OK�[0m
�[0;32mI (1775) heap_init: Initializing. RAM available for dynamic allocation:�[0m
�[0;32mI (1775) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM�[0m
�[0;32mI (1781) heap_init: At 3FFBB9C8 len 00024638 (145 KiB): DRAM�[0m
�[0;32mI (1787) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM�[0m
�[0;32mI (1794) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM�[0m
�[0;32mI (1800) heap_init: At 40096498 len 00009B68 (38 KiB): IRAM�[0m
�[0;32mI (1806) cpu_start: Pro cpu start user code�[0m
�[0;32mI (1811) spiram: Adding pool of 4096K of external SPI memory to heap allocator�[0m
�[0;32mI (1833) cpu_start: Starting scheduler on PRO CPU.�[0m
�[0;32mI (0) cpu_start: Starting scheduler on APP CPU.�[0m
�[0;32mI (1834) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations�[0m
I (1894) wifi: wifi driver task: 3ffcb464, prio:23, stack:3584, core=0
�[0;32mI (1894) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
�[0;32mI (1894) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
I (1924) wifi: wifi firmware version: ec61a20
I (1924) wifi: config NVS flash: enabled
I (1924) wifi: config nano formating: disabled
I (1924) wifi: Init dynamic tx buffer num: 32
I (1934) wifi: Init data frame dynamic rx buffer num: 32
I (1934) wifi: Init management frame dynamic rx buffer num: 32
I (1944) wifi: Init management short buffer num: 32
I (1944) wifi: Init static tx buffer num: 16
I (1954) wifi: Init static rx buffer size: 1600
I (1954) wifi: Init static rx buffer num: 10
I (1954) wifi: Init dynamic rx buffer num: 32
�[0;32mI (2054) phy: phy_version: 4100, 2a5dd04, Jan 23 2019, 21:00:07, 0, 0�[0m
I (2054) wifi: mode : sta (80:7d:3a:b6:e7:08)
STA start
I (2184) wifi: new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:6
I (3314) wifi: state: init -> auth (b0)
I (3334) wifi: state: auth -> assoc (0)
I (3944) wifi: state: assoc -> run (10)
I (4254) wifi: connected with mcpatric, channel 1, bssid = ac:9e:17:7e:06:d8
I (4254) wifi: pm start, type: 1

�[0;32mI (5384) tcpip_adapter: sta ip: 192.168.0.108, mask: 255.255.255.0, gw: 192.168.0.241�[0m
WiFI ready
�[0;32mI (5384) esp32_camera: Free heap: 4365116�[0m
�[0;32mI (5384) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5394) gpio: GPIO[14]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5404) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5504) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5504) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5514) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5524) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5534) gpio: GPIO[21]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5544) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5554) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5564) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5574) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5584) gpio: GPIO[23]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5594) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (5604) camera: Allocating 2 frame buffers (18 KB total)�[0m
�[0;32mI (5604) camera: Allocating 9 KB frame buffer in OnBoard RAM�[0m
�[0;32mI (5614) camera: Allocating 9 KB frame buffer in OnBoard RAM�[0m
>>> HomeKit: Starting server
>>> HomeKit: Using existing accessory ID: 6C:D6:45:DE:B0:3B
>>> HomeKit: Found admin pairing with ECFC5DBD-6E0F-46DF-AA31-792C78DDA628, disabling pair setup
>>> HomeKit: Configuring mDNS
>>> HomeKit: Got new client connection: 55
>>> HomeKit: [Client 55] Pair Verify Step 1/2
>>> HomeKit: [Client 55] Pair Verify Step 2/2
>>> HomeKit: [Client 55] Found pairing with ECFC5DBD-6E0F-46DF-AA31-792C78DDA628
>>> HomeKit: [Client 55] Verification successful, secure session established
>>> HomeKit: [Client 55] Get Accessories
�[0;32mI (15654) esp32_camera: Creating setup endpoints response�[0m
>>> HomeKit: [Client 55] Update Characteristics
>>> HomeKit: [Client 55] Update Characteristics
>>> HomeKit: [Client 55] Update Characteristics
>>> HomeKit: [Client 55] Resource
�[0;32mI (23204) esp32_camera: Resource payload: {"image-width":640,"image-height":480,"resource-type":"image"}�[0m

Increasing snapshot resolution problem

Hi,

According to default camera settings, example sends 640x480 snapshot picture.
I have changed config.h like below and It has sent 320x240 snapshot picture. (I have seen it from log output)

Resolution didn't increase, decrease. I am a little bit confused 😐

#pragma once

// Configuration stuff
#include <esp_camera.h>

#define TAG "esp32_camera"

#define CAMERA_FRAME_RATE 15
#define CAMERA_FRAME_SIZE FRAMESIZE_UXGA
#define CAMERA_WIDTH 1600
#define CAMERA_HEIGHT 1200

// Scale factors to get image for video stream
#define VIDEO_IMAGE_SCALE_NUM 1
#define VIDEO_IMAGE_SCALE_DENOM 8

// Calculated stuff
#define VIDEO_IMAGE_SCALED(x) ((x) * VIDEO_IMAGE_SCALE_NUM / VIDEO_IMAGE_SCALE_DENOM)

#define VIDEO_WIDTH VIDEO_IMAGE_SCALED(CAMERA_WIDTH)
#define VIDEO_HEIGHT VIDEO_IMAGE_SCALED(CAMERA_HEIGHT)

Request: Generated custom name and serial number

Hi!

Is it possible to implement the custom mac address based Name and serial number generation?

void create_accessory_name() {
    //printf("RC > Creating accessory name\n");
    
    uint8_t macaddr[6];
    **system_efuse_read_mac(macaddr);**
    
    char *name_value = malloc(17);
    snprintf(name_value, 17, "Camera-%02X%02X%02X", macaddr[3], macaddr[4], macaddr[5]);
    name.value = HOMEKIT_STRING(name_value);
    
    char *serial_value = malloc(13);
    snprintf(serial_value, 13, "%02X%02X%02X%02X%02X%02X", macaddr[0], macaddr[1], macaddr[2], macaddr[3], macaddr[4], macaddr[5]);
    serial.value = HOMEKIT_STRING(serial_value);
}

Also is system_efuse_read_mac() enough for this purpose? Or Wifi mac needed?

Thanks!

Missing homekit rule

Hello,

I started from scratch to compile:

I got this message:

...
CC build/lwip/port/esp32/debug/lwip_debug.o
AR build/lwip/liblwip.a
make: *** No rule to make target `component-homekit-build', needed by `component-main-build'.  Stop.
Pg1:esp32-homekit-camera <username>$ 

Camera issues on latest idf

Hello, I downloaded the repo (fresh new twice) it compiles and everything, with 2 different boards, and noticed that the only thing I changed lately is the IDF, just wondering if you noticed it, the problem is present with v4 or after august 13

I (3925) esp32_camera: Free heap: 4364644
I (3925) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (3935) gpio: GPIO[14]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
E (3945) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=3
E (3955) camera_xclk: ledc_timer_config failed, rc=ffffffff
I (3965) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
SCCB_Write [ff]=01 failed
SCCB_Write [12]=80 failed
E (4025) camera: Camera probe failed with error 0x20001
E (4025) esp32_camera: Camera init failed with error 0x20001

End of partition table on esp32cam

Hello guys,

So I compiled my code with the options:

 AP or STA (SoftAP)  --->                                                                                          │ │
  │ │                                               (Unknown2) WiFi SSID                                                                                                  │ │
  │ │                                               (12345678) WiFi Password                                                                                              │ │
  │ │                                               (3) Max STA conn                                                                                                      │ │
  │ │                                               (20000000) XCLK Frequency                                                                                             │ │
  │ │                                                   Camera Pins  --->

Under the menu camera pins i selected:
ESP32-CAM by AI-Thinker
Which is this one I believe The code looks to be compiled and then I upload using these configs:

esptool.py --chip esp32 --port /dev/tty.usbserial-A800K5UT --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 build/bootloader/bootloader.bin 0x10000 build/esp32-homekit-camera.bin 0x8000 build/partitions_singleapp.bin

I see the code uploaded correctly but if I connect to the terminal with UART I see this wierd message:
rst:0x3 (SW_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:6444 load:0x40078000,len:11492 load:0x40080400,len:6664 entry 0x40080764 ·[0;32mI (56) boot: ESP-IDF v4.0-dev-1191-g138c941 2nd stage bootloader·[0m ·[0;32mI (56) boot: compile time 04:45:11·[0m ·[0;32mI (57) boot: Enabling RNG early entropy source...·[0m ·[0;32mI (63) boot: SPI Speed : 40MHz·[0m ·[0;32mI (67) boot: SPI Mode : DIO·[0m ·[0;32mI (71) boot: SPI Flash Size : 4MB·[0m ·[0;32mI (75) boot: Partition Table:·[0m ·[0;32mI (79) boot: ## Label Usage Type ST Offset Length·[0m ·[0;32mI (86) boot: 0 nvs WiFi data 01 02 00009000 00006000·[0m ·[0;32mI (94) boot: 1 phy_init RF data 01 01 0000f000 00001000·[0m ·[0;32mI (101) boot: 2 factory factory app 00 00 00010000 00100000·[0m ·[0;32mI (109) boot: End of partition table·[0m ·[0;32mI (113) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0xa6e94 (683668) map·[0m ·[0;32mI (361) esp_image: segment 1: paddr=0x000b6ebc vaddr=0x3ffb0000 size=0x03d98 ( 15768) load·[0m ·[0;32mI (368) esp_image: segment 2: paddr=0x000bac5c vaddr=0x40080000 size=0x00400 ( 1024) load·[0m ·[0;32mI (368) esp_image: segment 3: paddr=0x000bb064 vaddr=0x40080400 size=0x04fac ( 20396) load·[0m ·[0;32mI (385) esp_image: segment 4: paddr=0x000c0018 vaddr=0x400d0018 size=0x101274 (1053300) map·[0m ·¸ets Jun 8 2016 00:22:57

And keeps repeating over and over, anyone knows if the configs should be different?

no camera dection

hi,
i always get
�[0;32mI (6908) esp32_camera: Free heap: 4364880�[0m
�[0;32mI (6908) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;32mI (6918) gpio: GPIO[14]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 �[0m
�[0;31mE (6928) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=3�[0m
�[0;31mE (6938) camera_xclk: ledc_timer_config failed, rc=ffffffff�[0m
�[0;32mI (6948) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
SCCB_Write [ff]=01 failed
SCCB_Write [12]=80 failed
�[0;31mE (7008) camera: Camera probe failed with error 0x20001�[0m
�[0;31mE (7008) esp32_camera: Camera init failed with error 0x20001�[0m

in the home app i can add the cam normaly

i tried every cam pin settings.
and for testing that my hardware is fine i test with this code

https://raw.githubusercontent.com/RuiSantosdotme/ESP32-CAM-Arduino-IDE/master/ESP32-CAM-Video-Streaming/ESP32-CAM-Video-Streaming.ino

and it is working fine and it use the pin setup for a "AI-Thinker"

thx for work work

Not able to compile

Hi Maxim,

After installing your dockers files I was able to compile several modules form your Esp-Homekit-demo git. But I can t figure out how to compile this one? could you help? I tried several options but they all end in errors.

I read in the closed Issue section that you are still working on this project? It would be great If it could work like a door bell (e.g. Ring / https://eu.ring.com), but that aside for now.

I have my hardware ready, I only need to know how to compile this code?
Thank you in advance.

Streaming is it working now?

Sorry, looking at the commits, I saw "live Streaming". Is it working now?
Trying it now I still have on my iPhone "Camera is not responding"

Am I missing something ?

thank you

Compilation error

Mac OS 10.14

In function 'copy', inlined from 'av_lzo1x_decode' at /Users/jmonteiro/Documents/ESP8266HomeKit/esp32-homekit-camera/components/libswscale/libavutil/lzo.c:197:9: /Users/jmonteiro/Documents/ESP8266HomeKit/esp32-homekit-camera/components/libswscale/libavutil/lzo.c:105:5: error: 'memcpy' specified size between 4294967292 and 4294967295 exceeds maximum object size 2147483647 [-Werror=stringop-overflow=] memcpy(dst, src, cnt);

libavutil/avconfig.h not found

Hello,

I cloned esp32-homekit-camera to local directory and I installed the home kit-directory manual.

I used menuconfig to config:

  • Serial flasher config
  • ESP32 Homekit camer: STA, wifi-SSID and wifi password

If I compiled I got this error messages:

App "esp32-homekit-camera" version: 9cf2d13-dirty
CC build/libswscale/libswscale/alphablend.o
In file included from /Users/<username>/esp/esp-idf/components/newlib/include/_ansi.h:16:0,
                 from /Users/<username>/esp/esp-idf/components/newlib/include/stdlib.h:11,
                 from /Users/<username>/esp/esp32-homekit-camera/components/libswscale/libavutil/avassert.h:30,
                 from /Users/<username>/esp/esp32-homekit-camera/components/libswscale/libswscale/swscale_internal.h:27,
                 from /Users/<username>/esp/esp32-homekit-camera/components/libswscale/libswscale/alphablend.c:21:
/Users/<username>/esp/esp-idf/components/newlib/include/sys/config.h:199:0: warning: "HAVE_GETOPT" redefined
 #define HAVE_GETOPT
 ^
In file included from /Users/<username>/esp/esp32-homekit-camera/components/libswscale/libswscale/swscale_internal.h:24:0,
                 from /Users/<username>/esp/esp32-homekit-camera/components/libswscale/libswscale/alphablend.c:21:
/Users/<username>/esp/esp32-homekit-camera/components/libswscale/config.h:282:0: note: this is the location of the previous definition
 #define HAVE_GETOPT 1
 ^
In file included from /Users/<username>/esp/esp32-homekit-camera/components/libswscale/libavutil/avutil.h:296:0,
                 from /Users/<username>/esp/esp32-homekit-camera/components/libswscale/libavutil/avassert.h:31,
                 from /Users/<username>/esp/esp32-homekit-camera/components/libswscale/libswscale/swscale_internal.h:27,
                 from /Users/<username>/esp/esp32-homekit-camera/components/libswscale/libswscale/alphablend.c:21:
/Users/<username>/esp/esp32-homekit-camera/components/libswscale/libavutil/common.h:45:32: fatal error: libavutil/avconfig.h: No such file or directory
compilation terminated.
make[1]: *** [libswscale/alphablend.o] Error 1
make: *** [component-libswscale-build] Error 2
Pg1:esp32-homekit-camera <username>$ 

I didn't find any solution for esp32 at google. Can anyone please help me?

More than 2 on the same network

I noticed something weird, when I have up to 2 cameras, they seem to work just fine, but immediately when I connect the third one the others disconnect, I wonder if they disconnect because the same mdns name

esp32_camera: STA disconnected problem

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:6536
load:0x40078000,len:11320
load:0x40080400,len:7252
entry 0x40080780
�[0;32mI (29) boot: ESP-IDF v3.2.3 2nd stage bootloader�[0m
�[0;32mI (29) boot: compile time 02:44:59�[0m
�[0;32mI (29) boot: Enabling RNG early entropy source...�[0m
�[0;32mI (33) qio_mode: Enabling default flash chip QIO�[0m
�[0;32mI (39) boot: SPI Speed      : 40MHz�[0m
�[0;32mI (43) boot: SPI Mode       : QIO�[0m
�[0;32mI (47) boot: SPI Flash Size : 4MB�[0m
�[0;32mI (51) boot: Partition Table:�[0m
�[0;32mI (54) boot: ## Label            Usage          Type ST Offset   Length�[0m
�[0;32mI (62) boot:  0 nvs              WiFi data        01 02 00009000 00006000�[0m
�[0;32mI (69) boot:  1 phy_init         RF data          01 01 0000f000 00001000�[0m
�[0;32mI (77) boot:  2 factory          factory app      00 00 00010000 00200000�[0m
�[0;32mI (84) boot: End of partition table�[0m
�[0;32mI (88) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0xaaed4 (700116) map�[0m
�[0;32mI (306) esp_image: segment 1: paddr=0x000baefc vaddr=0x3ffb0000 size=0x03d0c ( 15628) load�[0m
�[0;32mI (311) esp_image: segment 2: paddr=0x000bec10 vaddr=0x40080000 size=0x00400 (  1024) load�[0m
�[0;32mI (313) esp_image: segment 3: paddr=0x000bf018 vaddr=0x40080400 size=0x00ff8 (  4088) load�[0m
�[0;32mI (323) esp_image: segment 4: paddr=0x000c0018 vaddr=0x400d0018 size=0x11a36c (1155948) map�[0m
�[0;32mI (675) esp_image: segment 5: paddr=0x001da38c vaddr=0x400813f8 size=0x16d20 ( 93472) load�[0m
�[0;32mI (723) boot: Loaded app from partition at offset 0x10000�[0m
�[0;32mI (723) boot: Disabling RNG early entropy source...�[0m
�[0;32mI (724) psram: This chip is ESP32-D0WD�[0m
�[0;32mI (729) spiram: Found 64MBit SPI RAM device�[0m
�[0;32mI (733) spiram: SPI RAM mode: flash 40m sram 40m�[0m
�[0;32mI (738) spiram: PSRAM initialized, cache is in low/high (2-core) mode.�[0m
�[0;32mI (745) cpu_start: Pro cpu up.�[0m
�[0;32mI (749) cpu_start: Starting app cpu, entry point is 0x40081448�[0m
�[0;32mI (0) cpu_start: App cpu up.�[0m
�[0;32mI (1639) spiram: SPI SRAM memory test OK�[0m
�[0;32mI (1639) heap_init: Initializing. RAM available for dynamic allocation:�[0m
�[0;32mI (1640) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM�[0m
�[0;32mI (1646) heap_init: At 3FFBBB88 len 00024478 (145 KiB): DRAM�[0m
�[0;32mI (1652) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM�[0m
�[0;32mI (1659) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM�[0m
�[0;32mI (1665) heap_init: At 40098118 len 00007EE8 (31 KiB): IRAM�[0m
�[0;32mI (1671) cpu_start: Pro cpu start user code�[0m
�[0;32mI (1676) spiram: Adding pool of 4096K of external SPI memory to heap allocator�[0m
�[0;32mI (19) cpu_start: Starting scheduler on PRO CPU.�[0m
�[0;32mI (0) cpu_start: Starting scheduler on APP CPU.�[0m
�[0;32mI (20) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations�[0m
I (90) wifi: wifi driver task: 3ffcaeb8, prio:23, stack:3584, core=0
�[0;32mI (90) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
�[0;32mI (90) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
I (120) wifi: wifi firmware version: 7997e4b
I (120) wifi: config NVS flash: enabled
I (120) wifi: config nano formating: disabled
I (120) wifi: Init dynamic tx buffer num: 32
I (130) wifi: Init data frame dynamic rx buffer num: 32
I (130) wifi: Init management frame dynamic rx buffer num: 32
I (140) wifi: Init management short buffer num: 32
I (140) wifi: Init static tx buffer num: 16
I (150) wifi: Init static rx buffer size: 1600
I (150) wifi: Init static rx buffer num: 10
I (150) wifi: Init dynamic rx buffer num: 32

Brownout detector was triggered

ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_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:6536
load:0x40078000,len:11320
load:0x40080400,len:7252
entry 0x40080780
�[0;32mI (29) boot: ESP-IDF v3.2.3 2nd stage bootloader�[0m
�[0;32mI (29) boot: compile time 02:44:59�[0m
�[0;32mI (29) boot: Enabling RNG early entropy source...�[0m
�[0;32mI (34) qio_mode: Enabling default flash chip QIO�[0m
�[0;32mI (39) boot: SPI Speed      : 40MHz�[0m
�[0;32mI (43) boot: SPI Mode       : QIO�[0m
�[0;32mI (47) boot: SPI Flash Size : 4MB�[0m
�[0;32mI (51) boot: Partition Table:�[0m
�[0;32mI (55) boot: ## Label            Usage          Type ST Offset   Length�[0m
�[0;32mI (62) boot:  0 nvs              WiFi data        01 02 00009000 00006000�[0m
�[0;32mI (69) boot:  1 phy_init         RF data          01 01 0000f000 00001000�[0m
�[0;32mI (77) boot:  2 factory          factory app      00 00 00010000 00200000�[0m
�[0;32mI (84) boot: End of partition table�[0m
�[0;32mI (89) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0xaaed4 (700116) map�[0m
�[0;32mI (306) esp_image: segment 1: paddr=0x000baefc vaddr=0x3ffb0000 size=0x03d0c ( 15628) load�[0m
�[0;32mI (312) esp_image: segment 2: paddr=0x000bec10 vaddr=0x40080000 size=0x00400 (  1024) load�[0m
�[0;32mI (313) esp_image: segment 3: paddr=0x000bf018 vaddr=0x40080400 size=0x00ff8 (  4088) load�[0m
�[0;32mI (323) esp_image: segment 4: paddr=0x000c0018 vaddr=0x400d0018 size=0x11a36c (1155948) map�[0m
�[0;32mI (675) esp_image: segment 5: paddr=0x001da38c vaddr=0x400813f8 size=0x16d20 ( 93472) load�[0m
�[0;32mI (723) boot: Loaded app from partition at offset 0x10000�[0m
�[0;32mI (723) boot: Disabling RNG early entropy source...�[0m
�[0;32mI (724) psram: This chip is ESP32-D0WD�[0m
�[0;32mI (729) spiram: Found 64MBit SPI RAM device�[0m
�[0;32mI (733) spiram: SPI RAM mode: flash 40m sram 40m�[0m
�[0;32mI (738) spiram: PSRAM initialized, cache is in low/high (2-core) mode.�[0m
�[0;32mI (745) cpu_start: Pro cpu up.�[0m
�[0;32mI (749) cpu_start: Starting app cpu, entry point is 0x40081448�[0m
�[0;32mI (741) cpu_start: App cpu up.�[0m
�[0;32mI (1639) spiram: SPI SRAM memory test OK�[0m
�[0;32mI (1640) heap_init: Initializing. RAM available for dynamic allocation:�[0m
�[0;32mI (1640) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM�[0m
�[0;32mI (1646) heap_init: At 3FFBBB88 len 00024478 (145 KiB): DRAM�[0m
�[0;32mI (1653) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM�[0m
�[0;32mI (1659) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM�[0m
�[0;32mI (1666) heap_init: At 40098118 len 00007EE8 (31 KiB): IRAM�[0m
�[0;32mI (1672) cpu_start: Pro cpu start user code�[0m
�[0;32mI (1677) spiram: Adding pool of 4096K of external SPI memory to heap allocator�[0m
�[0;32mI (20) cpu_start: Starting scheduler on PRO CPU.�[0m
�[0;32mI (0) cpu_start: Starting scheduler on APP CPU.�[0m
�[0;32mI (21) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations�[0m
I (91) wifi: wifi driver task: 3ffcaeb8, prio:23, stack:3584, core=0
�[0;32mI (91) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
�[0;32mI (91) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
I (121) wifi: wifi firmware version: 7997e4b
I (121) wifi: config NVS flash: enabled
I (121) wifi: config nano formating: disabled
I (121) wifi: Init dynamic tx buffer num: 32
I (131) wifi: Init data frame dynamic rx buffer num: 32
I (131) wifi: Init management frame dynamic rx buffer num: 32
I (141) wifi: Init management short buffer num: 32
I (141) wifi: Init static tx buffer num: 16
I (151) wifi: Init static rx buffer size: 1600
I (151) wifi: Init static rx buffer num: 10
I (151) wifi: Init dynamic rx buffer num: 32
�[0;32mI (221) phy: phy_version: 4009, e7844c0, Jul 15 2019, 13:20:06, 0, 0�[0m
I (221) wifi: mode : sta (24:6f:28:96:13:c0)
�[0;32mI (221) esp32_camera: STA start�[0m
�[0;32mI (2271) esp32_camera: STA disconnected�[0m
�[0;32mI (4321) esp32_camera: STA disconnected�[0m
�[0;32mI (6371) esp32_camera: STA disconnected�[0m
�[0;32mI (8421) esp32_camera: STA disconnected�[0m
�[0;32mI (10471) esp32_camera: STA disconnected�[0m
�[0;32mI (12521) esp32_camera: STA disconnected�[0m
�[0;32mI (14571) esp32_camera: STA disconnected�[0m
�[0;32mI (16621) esp32_camera: STA disconnected�[0m

Now, I have this issue. Could you share your make menuconfig configurations (all configurations)

How to apply patch

Hi,

When I try to apply your patch file, I have got that output.

okanduzyel@MacBook-Pro esp32-homekit-camera % patch < esp32-camera.patch 
can't find file to patch at input line 5
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/driver/xclk.c b/driver/xclk.c
|index 89ced66..21db2fc 100755
|--- a/driver/xclk.c
|+++ b/driver/xclk.c
--------------------------
File to patch: 

Could you show me How I can apply that patch?

Compiling error

Hi maxim,

I installed esp idf tools correctly and then, I can erase or flash esp32. I tried hello_world example of espif, it works.

However, when I compile your esp32-homekit-camera example, I got that error:

error: incompatible type for argument 1 of 'camera_accessory_set_ip_address'
camera_accessory_set_ip_address(event->event_info.got_ip.ip_info.ip);

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /home/vagrant/esp-homekit-demo/examples/esp32-homekit-camera/main/app_main.c:14:
/home/vagrant/esp-homekit-demo/examples/esp32-homekit-camera/main/accessory.h:7:49: note: expected 'ip4_addr_t' {aka 'struct ip4_addr'} but argument is of type 'esp_ip4_addr_t' {aka 'struct esp_ip4_addr'}
void camera_accessory_set_ip_address(ip4_addr_t ip);

Could you check it please?

ESP-IDF 4.x without Patch

Hello Maxim,

today I started from scratch and download esp32-homekit-camera. Every time I reboot I have to enter many parameters and with ESP-IDF 4.x I have to run the patch.

Here is a solution without Patch. The file "*/driver/xclk.c" has to be changed:

//Add
#include <string.h>

//Add after this block:
timer_conf.duty_resolution = 2;
timer_conf.freq_hz = config->xclk_freq_hz;
timer_conf.speed_mode = LEDC_HIGH_SPEED_MODE;
timer_conf.timer_num = config->ledc_timer;
//New
if ( strstr( esp_get_idf_version(), "v4.") ) {
   timer_conf.clk_cfg = LEDC_USE_APB_CLK;
}

homekit encoding of video attributes

Current code
tlv_add_integer_value(video_attributes, 3, 2, CAMERA_FRAME_RATE); // Frame rate

Apple spec specifies length as 1, not 2

Frame rate | 3 | 1 | Maximum frame rate

ALSO:
tlv_add_integer_value(audio_codec, 1, 1, 3);
Spec length says 2, not 1

Crash using defined CAMERA_WIDTH and CAMERA_HEIGHT

Hi, using the predefines values in config.h I experimented crash in camera initialization:

Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x40094b8e  PS      : 0x00060533  A0      : 0x8008eda8  A1      : 0x3ffc9c30  
0x40094b8e: uxPortCompareSet at /root/esp/esp-idf/components/freertos/include/freertos/portmacro.h:356
 (inlined by) vPortCPUAcquireMutexIntsDisabledInternal at /root/esp/esp-idf/components/freertos/portmux_impl.inc.h:86
 (inlined by) vPortCPUAcquireMutexIntsDisabled at /root/esp/esp-idf/components/freertos/portmux_impl.h:99
 (inlined by) vTaskEnterCritical at /root/esp/esp-idf/components/freertos/tasks.c:4201

A2      : 0xef000000  A3      : 0x00000001  A4      : 0x00060520  A5      : 0x0000cdcd  
A6      : 0xb33fffff  A7      : 0x0000abab  A8      : 0x0000cdcd  A9      : 0x3ffc98c0  
A10     : 0x00000001  A11     : 0x00000000  A12     : 0x3ffcaa5c  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x00000003  SAR     : 0x00000004  EXCCAUSE: 0x0000001d  
EXCVADDR: 0xef000000  LBEG    : 0x4008d50c  LEND    : 0x4008d517  LCOUNT  : 0x00000000  
0x4008d50c: memset at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/memset.S:133

0x4008d517: memset at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/memset.S:143


ELF file SHA256: 1a9724246109fbfb34eb1a949e08b13d0640941cf68dd18450cf429716d1ef9b

Backtrace: 0x40094b8b:0x3ffc9c30 0x4008eda5:0x3ffc9c60 0x400847c5:0x3ffc9c80 0x40084813:0x3ffc9ca0 0x4009306e:0x3ffc9cc0 0x40093090:0x3ffc9ce0 0x401611ef:0x3ffc9d00 0x40161a04:0x3ffc9d30 0x40161cfd:0x3ffc9d60 0x400d7586:0x3ffc9d90 0x400d67b7:0x3ffc9e30 0x400d67fc:0x3ffc9e50 0x401635a5:0x3ffc9e70 0x401f93ef:0x3ffc9e90 0x401f8f89:0x3ffc9ec0 0x401f9059:0x3ffc9f00 0x40093e39:0x3ffc9f20
0x40094b8b: uxPortCompareSet at /root/esp/esp-idf/components/freertos/include/freertos/portmacro.h:356
 (inlined by) vPortCPUAcquireMutexIntsDisabledInternal at /root/esp/esp-idf/components/freertos/portmux_impl.inc.h:86
 (inlined by) vPortCPUAcquireMutexIntsDisabled at /root/esp/esp-idf/components/freertos/portmux_impl.h:99
 (inlined by) vTaskEnterCritical at /root/esp/esp-idf/components/freertos/tasks.c:4201

0x4008eda5: multi_heap_internal_lock at /root/esp/esp-idf/components/heap/multi_heap.c:375
 (inlined by) multi_heap_malloc_impl at /root/esp/esp-idf/components/heap/multi_heap.c:416

0x400847c5: heap_caps_malloc at /root/esp/esp-idf/components/heap/heap_caps.c:111

0x40084813: heap_caps_malloc_default at /root/esp/esp-idf/components/heap/heap_caps.c:146

0x4009306e: _calloc_r at /root/esp/esp-idf/components/newlib/heap.c:73

0x40093090: calloc at /root/esp/esp-idf/components/newlib/heap.c:37

0x401611ef: camera_fb_init at /root/workspace/esp32-homekit-camera/components/esp32-camera/driver/camera.c:241

0x40161a04: camera_init at /root/workspace/esp32-homekit-camera/components/esp32-camera/driver/camera.c:1159

0x40161cfd: esp_camera_init at /root/workspace/esp32-homekit-camera/components/esp32-camera/driver/camera.c:1268

0x400d7586: camera_accessory_init at /root/workspace/esp32-homekit-camera/main/accessory.c:742

0x400d67b7: on_wifi_ready at /root/workspace/esp32-homekit-camera/main/app_main.c:18

0x400d67fc: event_handler at /root/workspace/esp32-homekit-camera/main/app_main.c:31 (discriminator 9)

0x401635a5: esp_event_post_to_user at /root/esp/esp-idf/components/esp_event/event_loop_legacy.c:34

0x401f93ef: handler_execute at /root/esp/esp-idf/components/esp_event/esp_event.c:145

0x401f8f89: esp_event_loop_run at /root/esp/esp-idf/components/esp_event/esp_event.c:545 (discriminator 3)

0x401f9059: esp_event_loop_run_task at /root/esp/esp-idf/components/esp_event/esp_event.c:115

0x40093e39: vPortTaskWrapper at /root/esp/esp-idf/components/freertos/port.c:143

I changed config.h with these values:

define CAMERA_FRAME_RATE 30
//#define CAMERA_FRAME_SIZE FRAMESIZE_VGA
#define CAMERA_FRAME_SIZE FRAMESIZE_QVGA

//#define CAMERA_WIDTH 640
//#define CAMERA_HEIGHT 480
#define CAMERA_WIDTH 320
#define CAMERA_HEIGHT 240

// #define VIDEO_WIDTH 160
// #define VIDEO_HEIGHT 120
#define VIDEO_WIDTH 80
#define VIDEO_HEIGHT 60

and changed also file accessory.c at line 755 and 756 disabling the comment on:

    tlv_add_integer_value(video_attributes, 1, 2, CAMERA_WIDTH);  // Image width
    tlv_add_integer_value(video_attributes, 2, 2, CAMERA_HEIGHT);  // Image height
//    tlv_add_integer_value(video_attributes, 1, 2, 640);  // Image width
//    tlv_add_integer_value(video_attributes, 2, 2, 480);  // Image height
    tlv_add_integer_value(video_attributes, 3, 1, CAMERA_FRAME_RATE);  // Frame rate

now the camera is working.
Is it ok or I missed something ?

Compilation homekit-build

Hello Max,

I downloaded the code, setup my environment and got stuck in this issue:
I make: *** No rule to make target 'component-homekit-build', needed by 'component-main-build'. Stop.

I will look in your code base to see if something is missing but I notice it might be missing something.

Cheers!

homekit qrcode

I modified the password and setupId in homekit_server_config,and re-generate the qrcode, but when I scan the qrcode by iphone homekit app, it prompt the device has already added, like "配件已添加"
I just bind the sample qrcode before and deleted the device. what should I do to bind the esp-eye with a new homekit qrcode?
Thanks!

M5Stack Fish-Eyes CameraF ov2640

Hello,

It does not seem to work on the M5Stack Fish-Eyes CameraF https://m5stack.com/products/fish-eye-camera-module-ov2640.
Do not enable AP mode for connection!

Does anyone have any tips?

make monitor
Toolchain path: /root/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a
Compiler version: 5.2.0
Python requirements from /root/esp/esp-idf/requirements.txt are satisfied.
MONITOR
--- idf_monitor on /dev/ttyUSB0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x33 (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:6124
load:0x40078000,len:10180
load:0x40080400,len:6660
entry 0x40080764
I (29) boot: ESP-IDF v3.2.2 2nd stage bootloader
I (29) boot: compile time 01:26:36
I (31) boot: Enabling RNG early entropy source...
I (33) boot: SPI Speed : 40MHz
I (38) boot: SPI Mode : DIO
I (42) boot: SPI Flash Size : 4MB
I (46) boot: Partition Table:
I (49) boot: ## Label Usage Type ST Offset Length
I (56) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (64) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (71) boot: 2 factory factory app 00 00 00010000 001f0000
I (79) boot: End of partition table
I (83) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0xa8ce4 (691428) map
I (334) esp_image: segment 1: paddr=0x000b8d0c vaddr=0x3ffb0000 size=0x03bec ( 15340) load
I (340) esp_image: segment 2: paddr=0x000bc900 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _WindowOverflow4 at /root/esp/esp-idf/components/freertos/xtensa_vectors.S:1779

I (341) esp_image: segment 3: paddr=0x000bcd08 vaddr=0x40080400 size=0x03308 ( 13064) load
I (355) esp_image: segment 4: paddr=0x000c0018 vaddr=0x400d0018 size=0x118368 (1147752) map
0x400d0018: _stext at ??:?

I (761) esp_image: segment 5: paddr=0x001d8388 vaddr=0x40083708 size=0x131e8 ( 78312) load
0x40083708: psram_cmd_recv_start at /root/esp/esp-idf/components/esp32/spiram_psram.c:273 (discriminator 5)

I (807) boot: Loaded app from partition at offset 0x10000
I (807) boot: Disabling RNG early entropy source...
I (809) spiram: Found 32MBit SPI RAM device
I (812) spiram: SPI RAM mode: flash 40m sram 40m
I (817) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (824) cpu_start: Pro cpu up.
I (828) cpu_start: Starting app cpu, entry point is 0x4008138c
0x4008138c: call_start_cpu1 at /root/esp/esp-idf/components/esp32/cpu_start.c:246

I (0) cpu_start: App cpu up.
I (1729) spiram: SPI SRAM memory test OK
I (1729) heap_init: Initializing. RAM available for dynamic allocation:
I (1730) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1736) heap_init: At 3FFBBA18 len 000245E8 (145 KiB): DRAM
I (1742) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1748) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1755) heap_init: At 400968F0 len 00009710 (37 KiB): IRAM
I (1761) cpu_start: Pro cpu start user code
I (1766) spiram: Adding pool of 4096K of external SPI memory to heap allocator
I (110) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (111) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (201) wifi: wifi driver task: 3ffcb5ec, prio:23, stack:3584, core=0
I (201) wifi: wifi firmware version: 693c7b6
I (201) wifi: config NVS flash: enabled
I (211) wifi: config nano formating: disabled
I (211) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (221) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (251) wifi: Init dynamic tx buffer num: 32
I (251) wifi: Init data frame dynamic rx buffer num: 32
I (251) wifi: Init management frame dynamic rx buffer num: 32
I (261) wifi: Init management short buffer num: 32
I (261) wifi: Init static tx buffer num: 16
I (271) wifi: Init static rx buffer size: 1600
I (271) wifi: Init static rx buffer num: 10
I (271) wifi: Init dynamic rx buffer num: 32
I (351) phy: phy_version: 4008, 544f89f, Jan 24 2019, 14:54:06, 0, 0
I (351) wifi: mode : sta (b4:e6:2d:a4:4f:f5)
STA start
STA disconnected
STA disconnected
STA disconnected
STA disconnected
STA disconnected
STA disconnected
STA disconnected
STA disconnected
STA disconnected
STA disconnected
STA disconnected

Faster snapshot rate

Hey there,

I read that video streaming does not currently work #17 #20 and is deprioritized #22.
At the current state, the camera makes a snapshot every 10 seconds. Is there a way to make the delay shorter, so the snapshot rate would be let's say 1 snapshot per second?
Tried to look it up myself in the code, but didn't find anything I would feel confident changing.

Thanks for the answer!

cmake compilation

this is more a question for suggestion, somehow I couldnt compile the code with my standard toolchain so, I setup a fresh brand new toolchain from the latest available and noticed that it won't support Makefile any more (I think) and it now asks for the new CMakelists.txt, do you have a suggestion if there is a tool that could help me recreate the CMake?

:) greetings!

Error trying to stream

Hi, great job!
I've tried everything and nothing works ... when I open the stream it is showing the following log and nothing to send and image.

I (389809) esp32_camera: Total free memory: 1669020
>>> HomeKit: [Client 55] Update Characteristics
I (391209) esp32_camera: Encoding a frame
I (391209) esp32_camera: Total free memory: 1668980
E (391919) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (391919) task_wdt:  - IDLE1 (CPU 1)
E (391919) task_wdt: Tasks currently running:
E (391919) task_wdt: CPU 0: IDLE0
E (391919) task_wdt: CPU 1: Camera Stream
I (392619) esp32_camera: Encoding a frame
I (392619) esp32_camera: Total free memory: 1668988
I (393989) esp32_camera: Encoding a frame
I (393989) esp32_camera: Total free memory: 1668988

Thank you.

How To

Hi, thanks for this firmware.
I have a question, how I can flash it?
Thanks in advance!

Feature requests

During waiting for my ordered esp32 I have some ideas:

  1. On first setup a wifi hotspot running on esp32 to connect via PC directly to show a webpage to enter SSID and passwort of router,(which will be saved, maybe on SD card if not possible in flash), then the esp32 (maybe with a reboot) will connect to home wifi
  2. after connecting to wifi, the cam is reachable via webinterface to see the qr-code for scanning and connecting to homekit. Maybe the possibility to enter the password (eg 123-45-678) on webinterface which is stored on SD if not possible in flash
  3. saving of images on SD card on motion detection

M5Camera's

Hello,
there are some challenges with M5Camera's. There are the models

  • M5Camera (A Model and B Model)
  • M5CameraF
  • M5CameraX (A Model and B Model)

The different between A model an B model are the camera pins SCCB Data and vertical sync.
I like to expand the KConfig and the camera.h file:

config CAMERA_MODEL_ESP_EYE
    bool "ESP_EYE DevKit"
config CAMERA_MODEL_M5_B
    bool "M5Camera+M5CameraX+M5CameraF Model B"
config CAMERA_MODEL_M5_A
    bool "M5Camera+M5CameraX Model A"
config CAMERA_MODEL_AI_THINKER
    bool "ESP32-CAM by AI-Thinker"
#elif CONFIG_CAMERA_MODEL_M5_B
#define CAMERA_PIN_PWDN     -1
#define CAMERA_PIN_RESET    15
#define CAMERA_PIN_SIOD     22
#define CAMERA_PIN_SIOC     23
#define CAMERA_PIN_XCLK     27

#define CAMERA_PIN_D0       32
#define CAMERA_PIN_D1       35
#define CAMERA_PIN_D2       34
#define CAMERA_PIN_D3        5
#define CAMERA_PIN_D4       39
#define CAMERA_PIN_D5       18
#define CAMERA_PIN_D6       36
#define CAMERA_PIN_D7       19
#define CAMERA_PIN_VSYNC    25
#define CAMERA_PIN_HREF     26
#define CAMERA_PIN_PCLK     21

#elif CONFIG_CAMERA_MODEL_M5_A
#define CAMERA_PIN_PWDN     -1
#define CAMERA_PIN_RESET    15
#define CAMERA_PIN_SIOD       25
#define CAMERA_PIN_SIOC     23
#define CAMERA_PIN_XCLK     27

#define CAMERA_PIN_D0       32
#define CAMERA_PIN_D1       35
#define CAMERA_PIN_D2       34
#define CAMERA_PIN_D3        5
#define CAMERA_PIN_D4       39
#define CAMERA_PIN_D5       18
#define CAMERA_PIN_D6       36
#define CAMERA_PIN_D7       19
#define CAMERA_PIN_VSYNC      22
#define CAMERA_PIN_HREF     26
#define CAMERA_PIN_PCLK     21

In addition it would be nice if the LED-pin could be set in config.h and not separately in Kconfig.

The little different at the M5Camera's and the separately LED configuration cost me hours.

Compiling error on macOS

Hi,

I have got that error on three different ubuntu machine: #47

So, I tried to compile it on macOS. Now, I have got that error:

/Users/okanduzyel/esp/esp32-homekit-camera/components/esp32-camera/driver/xclk.c: In function 'camera_enable_out_clock':
/Users/okanduzyel/esp/esp32-homekit-camera/components/esp32-camera/driver/xclk.c:36:12: error: 'ledc_channel_config_t {aka struct <anonymous>}' has no member named 'hpoint'
     ch_conf.hpoint = 0;
            ^
make[1]: *** [driver/xclk.o] Error 1
make: *** [component-esp32-camera-build] Error 2

malloc error

Hello Maxim,
I did this:

If I started esp32-homekit-camera it connected to LAN and showed the image. Perfect!
If I touch the picture to get the stream I got an malloc error. Is this at this time of your development correct?

I (34003) esp32_camera: Resource payload: {"image-width":640,"image-height":480,"resource-type":"image"}
>>> HomeKit: [Client 57] Update Characteristics
>>> HomeKit: [Client 58] Get Characteristics
>>> HomeKit: [Client 58] Update Characteristics
>>> HomeKit: [Client 58] Get Characteristics
I (39553) esp32_camera: Creating setup endpoints response
>>> HomeKit: [Client 58] Update Characteristics
I (39633) esp32_camera: Initializing encoder
I (39633) esp32_camera: Total free memory: 131696
I (39633) esp32_camera: Largest free block: 113804
x264 [info]: using cpu capabilities: none!
x264 [error]: malloc of size 4098 failed
Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.

HomeKit: Failed to write accessory ID to flash

Hello Maxim,
I'm testing this board: ESP32-CAM
https://loboris.eu/ESP32/ESP32-CAM%20Product%20Specification.pdf

I edit esp-idf/components/partition_table/partitions_singleapp.csv with
factory, app, factory, , 2M, from 0x1F0000

I'm getting this error:

make -C esp32-homekit-camera/ monitor
make: ingresso nella directory "/home/pi/Camera/esp32-homekit-camera"
Toolchain path: /home/pi/esp32-elf/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a
Compiler version: 5.2.0
Python requirements from /home/pi/esp-idf/requirements.txt are satisfied.
MONITOR
--- idf_monitor on /dev/ttyUSB0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
I (804) wifi: new:<3,0>, old:<1,0>, ap:<255,255>, sta:<3,0>, prof:1
I (1784) wifi: state: init -> auth (b0)
I (2784) wifi: state: auth -> init (200)
I (2784) wifi: new:<3,0>, old:<3,0>, ap:<255,255>, sta:<3,0>, prof:1
STA disconnected
STA disconnected
I (4964) wifi: new:<3,0>, old:<3,0>, ap:<255,255>, sta:<3,0>, prof:1
I (4964) wifi: state: init -> auth (b0)
I (4964) wifi: state: auth -> assoc (0)
I (4984) wifi: state: assoc -> run (10)
I (6004) wifi: connected with MYWIFI-12345678, channel 3, bssid = xx:xx:xx:xx:xx:xx
I (6004) wifi: pm start, type: 1

I (14214) event: sta ip: 192.168.1.11, mask: 255.255.255.0, gw: 192.168.1.1
WiFI ready
I (14214) esp32_camera: Free heap: 230784
I (14214) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14224) gpio: GPIO[14]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14234) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (14334) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14334) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14344) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14354) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14364) gpio: GPIO[21]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14374) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14384) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14394) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14404) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14414) gpio: GPIO[23]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14414) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (14434) camera: Allocating 2 frame buffers (75 KB total)
I (14434) camera: Allocating 37 KB frame buffer in OnBoard RAM
I (14444) camera: Allocating 37 KB frame buffer in OnBoard RAM
E (14444) gpio: gpio_install_isr_service(394): GPIO isr service already installed

HomeKit: Starting server
HomeKit: Formatting flash at 0x200000
!!! HomeKit: Failed to erase flash
HomeKit: Generated new accessory ID: DA:C5:53:9F:E0:E2
!!! HomeKit: Failed to write accessory ID to flash
HomeKit: Generated new accessory key
!!! HomeKit: Failed to write accessory key to flash
HomeKit: Configuring mDNS
HomeKit: Got new client connection: 55
HomeKit: [Client 55] Pair Setup Step 1/3
HomeKit: [Client 55] Pair Setup Step 2/3
HomeKit: [Client 55] Pair Setup Step 3/3
!!! HomeKit: Failed to write pairing info to flash
!!! HomeKit: [Client 55] Failed to store pairing (code -1)
HomeKit: [Client 55] Closing client connection

Thanks for your reply

Homekit

Hello,
the new link */component/homekit directory showed error 404 and didn‘t work.

Compilation error

I don't understand why I get these errors?

/Users/kristiandimitrov/esp/esp32-homekit-camera/components/homekit/src/storage.c: In function 'homekit_storage_init':
/Users/kristiandimitrov/esp/esp32-homekit-camera/components/homekit/src/storage.c:56:38: error: argument to 'sizeof' in 'strncpy' call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
strncpy(magic, magic1, sizeof(magic1));
^
In file included from /Users/kristiandimitrov/esp/esp32-homekit-camera/components/homekit/src/storage.c:6:
/Users/kristiandimitrov/esp/esp32-homekit-camera/components/homekit/src/storage.c: In function 'homekit_storage_can_add_pairing':
/Users/kristiandimitrov/esp/esp32-homekit-camera/components/homekit/src/port.h:20:85: warning: value computed is not used [-Wunused-value]
#define spiflash_read(addr, buffer, size) (spi_flash_read((addr), (buffer), (size)) == ESP_OK)

camera/components/homekit/src/storage.c:233:39: error: argument to 'sizeof' in 'strncpy' call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
strncpy(data.magic, magic1, sizeof(magic1));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.