Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow Webinterface on Hardware rev. 3 -> Most likely hardware issue #2298

Closed
lterfloth opened this issue Apr 8, 2023 · 71 comments
Closed

Slow Webinterface on Hardware rev. 3 -> Most likely hardware issue #2298

lterfloth opened this issue Apr 8, 2023 · 71 comments

Comments

@lterfloth
Copy link

lterfloth commented Apr 8, 2023

The Problem

I can answer all questions with "yes". The PSRAM is ESP PSRAM64H 462021 / 1B00286, it's an ESP32CAM Module("diymore ESP32 CAM Entwicklungsplatine, WLAN/Bluetooth, ESP32 DC 5V Dual-Core-Entwicklungsplatine mit 2640 Kamera-TF-Karten-Modul").

I use a 16GB SD Card. I flash using the webinstaller & Chrome. I tried holding IO0 and not holding it while flashing. I tried two units, both have the same issues (I bought a two pack).

What happens:
Flashing works fine, but the web interface is stupidly slow. The ESP is beside my Macbook so it can't be the AP signal. I tried uploading remote.zip which most of the time does not work fails after a while. I attached a log file.
I also tried manually uploading the config to the SD card. That got me a step further, yet the webinterface gets unresponsive when creating a reference image using the pre-configured SD card.

Version

15.1.1

Logfile

ets Jul 29 2019 12:21:46

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:0x3fff0030,len:7664
load:0x40078000,len:15360
load:0x40080400,len:3744
entry 0x4008067c
I (27) boot: ESP-IDF 4.3.2 2nd stage bootloader
I (27) boot: compile time 20:02:47
I (27) boot: chip revision: 3
I (30) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (37) boot.esp32: SPI Speed      : 40MHz
I (42) boot.esp32: SPI Mode       : DIO
I (46) boot.esp32: SPI Flash Size : 4MB
I (51) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (60) boot: ## Label            Usage          Type ST Offset   Length
I (67) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (75) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (82) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (89) boot:  3 ota_0            OTA app          00 10 00010000 001db000
I (97) boot:  4 ota_1            OTA app          00 11 001f0000 001db000
I (104) boot: End of partition table
I (109) boot_comm: chip revision: 3, min. application chip revision: 0
I (116) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=3cbfch (248828) map
I (220) esp_image: segment 1: paddr=0004cc24 vaddr=3ffb0000 size=033f4h ( 13300) load
I (225) esp_image: segment 2: paddr=00050020 vaddr=400d0020 size=1498c0h (1349824) map
I (742) esp_image: segment 3: paddr=001998e8 vaddr=3ffb33f4 size=00648h (  1608) load
I (743) esp_image: segment 4: paddr=00199f38 vaddr=40080000 size=1a948h (108872) load
I (795) esp_image: segment 5: paddr=001b4888 vaddr=50000000 size=00010h (    16) load
I (808) boot: Loaded app from partition at offset 0x10000
I (808) boot: Disabling RNG early entropy source...
I (820) psram: This chip is ESP32-D0WD
I (821) spiram: Found 64MBit SPI RAM device
I (821) spiram: SPI RAM mode: flash 40m sram 40m
I (823) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (829) cpu_start: Pro cpu up.
I (832) cpu_start: Starting app cpu, entry point is 0x40083690
I (0) cpu_start: App cpu up.
I (1727) spiram: SPI SRAM memory test OK
I (1735) cpu_start: Pro cpu start user code
I (1735) cpu_start: cpu freq: 160000000
I (1735) cpu_start: Application information:
I (1736) cpu_start: Project name:     AI-on-the-edge
I (1740) cpu_start: App version:      v15.1.1
I (1744) cpu_start: Compile time:     Mar 23 2023 20:41:06
I (1750) cpu_start: ELF file SHA256:  235e90efb0cfa001...
I (1755) cpu_start: ESP-IDF:          4.4.2
I (1759) heap_init: Initializing. RAM available for dynamic allocation:
I (1765) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1770) heap_init: At 3FFC0058 len 0001FFA8 (127 KiB): DRAM
I (1775) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1781) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1787) heap_init: At 4009A948 len 000056B8 (21 KiB): IRAM
I (1792) spiram: Adding pool of 4095K of external SPI memory to heap allocator
I (1800) spi_flash: detected chip: generic
I (1803) spi_flash: flash io: dio
I (1817) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (1819) spiram: Reserving pool of 40K of internal memory for DMA/internal allocations
I (1819) MAIN: 



================ Start app_main =================
I (1829) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (3839) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 
I (3839) cam_hal: cam init ok
I (3839) sccb: pin_sda 26 pin_scl 27
I (3839) sccb: sccb_i2c_port=1

