UNITCAM: IDF, use many versions of code!



  • Hi, this post is a follow up from a previous post on the subject of using UnitCam with ESP-IDF Programming Framework, in relation to a bug which is found in the current version (2021/NOVEMBER) of the "esp32-camera" library, that causes error in camera devices without PSRAM, including the M5Stack UNITCAM.

    To prevent the error, the user can download older versions of the code (esp32-camera), where the bug was not present (in the code).
    For example, going back to 2021/FEBRUARY, the "esp32-camera" source code runs without any problem on UNITCAM (also on any other device without PSRAM).

    This post details how to download older versions of the code, and "install" it on your IDF project.

    Step 1: create a folder called "components" inside your project folder.

    The following is a example folder for an ESP-IDF Project:

    myCamProject/
    ├── main/
    ├── CMakeLists.txt
    ├── Makefile
    └── sdkconfig.defaults
    

    What we need to do is to create a folder "components" inside it.

    myCamProject/
    ├── components/
    ├── main/
    ├── CMakeLists.txt
    ├── Makefile
    └── sdkconfig.defaults
    

    This project will be using the "esp32-camera", as a component, so we need to get the "esp32-camera" code and place it (copy) inside this "component" folder that we just created...

    Step 2: download older (any) version of the code.

    It is now very common for programmers as individuals and organizations to use GitHub to host (place) the source code of projects (anyone can do it), as in the case of Espressif and the Project "esp32-camera".

    Here is the URL of the Project "esp32-camera":
    [https://github.com/espressif/esp32-camera]

    If we want to download a current version (latest), just click on the green button and choose "Download ZIP"...

    [base picture]
    0_1638244931025_base-url.png

    On GitHub, when code changes are made, then tested, and there is an understanding that the changes are working, a COMMIT is made.
    The COMMIT is a commitment which is made to changes in the code, it is like an equivalent of saying 'the code now has changes and it is OK to use'...
    GitHub allow us to see/download the code at every COMMIT that was made, meaning, the code you are downloading at a particular COMMIT is the code in the state that it WAS at the time of the COMMIT.

    We can see a list of COMMITS on the following URL,
    [https://github.com/espressif/esp32-camera/commits/master]

    Or, by clicking over the "nn commits", as the pictures shows:
    [base with commits-click picture]
    0_1638244994721_base-commit-url.png

    We can see a list of dates with its commits, going back in time...

    [commits picture]
    0_1638245022125_commits-url.png

    After trying to compile with the latest (current) version and FAIL, I went back to JULY, download and IT ALSO FAIL!
    Then, I went way back to FEB/23, tested it and IT WORK OK!

    Step 3: unpack/extract and copy all the extracted content to the folder "components", that we created in the step 1.

    After download, extract and copy, looking inside the "components" folder, we have something like the following:

    myCamProject/components/
    ├── conversions/
    ├── driver/
    ├── examples/
    ├── sensors/
    ├── CMakeLists.txt
    ├── component.mk*
    ├── idf_component.yml
    ├── Kconfig*
    ├── library.json
    ├── LICENSE
    └── README.md
    

    All Done:
    At this point you can build (config, compile) your project and upload to the M5Stack UNITCAM device.

    The example code (sample) used is from inside the "esp32-camera" project.
    I just added definitions to ov2640 M5Stack-UNITCAM, and added 2021-FEB-23 version (commit) of the camera library...

    After compiling and uploading to M5Stack UNITCAM and running, we can get the following message on the serial interface:

    I (564) camera: Detected OV2640 camera
    I (564) camera: Allocating 1 frame buffers (9 KB total)
    I (565) camera: Allocating 9 KB frame buffer in OnBoard RAM
    I (655) example:take_picture: Taking picture...
    I (678) example:take_picture: Picture taken! Its size was: 9600 bytes
    I (5678) example:take_picture: Taking picture...
    I (5696) example:take_picture: Picture taken! Its size was: 9600 bytes
    I (10696) example:take_picture: Taking picture...
    I (10714) example:take_picture: Picture taken! Its size was: 9600 bytes
    ...
    

    About the Development System:

    RaspberryPI 4 / 4GB RAM

    LINUX KERNEL (32Bit):
    Linux raspberrypi 5.10.63-v7l+ #1459 SMP Wed Oct 6 16:41:57 BST 2021 armv7l GNU/Linux

    OS NAME="Raspbian GNU/Linux"
    OS VERSION="10 (buster)"

    ESP-IDF Version v4.3.1

    Camera Component used (2021/FEB/23 COMMIT):
    esp32-camera-770f26a704ddbe9e92a35023e0949e7898db46b5.zip

    On a separated post I will explain the procedures in the case of Arduino IDE Framework...

    Hope this help,
    Valter
    2021/NOV/30
    Japan



  • I was unable to upload the sample in zip format, there is a message like "not have privileges to this action"...

    I will upload this sample as well as another with Arduino IDE to GitHub and will place the link here...
    Valter



  • Just to clarify better the model of device I am talking/doing here...

    0_1638598872863_IMG_20211204_142601.jpg

    0_1638598917160_IMG_20211204_142627.jpg

    Valter