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

    IoT M5Cam Project - problems porting code

    SOFTWARE
    2
    4
    6.8k
    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.
    • M
      MartaRho
      last edited by

      Dear all,

      I am trying to use a M5Cam as an IoT system. Long story short: I want to regularly take pictures, connect to a WiFi connection and upload them to a cloud service (in this case Google Cloud Storage, but any other sort of system would work). I found some github repo doing exactly what I need to do, but when trying to adapt it to my board, it crashes with the following error:

      E (489) spiram: Expected 8192KiB chip but found 4096KiB chip. Bailing out..

      I tried everything to force the board to recognise the 4Mb PSRAM:

      ESP32-specific

      CONFIG_ESP32_DEFAULT_CPU_FREQ_80=
      CONFIG_ESP32_DEFAULT_CPU_FREQ_160=
      CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
      CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240
      CONFIG_SPIRAM_SUPPORT=y

      SPI RAM config

      CONFIG_SPIRAM_BOOT_INIT=y
      CONFIG_SPIRAM_IGNORE_NOTFOUND=
      CONFIG_SPIRAM_USE_MEMMAP=
      CONFIG_SPIRAM_USE_CAPS_ALLOC=y
      CONFIG_SPIRAM_USE_MALLOC=
      CONFIG_SPIRAM_TYPE_AUTO=y
      CONFIG_SPIRAM_TYPE_ESPPSRAM32=
      CONFIG_SPIRAM_TYPE_ESPPSRAM64=
      CONFIG_SPIRAM_SIZE=-1
      CONFIG_SPIRAM_SPEED_40M=
      CONFIG_SPIRAM_SPEED_80M=y
      CONFIG_SPIRAM_MEMTEST=y
      CONFIG_SPIRAM_CACHE_WORKAROUND=y
      CONFIG_SPIRAM_BANKSWITCH_ENABLE=y
      CONFIG_SPIRAM_BANKSWITCH_RESERVE=8
      CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST=
      CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=

      Any ideas? I am a total noob with esp32 coding and so, but I would appreciate any help :) Also, if you happend to have some other example code I can take on, please share!

      Original Code:
      https://github.com/raphaelbs/esp32-cam-ai-thinker/tree/master/examples/google_storage

      1 Reply Last reply Reply Quote 0
      • H
        heybin
        last edited by

        please choose psram size to 4MB0_1559292247701_bcc73ad7-e101-43f8-b252-3361553b63a6-image.png

        1 Reply Last reply Reply Quote 0
        • M
          MartaRho
          last edited by MartaRho

          Thanks @heybin ! That worked well (and it was surprisingly easy :) )

          Now I gotta fix some new problems...

          Stack smashing protect failure!

          abort() was called at PC 0x400d645d on core 0
          0x400d645d: __stack_chk_fail at /home/marta/esp/esp-idf/components/esp_common/src/stack_check.c:36

          Edit: Nevermind, i just needed to change the stack protection level from overall to normal. :)

          1 Reply Last reply Reply Quote 0
          • M
            MartaRho
            last edited by

            Guess what? I hit another wall.

            It seems the camera is giving trouble, despite me configuring the pins as here:
            here

            E (218) camera: Camera probe failed with error 0x20001
            ESP_ERROR_CHECK failed: esp_err_t 0x20001 (ERROR) at 0x4008a228
            0x4008a228: _esp_error_check_failed at /home/marta/esp/esp-idf/components/esp32/panic.c:721

            file: "/home/marta/Arduino/esp32-cam-ai-thinker/examples/google_storage/main/main.c" line 195
            func: app_main
            expression: esp_camera_init(&camera_config)

            config XCLK_FREQ
              int "XCLK Frequency"
              default "20000000"
              help
                  The XCLK Frequency in Herz.
            
            menu "Pin Configuration"
                config D0
                    int "D0"
                    default "32"
                config D1
                    int "D1"
                    default "35"
                config D2
                    int "D2"
                    default "34"
                config D3
                    int "D3"
                    default "5"
                config D4
                    int "D4"
                    default "39"
                config D5
                    int "D5"
                    default "18"
                config D6
                    int "D6"
                    default "36"
                config D7
                    int "D7"
                    default "19"
                config XCLK
                    int "XCLK"
                    default "27"
                config PCLK
                    int "PCLK"
                    default "21"
                config VSYNC
                    int "VSYNC"
                    default "25"
                config HREF
                    int "HREF"
                    default "26"
                config SDA
                    int "SDA"
                    default "4"
                config SCL
                    int "SCL"
                    default "13"
                config RESET
                    int "RESET"
                    default "15"
            endmenu
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post