I (3839) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (3879) camera: Detected camera at address=0x30
I (3879) camera: Detected OV2640 camera
I (3879) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
I (3969) cam_hal: buffer_size: 32768, half_buffer_size: 4096, node_buffer_size: 2048, node_cnt: 16, total_cnt: 15
I (3969) cam_hal: Allocating 61440 Byte frame buffer in PSRAM
I (3969) cam_hal: cam config ok
I (3969) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8
I (6139) MAIN: =================================================
I (6149) MAIN: ==================== Start ======================
I (6149) MAIN: =================================================
I (6159) SDCARD: Basic R/W check started...
I (6189) SDCARD: Basic R/W check successful
E (6199) MAIN: Config file seems to be missing!
W (6209) SNTP: No ConfigFile defined - exit setupTime()!
W (6219) MAIN: No ConfigFile defined - exit setCpuFrequency()!
I (6229) OTA: Start CheckOTAUpdateCheck...
I (6239) OTA: SHA-256 for the partition table: : 9d4a2809ae90fb20709a8ca3dd3ac3462e1e73286bcd31b689060c91de06fa3a
I (6259) OTA: SHA-256 for bootloader: : 4a9573dafac5d5c79c43e5a356568332da3a99dd2e220da6ceeadc96d32708a2
I (6709) OTA: SHA-256 for current firmware: : 5772cccc5ee66af5b395bb59c0d48837119e41d36733676a2f0133cc1da3401b
W (6749) WIFI AP: config.ini not found!
W (6749) WIFI AP: wlan.ini not found!
I (6749) WIFI AP: Starting access point for remote configuration
I (6759) wifi:wifi driver task: 3ffd4ccc, prio:23, stack:6144, core=0
I (6759) system_api: Base MAC address is not set
I (6759) system_api: read default base MAC address from EFUSE
I (6769) wifi:wifi firmware version: eeaa27d
I (6769) wifi:wifi certification version: v7.0
I (6769) wifi:config NVS flash: enabled
I (6779) wifi:config nano formating: enabled
I (6779) wifi:Init data frame dynamic rx buffer num: 16
I (6779) wifi:Init management frame dynamic rx buffer num: 16
I (6789) wifi:Init management short buffer num: 32
I (6789) wifi:Init static tx buffer num: 16
I (6799) wifi:Init tx cache buffer num: 16
I (6799) wifi:Init static rx buffer size: 1600
I (6809) wifi:Init static rx buffer num: 10
I (6809) wifi:Init dynamic rx buffer num: 16
I (6819) wifi_init: rx ba win: 6
I (6819) wifi_init: tcpip mbox: 32
I (6819) wifi_init: udp mbox: 6
I (6819) wifi_init: tcp mbox: 6
I (6829) wifi_init: tcp tx win: 5744
I (6829) wifi_init: tcp rx win: 5744
I (6829) wifi_init: tcp mss: 1440
I (6839) wifi_init: WiFi IRAM OP enabled
I (6839) wifi_init: WiFi RX IRAM OP enabled
I (6849) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (6949) wifi:mode : softAP (e0:5a:1b:a7:32:41)
I (6949) wifi:Total power save buffer number: 8
I (6949) wifi:Init max length of beacon: 752/752
I (6949) wifi:Init max length of beacon: 752/752
I (6959) WIFI AP: started with SSID "AI-on-the-Edge", password: "", channel: 11. Connect to AP and open http://192.168.4.1
I (16999) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<255,255>, prof:11
I (16999) wifi:station: f8:4d:89:87:17:af join, AID=1, bgn, 20
I (16999) WIFI AP: station f8:4d:89:87:17:af join, AID=1
I (17179) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2
W (17359) wifi:<ba-add>idx:2 (ifx:1, f8:4d:89:87:17:af), tid:0, ssn:0, winSize:64
W (17889) wifi:<ba-add>idx:3 (ifx:1, f8:4d:89:87:17:af), tid:1, ssn:0, winSize:64
W (18269) wifi:<ba-add>idx:4 (ifx:1, f8:4d:89:87:17:af), tid:6, ssn:0, winSize:64
W (18369) wifi:token mismatch, expect=2
I (18519) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2
W (90759) wifi:<ba-add>idx:5 (ifx:1, f8:4d:89:87:17:af), tid:5, ssn:0, winSize:64
ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x12 (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:0x3fff0030,len:7664
load:0x40078000,len:15360
load:0x40080400,len:3744
entry 0x4008067c
I (27) boot: ESP-IDF 4.3.2 2nd stage bootloader
I (27) boot: compile time 20:02:47
I (27) boot: chip revision: 3
I (30) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (37) boot.esp32: SPI Speed      : 40MHz
I (42) boot.esp32: SPI Mode       : DIO
I (46) boot.esp32: SPI Flash Size : 4MB
I (51) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (60) boot: ## Label            Usage          Type ST Offset   Length
I (67) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (75) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (82) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (89) boot:  3 ota_0            OTA app          00 10 00010000 001db000
I (97) boot:  4 ota_1            OTA app          00 11 001f0000 001db000
I (104) boot: End of partition table
I (109) boot_comm: chip revision: 3, min. application chip revision: 0
I (116) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=3cbfch (248828) map
I (220) esp_image: segment 1: paddr=0004cc24 vaddr=3ffb0000 size=033f4h ( 13300) load
I (225) esp_image: segment 2: paddr=00050020 vaddr=400d0020 size=1498c0h (1349824) map
I (742) esp_image: segment 3: paddr=001998e8 vaddr=3ffb33f4 size=00648h (  1608) load
I (743) esp_image: segment 4: paddr=00199f38 vaddr=40080000 size=1a948h (108872) load
I (795) esp_image: segment 5: paddr=001b4888 vaddr=50000000 size=00010h (    16) load
I (808) boot: Loaded app from partition at offset 0x10000
I (808) boot: Disabling RNG early entropy source...
I (820) psram: This chip is ESP32-D0WD
I (821) spiram: Found 64MBit SPI RAM device
I (821) spiram: SPI RAM mode: flash 40m sram 40m
I (823) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (829) cpu_start: Pro cpu up.
I (832) cpu_start: Starting app cpu, entry point is 0x40083690
I (0) cpu_start: App cpu up.
I (1727) spiram: SPI SRAM memory test OK
I (1735) cpu_start: Pro cpu start user code
I (1735) cpu_start: cpu freq: 160000000
I (1735) cpu_start: Application information:
I (1736) cpu_start: Project name:     AI-on-the-edge
I (1740) cpu_start: App version:      v15.1.1
I (1744) cpu_start: Compile time:     Mar 23 2023 20:41:06
I (1750) cpu_start: ELF file SHA256:  235e90efb0cfa001...
I (1755) cpu_start: ESP-IDF:          4.4.2
I (1759) heap_init: Initializing. RAM available for dynamic allocation:
I (1765) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1770) heap_init: At 3FFC0058 len 0001FFA8 (127 KiB): DRAM
I (1776) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1781) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1787) heap_init: At 4009A948 len 000056B8 (21 KiB): IRAM
I (1792) spiram: Adding pool of 4095K of external SPI memory to heap allocator
I (1800) spi_flash: detected chip: generic
I (1803) spi_flash: flash io: dio
I (1817) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (1819) spiram: Reserving pool of 40K of internal memory for DMA/internal allocations
I (1819) MAIN: 



