🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

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

    Units
    2
    11
    14.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • sohtameiS
      sohtamei
      last edited by sohtamei

      [Symptom]

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

      [procedure]

      1. burn firmware (customized CameraWebServer)
        https://sohta02.sakura.ne.jp/tukurutch/
        [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
        0_1634369229977_3b26e6af-442e-41ae-8185-72ec8341114b-image.png

      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]
      https://github.com/sohtamei/TuKuRutch.ext/tree/master/libraries/unitCam
      https://github.com/sohtamei/TuKuRutch.ext/tree/master/arduinoLib/TukurutchEspCamera

      1 Reply Last reply Reply Quote 0
      • sohtameiS
        sohtamei
        last edited by

        [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.

        0_1634370931477_ac92bf82-d067-4778-aac9-631cbdd146f0-image.png

        1 Reply Last reply Reply Quote 0
        • sohtameiS
          sohtamei
          last edited by

          "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;

          1 Reply Last reply Reply Quote 0
          • sohtameiS
            sohtamei
            last edited by sohtamei

            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

            0_1634387186741_DSC05548.JPG

            1 Reply Last reply Reply Quote 0
            • sohtameiS
              sohtamei
              last edited by sohtamei

              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:
              http://sohta02.web.fc2.com/images/esp32CameraWebServerIssue.mp4

              I tried following ESP32 devices:
              0_1635223861922_DSC05557.JPG

              The result was following:

              • Max duration and average of "Get Still" for 20~30 cycles [ms]
                0_1635223924489_7072086f-e1a9-4011-bd0e-5dc8fdd01043-image.png
              1 Reply Last reply Reply Quote 0
              • sohtameiS
                sohtamei
                last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • sohtameiS
                  sohtamei
                  last edited by

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

                  [procedure]

                  1. burn firmware (customized CameraWebServer)
                    https://sohta02.sakura.ne.jp/tukurutch/
                    [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
                    0_1635225178938_553e2140-1cc5-4012-8fd7-7c869381492c-image.png
                    I attach source code of this firmware:
                    http://sohta02.web.fc2.com/images/testCamWifi.zip

                  sohtameiS 1 Reply Last reply Reply Quote 0
                  • sohtameiS
                    sohtamei @sohtamei
                    last edited by sohtamei

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

                    FW:

                    1. burn firmware (customized CameraWebServer)
                      https://sohta02.sakura.ne.jp/tukurutch/
                      [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):
                    https://sohtamei.github.io/docs/ESP32CameraIssue.html

                    1 Reply Last reply Reply Quote 0
                    • V
                      Valter Fukuoka
                      last edited by

                      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:

                      [error]
                      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
                      22/NOV/2021
                      Nagoya City

                      1 Reply Last reply Reply Quote 0
                      • V
                        Valter Fukuoka
                        last edited by Valter Fukuoka

                        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:
                        https://github.com/espressif/esp32-camera/issues/334

                        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...

                        Regards,
                        Valter Fukuoka
                        23/NOV/2021
                        Nagoya City

                        1 Reply Last reply Reply Quote 0
                        • V
                          Valter Fukuoka
                          last edited by

                          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:
                          https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html

                          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...

                          Regards,
                          Valter

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post