[UNITCAM][HW issue?] cannot stream video.

  • [Symptom]

    • cannot stream video.
    • transferring image is very slow (8~20sec)


    1. burn firmware (customized CameraWebServer)
      [Add extension]
      -- [M5Camera,ESP32cam,..]
      -- pulldown [burn (M5Camera)] to UnitCam
      -- click [burn (UnitCam)]

    2. enter SSID and pass to [connect ssid ..] and click it.

    3. click [Wifi Status] and get IP address

    4. connect to UnitCam with Console App(such as TeraTerm) via Uart port.

    5. access to IP address of step3 from chrome browser, then push [GetStill].

    The transfer rate is displayed on Uart-Console. It's very slow and cannot stream video.
    JPG: 17035B 1787ms
    JPG: 17147B 10267ms
    JPG: 17179B 8910ms
    JPG: 17180B 17621ms

    [source code]

  • [guess of root cause]
    with ESP32-CAM, which has similar schematics with UnitCam, I can stream video with CameraWebServer.
    The differences between UnitCam and ESP32-CAM are port assignment and camera powers.

    • DOVDD and AVDD are not separated.

    I cannot try PCB-rework for UnitCam, so I'm not sure whether separation of DOVDD-AVDD is root cause. But there may be some HW issue on UnitCam PCB.


  • "Transferring image is very slow" is occurred by PCB design, PCB layout and xclk_freq condition, but I could not fix this issue with xclk=5000000 (lowest?) condition.
    config.xclk_freq_hz = 5000000;
    // config.xclk_freq_hz = 10000000;
    // config.xclk_freq_hz = 20000000;

  • I found better solution.
    I tried PCB-rework - cut between DOVDD and 2.8V, then connect DOVDD to 3V.
    The transfer rate of Image has been improved, and I succeeded in streaming Video.
    JPG: 17013B 407ms
    JPG: 17258B 331ms
    JPG: 17133B 170ms
    JPG: 17062B 154ms
    JPG: 17090B 164ms


  • I found the route cause of this issue - XCLK=20MHz of ESP32 makes WIFI-through-rate slow. This issue can be reproduced without ov2640. I prepared dummy network camera firmware, which can run dummy streaming, and can turn on/off XCLK with "AWB" slide bar. Please see following video:

    I tried following ESP32 devices:

    The result was following:

    • Max duration and average of "Get Still" for 20~30 cycles [ms]

  • According to above result,

    • chip-ESP32 is better than WROOM-32x.
    • "aitendo" PCB is good.

    The "reworked" unitCam is No.4, the result was not bad, but not enough.

  • Please try my test firmware for this issue. You can try it with any ESP32 device, with&without camera device.


    1. burn firmware (customized CameraWebServer)
      [Add extension]
      -- [M5Camera,ESP32cam,..]
      -- pulldown [burn (M5Camera)] to "testXclockIssue"
      -- click [burn (testXclockIssue)]

    2. enter SSID and pass to [connect ssid ..] and click it.

    3. click [Wifi Status] and get IP address
      I attach source code of this firmware:

  • I fixed this issue with XCLK=8MHz and x2 clock on ov2640 side.
    Master clock of 5/10/20MHz by ESP32 reduces Wifi throughput.


    1. burn firmware (customized CameraWebServer)
      [Add extension]
      -- [M5Camera,ESP32cam,..]
      -- pulldown [burn (M5Camera)] to "unitCam"
      -- click [burn (unitCam)]

    2. enter SSID and pass to [connect ssid ..] and click it.

    3. click [Wifi Status] and get IP address

    4. access to IP address via web Browser

    Report(in Japanese):

  • Hi Sohta-san, thanks for sharing all the stuff related with UNITCAM.

    I got one from Marutsu (Digikey?) and I am trying to make it work with Arduino IDE Framework.
    What I want is a Wifi Access Point with images served by HTTP...

    I am having trouble to make it work...
    ESP32 chip seems to be OK, wifi, webserver, etc, working...
    My problem is the camera unit initialization...

    I have downloaded some ESP32 Camera related code online and trying to adapt then to UNITCAM (pins config), including Arduino Example "CameraWebServer" , but, so far NO SUCCESS...

    This is the error I am getting when executing samples:

    E (127) cam_hal: cam_dma_config(280): frame buffer malloc failed
    E (127) cam_hal: cam_config(364): cam_dma_config failed
    E (127) camera: Camera config failed with error 0xffffffff
    Camera init failed with error 0xffffffff 

    [My question here]
    I am going to place a question/post related with my problem, but, before doing so, I like to ask you if you have had success with a pure Arduino IDE Code, or success with pure ESP-IDE Code, to capture image from the camera?
    Do you have any such sample on the net?

    [Question about Tukuruch]
    Can I run online version (from Linux machine), create/copy an application and save the binary file to my computer, and then, manually upload to the UnitCam?
    I went there on the URL but I could not find this info there...

    Thank you very much,
    Valter Fukuoka
    Nagoya City

  • Update on my above post/question...

    I found what the problem is, also was able to get it working.

    The problem is related with PSRAM, because a bug introduced this year (2021) into the "esp32-camera" stack, which causes the code to ALWAYS TRY TO ALLOCATE BUFFER INTO THE PSRAM area, even if the hardware does not have it, or even if you SWITCH OFF PSRAM IN CODE before compiling (ESP-IDF menuconfig)...

    Here is the issue on github:

    Going back to the code at 2021/FEB/22, I was able to download (esp32-camera) and compile a sample capture with success, using ESP-IDF...

    So, the Arduino IDE, understandably is using the latest code, which have the bug...
    I don't know how to "roll back" the code for Arduino, I will take look at it...

    FINALLY, LONG HOURS to, at least, see some code working... nice...

    I will compile as much as possible info about my "journey" and publish it, so that, may others can benefit from the infos...

    Valter Fukuoka
    Nagoya City

  • Old versions of ESP32-Arduino on Arduino IDE...

    Yes, it is possible and it is EASY!

    Following the official guide showing how to install the current version:

    The only change needed is to download a diffent/old version of the code...

    I did a test going back to 2021/FEB/23, and it WORKS!

    Besides this bug being just a temporary stuff, I will document better how to use old versions of code, for IDF and for Arduino IDE, because there are probably MANY situations in which we would like to use/test different versions other than the current version...