================ Start app_main =================
I (1829) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (3839) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 
I (3839) cam_hal: cam init ok
I (3839) sccb: pin_sda 26 pin_scl 27
I (3839) sccb: sccb_i2c_port=1

I (3839) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (3879) camera: Detected camera at address=0x30
I (3879) camera: Detected OV2640 camera
I (3879) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
I (3969) cam_hal: buffer_size: 32768, half_buffer_size: 4096, node_buffer_size: 2048, node_cnt: 16, total_cnt: 15
I (3969) cam_hal: Allocating 61440 Byte frame buffer in PSRAM
I (3969) cam_hal: cam config ok
I (3969) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8
I (6139) MAIN: =================================================
I (6149) MAIN: ==================== Start ======================
I (6149) MAIN: =================================================
I (6159) SDCARD: Basic R/W check started...
I (6189) SDCARD: Basic R/W check successful
E (6199) MAIN: Config file seems to be missing!
W (6209) SNTP: No ConfigFile defined - exit setupTime()!
W (6209) MAIN: No ConfigFile defined - exit setCpuFrequency()!
I (6219) OTA: Start CheckOTAUpdateCheck...
I (6239) OTA: SHA-256 for the partition table: : 9d4a2809ae90fb20709a8ca3dd3ac3462e1e73286bcd31b689060c91de06fa3a
I (6259) OTA: SHA-256 for bootloader: : 4a9573dafac5d5c79c43e5a356568332da3a99dd2e220da6ceeadc96d32708a2
I (6699) OTA: SHA-256 for current firmware: : 5772cccc5ee66af5b395bb59c0d48837119e41d36733676a2f0133cc1da3401b
W (6739) WIFI AP: config.ini not found!
W (6739) WIFI AP: wlan.ini not found!
I (6739) WIFI AP: Starting access point for remote configuration
I (6749) wifi:wifi driver task: 3ffd4ccc, prio:23, stack:6144, core=0
I (6749) system_api: Base MAC address is not set
I (6749) system_api: read default base MAC address from EFUSE
I (6759) wifi:wifi firmware version: eeaa27d
I (6759) wifi:wifi certification version: v7.0
I (6759) wifi:config NVS flash: enabled
I (6769) wifi:config nano formating: enabled
I (6769) wifi:Init data frame dynamic rx buffer num: 16
I (6779) wifi:Init management frame dynamic rx buffer num: 16
I (6779) wifi:Init management short buffer num: 32
I (6789) wifi:Init static tx buffer num: 16
I (6789) wifi:Init tx cache buffer num: 16
I (6789) wifi:Init static rx buffer size: 1600
I (6799) wifi:Init static rx buffer num: 10
I (6799) wifi:Init dynamic rx buffer num: 16
I (6809) wifi_init: rx ba win: 6
I (6809) wifi_init: tcpip mbox: 32
I (6809) wifi_init: udp mbox: 6
I (6819) wifi_init: tcp mbox: 6
I (6819) wifi_init: tcp tx win: 5744
I (6819) wifi_init: tcp rx win: 5744
I (6819) wifi_init: tcp mss: 1440
I (6829) wifi_init: WiFi IRAM OP enabled
I (6829) wifi_init: WiFi RX IRAM OP enabled
I (6839) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (6939) wifi:mode : softAP (e0:5a:1b:a7:32:41)
I (6939) wifi:Total power save buffer number: 8
I (6939) wifi:Init max length of beacon: 752/752
I (6939) wifi:Init max length of beacon: 752/752
I (6949) WIFI AP: started with SSID "AI-on-the-Edge", password: "", channel: 11. Connect to AP and open http://192.168.4.1
E (7649) wifi:addba response cb: ap bss deleted
I (30339) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<255,255>, prof:11
I (30339) wifi:station: f8:4d:89:87:17:af join, AID=1, bgn, 20
I (30339) WIFI AP: station f8:4d:89:87:17:af join, AID=1
W (30429) wifi:<ba-add>idx:3 (ifx:1, f8:4d:89:87:17:af), tid:0, ssn:0, winSize:64
W (30519) wifi:<ba-add>idx:4 (ifx:1, f8:4d:89:87:17:af), tid:6, ssn:0, winSize:64
I (30539) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2

Expected Behavior

No response

Screenshots

No response

Additional Context

No response

@lterfloth lterfloth added the bug Something isn't working label Apr 8, 2023
@HolBaum5
Copy link

HolBaum5 commented Apr 9, 2023

Sounds like a similar problem to the one I am having.
#2184

@caco3
Copy link
Collaborator

caco3 commented Apr 11, 2023

There is somebody also who has performance issues on a rev3 hardware, see #2301

Maybe this is related...

@lterfloth
Copy link
Author

I improved stability, at least temporarly. It took me over 4 hours to configure everything, as the interface was stupidly slow and crashed regularly. Found the option to push the clock frequency to 240 which helped tremendously with performance ... until I rebooted once. Had almost 50% packetloss before and latency was always >250ms with spikes up to 10s. After switching clock frequency it ran at around 150ms on average with spikes going to 400ms. Now, after reboot, it got subjectively worse again. Sadly I do not have any more time to check today.

@lterfloth lterfloth reopened this Apr 11, 2023
@nikolak
Copy link

nikolak commented Apr 12, 2023

Unfortunately, don't have any further technical information - I bought 4 of them, and it seems like all 4 have the same issues. This is also not limited to HTTP interface, but also MQTT, JSON API, and just in general awful performance.

A few things I've noticed:

  • WiFi signal quality, channel, or even an entirely different AP, don't seem to make a difference.
  • The reported CPU temperature seems very high (55-65 C) constantly, although looking at that other linked issue, this may be an unreliable data point.
  • It has moments, albeit very rarely, where the performance seems a bit better for very short periods.
  • Looking at the dev console requests would often time out or return incomplete data before returning everything, this leaves UI in a state that isn't showing any data, and never will, so a refresh is required.
  • Going to expert settings and changing the CPU Frequency from 160MHz to 240MHz instantly improves the performance by like a factor of thousand. I'm not exaggerating when I say it goes from feeling like browsing on an unreliable dial-up connection with 80% packet loss to browsing with a full gigabit fiber connection.
  • Increasing the CPU frequency does not seem to have an impact on the CPU temperature itself (again, not sure how reliable this is).
  • The performance after rebooting is inconsistent, out of the two devices I have running at the moment, they overall have much better performance even after reboot but sometimes after reboot the performance will be better than when I changed the setting for the first time, and sometimes worse. But overall still major improvement over how it was before changing the frequency.
    • According to logs the 240MHz frequency is set, so not sure why it's inconsistent.

The chip is v3 revision, from logs:

[MAIN] PSRAM size: 8388608 byte (8MB / 64MBit)
[MAIN] Total heap: 4175502 byte
[MAIN] Camera info: PID: 0x26, VER: 0x42, MIDL: 0x7f, MIDH: 0xa2
[MAIN] Device info: CPU cores: 2, Chip revision: 3
[MAIN] SD card info: Name: , Capacity: 3840MB, Free: 3826MB

The ESP has been purchased from https://www.berrybase.de/esp32-cam-development-board-inkl.-ov2640-kameramodul

@lterfloth
Copy link
Author

lterfloth commented Apr 12, 2023

Unfortunately, don't have any further technical information - I bought 4 of them, and it seems like all 4 have the same issues. This is also not limited to HTTP interface, but also MQTT, JSON API, and just in general awful performance.

A few things I've noticed:
[...]

That covers basically everything I experienced yesterday afternoon/night. I tested two different manufacturers too, one had 8mb of PSRAM and one “just” 4. No difference whatsoever. Blowing (yeah, sounds weird) on the chip to cool it down did not improve packet loss or ping times (at least not within 30 seconds, I guess no temperature problems). My guess would be that it has to do with Chip rev 3, and it seems not to be able to cope with the computational demands AI on the edge has. Which is odd, shouldn't a rev3 always perform at least similar or better than other versions?

As I was able to finish configuration (took hours, literally), my unit ran throughout the night, and I connected it to home assistant. Over the course of 8 hours and an update interval of 10 minutes (I doubled the default for less strain on the unit), only about 10 updates were received but also 20 warnings that the unit was not available. So, probably packet loss, again.
Anyway, I hope that some dev can dig into this. I'd donate a couple of bucks if that could speed up finding the bug (hopefully it is a bug and not a rev 3 limitation :-( )

@caco3
Copy link
Collaborator

caco3 commented Apr 12, 2023

Thank you both for the analysis you did.

One thing we could try to do is to update the Expressif platform (IDF). We still are on an older one. maybe they had some silicon bugs in rev3 which require a newer IDF.

2 months ago i started to migrate for this but it was not as easy as thought, some functions are no longer available.
Nevertheless, you you give https://github.com/jomjol/AI-on-the-edge-device/actions/runs/4152463509 a try?
It will not run stable, the time in the log will always be 0, also external LEDs will not work. But it should be sufficient to see if the web UI performs better.

Make sure to do a backup beforehand!

@lterfloth
Copy link
Author

lterfloth commented Apr 12, 2023

Will try that out as soon as I'm back home. The second unit is not used for anything currently, therefore testing is nbd. Thanks for the hint!

Maybe this doc gives some insights, too? Especially "Impact on Customer Projects". Just a long shot, though: https://www.espressif.com/sites/default/files/documentation/ESP32_ECO_V3_User_Guide__EN.pdf

@caco3
Copy link
Collaborator

caco3 commented Apr 12, 2023

According to that document, not much has changed.
Also, the first version of that document was in January 2020, so over 3 years ago. it is unlikely that you two are the first who get a rev3 chip using AIOTED!

@lterfloth
Copy link
Author

lterfloth commented Apr 12, 2023

Will try that out as soon as I'm back home. The second unit is not used for anything currently, therefore testing is nbd. Thanks for the hint!

Maybe this doc gives some insights, too? Especially "Impact on Customer Projects". Just a long shot, though: https://www.espressif.com/sites/default/files/documentation/ESP32_ECO_V3_User_Guide__EN.pdf

I got to try it out. WebUI seems to be responding quite well for the OTA-Upload part (not sure how that is called). Uploading the remote.zip, which did not work before whatsoever! Ping times were below 10ms for some pings, never seen that before. The initial setup is way more responsive, too. NO packetloss whatsoever. Ping times go up a little, but stay around 50-250 sitting 1m from the router. When interacitng with the setup dialogue, it does load every here and there. Never had a packet drop though!

216 packets transmitted, 216 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 5.029/155.057/884.124/138.759 ms

My initital feeling: updating the IDF/migrating to Platformio 6.x.x fixes this issue!

@penapena
Copy link

Thank you both for the analysis you did.

One thing we could try to do is to update the Expressif platform (IDF). We still are on an older one. maybe they had some silicon bugs in rev3 which require a newer IDF.

2 months ago i started to migrate for this but it was not as easy as thought, some functions are no longer available. Nevertheless, you you give https://github.com/jomjol/AI-on-the-edge-device/actions/runs/4152463509 a try? It will not run stable, the time in the log will always be 0, also external LEDs will not work. But it should be sufficient to see if the web UI performs better.

Make sure to do a backup beforehand!

I tried this on my rev3 and it first appeared to be performing better, but no. Just as slow as with the stable version.

@lterfloth
Copy link
Author

@penapena did you do a fresh install and completely wipe the sd card as well?

@penapena
Copy link

@penapena did you do a fresh install and completely wipe the sd card as well?

Did erase_flash before install. Didn't format the sdcard, but deleted old files and pasted new ones.

@caco3
Copy link
Collaborator

caco3 commented Apr 12, 2023

The SD-Card content should not matter for the performance.

I built now a version (based on rolling) which specifically only supports rev3. I can't test it myself, so make sure you have USB access to revert if it does not work: https://github.com/jomjol/AI-on-the-edge-device/actions?query=branch%3Aset-min-version-to-rev3

As for the framework update: Since that at least for one of you might help, I want to follow this path one step deeper. I am trying to take the latest rolling and update the framework to 6.1.0. (The above link still used 6.0.1 and an older rolling). It builds now but for some reason fails to init PSRAM. I will let you know once I have a better version there.

@MonsterEnergy-wtf
Copy link

I would like to join this conversation as I face the same issue.
The webUI is that slow that I cannot use it at all. Not sure what is causing the problem but I will follow up this thread and check if I can help you in any way.

@lterfloth
Copy link
Author

Later today, I will try another device and see if the update performs better on that one, too. Just to make sure that I did not by chance pick, out of the four rev 3's I own, one that is somehow functional.

@MonsterEnergy-wtf
Copy link

I completely fresh install the watermeter with https://github.com/jomjol/AI-on-the-edge-device/actions?query=branch%3Aset-min-version-to-rev3 and I can tell that it doesn't make any changes for me.
The inital setup page takes about 1.3 mins to load.
image

@HolBaum5
Copy link

I also installed the version (https://github.com/jomjol/AI-on-the-edge-device/actions/runs/4152463509) yesterday and the ping response times were dramatically reduced. My times correspond to those of @lterfloth.

The image build times of the GUI have not really changed but I could at least go through completely.

I (722) quad_psram: This chip is ESP32-D0WD
I (722) esp_psram: Found 8MB PSRAM device
I (722) esp_psram: Speed: 40MHz
I (722) esp_psram: PSRAM initialized, cache is in low/high (2-core) mode.
I (1638) cpu_start: cpu freq: 160000000 Hz
I (1639) cpu_start: Application information:
I (1639) cpu_start: Project name:     AI-on-the-edge
I (1644) cpu_start: App version:      94371ba
I (1648) cpu_start: Compile time:     Feb 11 2023 17:45:11
I (1653) cpu_start: ELF file SHA256:  0cabbb7bef32fe8c...
I (1658) cpu_start: ESP-IDF:          5.0.0
I (3778) camera: Detected OV2640 camera
I (3778) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
I (3858) cam_hal: buffer_size: 32768, half_buffer_size: 4096, node_buffer_size: 2048, node_cnt: 16, total_cnt: 15
I (3858) cam_hal: Allocating 61440 Byte frame buffer in PSRAM
I (3868) cam_hal: cam config ok
I (3868) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8
I (5978) MAIN: Using SDMMC peripheral
Name: SMI  
Type: SDHC/SDXC
Speed: 20 MHz
Size: luMB
CSD: ver=2, sector_size=512, capacity=7864320 read_bl_len=9
SSR: bus_width=1
I (6148) MAIN: Development-Branch: migrate-to-platformio-6.0.1 (Commit: 94371ba), Date/Time: 2023-02-11 17:44, Web UI: Development-Branch: migrate-to-platformio-6.0.1 (Commit: 94371ba)

@lterfloth
Copy link
Author

I also installed the version (https://github.com/jomjol/AI-on-the-edge-device/actions/runs/4152463509) yesterday and the ping response times were dramatically reduced. My times correspond to those of @lterfloth.

The image build times of the GUI have not really changed but I could at least go through completely.

Yes, image build times remained more or less the same. Biggest difference is the package loss which was just not happening anymore (i.e. the system was stable). The package loss leads to many problems down the line.

@caco3
Copy link
Collaborator

caco3 commented Apr 13, 2023

@MonsterEnergy-wtf

I would like to join this conversation as I face the same issue. The webUI is that slow that I cannot use it at all. Not sure what is causing the problem but I will follow up this thread and check if I can help you in any way.

which pcb revision do you have? check the log for it.

@penapena
Copy link

The SD-Card content should not matter for the performance.

I built now a version (based on rolling) which specifically only supports rev3. I can't test it myself, so make sure you have USB access to revert if it does not work: https://github.com/jomjol/AI-on-the-edge-device/actions?query=branch%3Aset-min-version-to-rev3

As for the framework update: Since that at least for one of you might help, I want to follow this path one step deeper. I am trying to take the latest rolling and update the framework to 6.1.0. (The above link still used 6.0.1 and an older rolling). It builds now but for some reason fails to init PSRAM. I will let you know once I have a better version there.

With this the rev3 works somehow if you put CPU to 240 in the config file. With 160 I couldn't access it at all. However on RSSI -70 it is very slow, but I can still access it (rev1 works great even at RSSI -80). Close to the router with around -50 it works good, but not as fast as rev1.

@caco3
Copy link
Collaborator

caco3 commented Apr 14, 2023

@penapena
Do both have an external antenna?

@ all:
I feel that I am unable to trace it further down without a rev3 hardware myself.
If somebody is willing to send me a device (to Switzerland), i can have a look on it, but I can't promise to fix it or spend a lot of time into it.

@MonsterEnergy-wtf
Copy link

@MonsterEnergy-wtf

I would like to join this conversation as I face the same issue. The webUI is that slow that I cannot use it at all. Not sure what is causing the problem but I will follow up this thread and check if I can help you in any way.

which pcb revision do you have? check the log for it.

Rev3. Sorry, I should have added this before.
Also I can confirm that the UI works much better with 240Mhz...

@MonsterEnergy-wtf
Copy link

@penapena Do both have an external antenna?

@ all: I feel that I am unable to trace it further down without a rev3 hardware myself. If somebody is willing to send me a device (to Switzerland), i can have a look on it, but I can't promise to fix it or spend a lot of time into it.

Pls send me a PN (if possbile here). I'm willing to do so.

@lterfloth
Copy link
Author

lterfloth commented Apr 14, 2023

@caco3 is branch platformio6 already suitable for testing here at home? I mean, the device I am using right now does not work reliably anyway, therefore I would not be mad if it has issue. Just wondering whether the code needed for migration is already done. I'd be happy to test it. I don't mind a slow web UI and other usability related issues. As long as the device is able to read the values and send it to home assistant via MQTT, I'm happy :-)

@caco3
Copy link
Collaborator

caco3 commented Apr 14, 2023

@lterfloth No, sorry, somehow there was a change between the rolling version migrate-to-platformio-6.0.1 is based on and the latest rolling. Since I based platformio6 on the latest rolling, this is an issue. The change somehow leads to that the PSRAM does not get initialized at all, thus making normal operation impossible.
I would need to rebase commit by commit to find where it broke, but I currently do not have time to look into it, sry.

@caco3
Copy link
Collaborator

caco3 commented Apr 14, 2023

@penapena

Pls send me a PN (if possbile here). I'm willing to do so.

Github does not provide such feature, but you find my contact information at https://www.ruinelli.ch/about

@penapena
Copy link

@penapena Do both have an external antenna?

@ all: I feel that I am unable to trace it further down without a rev3 hardware myself. If somebody is willing to send me a device (to Switzerland), i can have a look on it, but I can't promise to fix it or spend a lot of time into it.

Both are on internal antenna.

@caco3
Copy link
Collaborator

caco3 commented Apr 19, 2023

@HolBaum5 Das ist super! Bitte teste doch auch mal den neusten Build mit 6.1.0. (siehe mein letzter Eintrag hier) .Das basiert auf rolling und das möchte ich gerne nächstens ins rolling mergen.

@HolBaum5
Copy link

@caco3
Ist das nicht der letzte Stand (AI-on-the-edge-device__manual-setup__2305_merge_(2948d6c))?
Hatte mich verschrieben, 6.0.1 sollte aber 6.1.0 sein.

@caco3
Copy link
Collaborator

caco3 commented Apr 19, 2023

doch, du hast Recht, sorry.

@friedpa
Copy link

friedpa commented Apr 19, 2023

Ist das nun bereits in der Testphase? Soll ich die SW auf mein Testsystem laden?

@lterfloth
Copy link
Author

Ich hab das Release auf mein zusammengepfuschtes (i.a.W. thermisch optimiertes) System gespielt. Läuft bis dato reibungslos und einwandfrei in Einklang mit Home Assistant und Datentransfer via MQTT.

@friedpa
Copy link

friedpa commented Apr 19, 2023

Es gibt kleine Kühlkörper bei amazon zu kaufen, sind für den RBP 4, aber ich verwende diese auch immer wieder für andere Basteleien, diese kommen mit wärmeleitfähigen Selbstklebeband:

grafik

@caco3
Copy link
Collaborator

caco3 commented Apr 19, 2023

@friedpa Du darfst gerne Testen und ein Feedback geben. Das hilft uns.

@jupe
Copy link

jupe commented Apr 19, 2023

I can also confirm that finger in left corner really helps. Could it be some invalid initialization for camera I/O ports where "finger" makes workaround? I think this anyway means that root cause is not heating problem, instead something else. I also tried to push with antistatic material this corner without help - which sounds a bit that root cause might not be bad soldering neither.

image

@caco3
Copy link
Collaborator

caco3 commented Apr 19, 2023

The whole camera initialization and driver are all provided by Espressif, thats not implemented by us. Because of this I don't think it is something we could catch/fix!

For me it looks like a hardware issue (bad batch), @penapena also got other rev3 devices which seem to be fine

@caco3
Copy link
Collaborator

caco3 commented Apr 19, 2023

Off Topic:
We are not sure if the rev3 boards provide valid temperatures. Could you have a look and report your experience in
#2222?

@jupe
Copy link

jupe commented Apr 19, 2023

Off Topic:
We are not sure if the rev3 boards provide valid temperatures. Could you have a look and report your experience in
#2222?

at least I got reasonable value when using /cpu_temperature api (42C)..

@jupe
Copy link

jupe commented Apr 19, 2023

The whole camera initialization and driver are all provided by Espressif, thats not implemented by us. Because of this I don't think it is something we could catch/fix!

For me it looks like a hardware issue (bad batch), @penapena also got other rev3 devices which seem to be fine

I agree. Doesn't seem to be project issue. Most probably driver (perhaps some pull-up is missing) or HW issue (perhaps wrong component etc). Where might be rev3 schema and pcb pictures ? Would like to do some oscilloscope debugging to understand is there anything we could make these problematic board working...

@caco3
Copy link
Collaborator

caco3 commented Apr 19, 2023

Where might be rev3 schema and pcb pictures ?

I didn't find any usefull docs on it.
First of all, I don't know, who designed that PCB. Espressif does not list an ESP32-CAM board.
Best guess is **Ai-Thinker **: http://www.ai-thinker.com/pro_view-24.html, https://loboris.eu/ESP32/ESP32-CAM%20Product%20Specification.pdf

There is a schematics floating around with version 1.6, not sure to what this translates. ALso the PCB revision does not give any information on the used ESP32S-Module on it!

https://github.com/SeeedDocument/forum_doc/blob/master/reg/ESP32_CAM_V1.6.pdf
https://randomnerdtutorials.com/esp32-cam-ai-thinker-pinout/

@kofi1990
Copy link

Ich habe jetzt 4 Module von Amazon gekauft und getestet (Lieferant: "diymore"). Keines dieser Module funktioniert.
Kann mir jemand einen Link von Modulen geben, die funktionieren? Leider kann man meist zu den revisionen nicht viel herausfinden. LG

@MonsterEnergy-wtf
Copy link

MonsterEnergy-wtf commented Apr 20, 2023

Ich habe jetzt 4 Module von Amazon gekauft und getestet (Lieferant: "diymore"). Keines dieser Module funktioniert.

Kann mir jemand einen Link von Modulen geben, die funktionieren? Leider kann man meist zu den revisionen nicht viel herausfinden. LG

I'm interested in this too as my ones ordered seem somehow faulty.
Ordered by Amazon Germany.

Anyone has a good source to get high quality boards?

@MonsterEnergy-wtf
Copy link

Short update:
I added some head sinks to the modules below the camera and it seems much better. From my perspective I guess that the manufacturer uses cheap modules which got hot pretty soon. Once they are hot enough they start behaving strange. At least with some heat sinks the problem seems to be await. At least for now.

The UI is now much better to be used and also the package https://github.com/jomjol/AI-on-the-edge-device/actions/runs/4726081126 seems to do a good job.

One thing left: the soft reboot doesn't always picks up the latest configuration with my board. After pulling the plug and attach it again to the board the new settings are picked up correctly. Now the board runs.
Let's see how long :-P

@cbho
Copy link

cbho commented Apr 20, 2023

Would you mind posting a picture of your solution for adding a heat sink?
Regards in advance,
Chr.

@caco3
Copy link
Collaborator

caco3 commented Apr 20, 2023

One thing left: the soft reboot doesn't always picks up the latest configuration with my board.

Can you show that with a log file? Please do so in a separate issue. It would be rater odd and does not make sense to me!

@caco3
Copy link
Collaborator

caco3 commented Apr 20, 2023

Has anybody who thinks he has thermal issues tried if running it in the fridge or freezer solvers that issue? That would be the best indicator to prove it is a thermal issue!

@kofi1990
Copy link

I tried a raspberrypi-heatsink directly on top of the marked area without any changes in performance. Also the "copper-wire as a heatsink" didn't work for me.
today I get another 2 modules from a different supplier. If there's the same issue I'm gonna try the "fridge-solution" :P.

@jupe
Copy link

jupe commented Apr 21, 2023

Has anybody who thinks he has thermal issues tried if running it in the fridge or freezer solvers that issue? That would be the best indicator to prove it is a thermal issue!

tried freezer and fridge without any help for me. Stays slow.

@caco3
Copy link
Collaborator

caco3 commented Apr 21, 2023

Thanks!
I really think it is not a thermal issue, you would feel taht it would be extra hot. Also keep in mind that such electronics usually supports far higher ambiente temperathures!

One possible scenario I see:
There are bad solderings, either on the ESP32 module directly or on the ESP32-CAM board. Putting your finger on them changes the capacitance of the touched (and nearby) electrical traces. Usually this is not a prpblem. But when there are bad solderings, this can have various impacts. Eg. also on the CPU clock.

Nevertheless I am sure it is a hardware issue. Therefore I am closing this bug. But feel free to continue sharing your experiences in here.

@caco3 caco3 closed this as completed Apr 21, 2023
@caco3 caco3 changed the title Slow Webinterface on Hardware rev. 3 Slow Webinterface on Hardware rev. 3 -> Most likely hardware issue Apr 21, 2023
@kofi1990
Copy link

I bought these from Amazon.de and they are OK (also rev3). I tried 4 from a different seller without success.
https://www.amazon.de/dp/B0BVR5X7JR?psc=1&ref=ppx_yo2ov_dt_b_product_details

I don't know if I was just lucky.

@friedpa
Copy link

friedpa commented Apr 22, 2023

I have now tested the platformio6 in my testsystem, afterwards in my both production system and I have then integrated the newest rolling. I have no problems dtetected. Very smart change! Thanks!

@Matman37
Copy link

Matman37 commented May 9, 2023

I have the same issue with 3.1 PCB. Is there a solution now you can reommend? I tried like mentioned the 6.1.0. So I did this:

  • Erease SD-Card and put on the 6.1.0 SD Card files
  • OTA Updated the firmware.bin from 6.1.0
  • OTA Updated the html.zip (dont know if it was successfull)
    (was this the right way?)

Its also very slow and dont take Images for reference, so its not useable for me like the way I did. Is there any way to get this working? Otherwise, is there a store, which sells Rev. >3? Want to present this cool project as "easy to setup AI application for smart home" in a few weeks 😢

@caco3
Copy link
Collaborator

caco3 commented May 9, 2023

use the latest release, not the experimental builds listed here. everything is now in the release.
tben create a new discussion and provide the debug logfile

Repository owner locked and limited conversation to collaborators May 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests