jomjol / AI-on-the-edge-device

Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world
https://jomjol.github.io/AI-on-the-edge-device-docs/
5.97k stars 648 forks source link

Foto-Schleife, WLAN weg #98

Closed plin2 closed 3 years ago

plin2 commented 3 years ago

Ich habe seit heute ganz frisch die erste ESP32-CAM laufen. Ich habe alles konfiguriert. Nach dem Boot wird ein Foto geschossern. Beim nächsten Interval kommt das Device in eine Foto-Schleife (ca. 5 Sekunden-Takt, Licht an, aus) und ist per WLAN nicht mehr zu erreichen.

Ich habe die aktuelle Version 2021-01-21 geflasht.

plin2 commented 3 years ago

Im Logfile steht:

2021-01-23_15-00-08: Time zone set to CET-1CEST,M3.5.0,M10.5.0/3 2021-01-23_15-00-08: ============================================================================================= 2021-01-23_15-00-08: =================================== Main Started ============================================ 2021-01-23_15-00-08: ============================================================================================= 2021-01-23_15-02-50: Time zone set to CET-1CEST,M3.5.0,M10.5.0/3 2021-01-23_15-02-50: ============================================================================================= 2021-01-23_15-02-50: =================================== Main Started ============================================ 2021-01-23_15-02-50: ============================================================================================= 2021-01-23_15-04-30: Time zone set to CET-1CEST,M3.5.0,M10.5.0/3 2021-01-23_15-04-30: ============================================================================================= 2021-01-23_15-04-30: =================================== Main Started ============================================ 2021-01-23_15-04-30: ============================================================================================= 2021-01-23_15-31-27: Time zone set to CET-1CEST,M3.5.0,M10.5.0/3 2021-01-23_15-31-27: ============================================================================================= 2021-01-23_15-31-27: =================================== Main Started ============================================ 2021-01-23_15-31-27: =============================================================================================

Und der serial Monitor gibt folgendes in einer Schleife aus:

rst:0x8 (TG1WDT_SYS_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:4 load:0x3fff0034,len:7140 load:0x40078000,len:13856 load:0x40080400,len:4052 entry 0x40080688 I (58) boot: ESP-IDF 3.40100.200827 2nd stage bootloader I (58) boot: compile time 19:51:06 I (58) boot: chip revision: 1 I (62) boot_comm: chip revision: 1, min. bootloader chip revision: 0 I (69) boot.esp32: SPI Speed : 40MHz I (74) boot.esp32: SPI Mode : DIO I (78) boot.esp32: SPI Flash Size : 4MB W (83) boot.esp32: PRO CPU has been reset by WDT. W (88) boot.esp32: WDT reset info: PRO CPU PC=0x40084a88 W (94) boot.esp32: WDT reset info: APP CPU PC=0x4008e7db I (100) boot: Enabling RNG early entropy source... I (106) boot: Partition Table: I (109) boot: ## Label Usage Type ST Offset Length I (117) boot: 0 nvs WiFi data 01 02 00009000 00004000 I (124) boot: 1 otadata OTA data 01 00 0000d000 00002000 I (132) boot: 2 phy_init RF data 01 01 0000f000 00001000 I (139) boot: 3 ota_0 OTA app 00 10 00010000 001db000 I (147) boot: 4 ota_1 OTA app 00 11 001f0000 001db000 I (155) boot: End of partition table I (159) boot_comm: chip revision: 1, min. application chip revision: 0 I (166) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x4c730 (313136) map I (310) esp_image: segment 1: paddr=0x0005c758 vaddr=0x3ffb0000 size=0x038c0 ( 14528) load I (318) esp_image: segment 2: paddr=0x00060020 vaddr=0x400d0020 size=0x15f514 (1438996) map I (940) esp_image: segment 3: paddr=0x001bf53c vaddr=0x3ffb38c0 size=0x01860 ( 6240) load I (944) esp_image: segment 4: paddr=0x001c0da4 vaddr=0x40080000 size=0x00404 ( 1028) load I (948) esp_image: segment 5: paddr=0x001c11b0 vaddr=0x40080404 size=0x1ee54 (126548) load I (1035) boot: Loaded app from partition at offset 0x10000 I (1036) boot: Disabling RNG early entropy source... I (1036) psram: This chip is ESP32-D0WD I (1042) spiram: Found 64MBit SPI RAM device I (1045) spiram: SPI RAM mode: flash 40m sram 40m I (1051) spiram: PSRAM initialized, cache is in low/high (2-core) mode. I (1058) cpu_start: Pro cpu up. I (1062) cpu_start: Application information: I (1067) cpu_start: Project name: esp32cam-server-only I (1073) cpu_start: App version: 0.0.9.3 I (1078) cpu_start: Compile time: Jan 20 2021 19:48:33 I (1084) cpu_start: ELF file SHA256: b9ffc04c8ab59a15... I (1090) cpu_start: ESP-IDF: 3.40100.200827 I (1096) cpu_start: Starting app cpu, entry point is 0x40081c30 I (0) cpu_start: App cpu up. I (1988) spiram: SPI SRAM memory test OK I (1988) heap_init: Initializing. RAM available for dynamic allocation: I (1989) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM I (1995) heap_init: At 3FFC2AC8 len 0001D538 (117 KiB): DRAM I (2001) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM I (2007) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM I (2014) heap_init: At 4009F258 len 00000DA8 (3 KiB): IRAM I (2020) cpu_start: Pro cpu start user code I (2025) spiram: Adding pool of 4096K of external SPI memory to heap allocator I (2050) spi_flash: detected chip: generic I (2051) spi_flash: flash io: dio I (2051) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. I (2059) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations Do Reset Camera I (2069) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0  Init Camera I (4079) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (4079) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (4079) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (4089) gpio: GPIO[21]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (4099) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (4109) gpio: GPIO[23]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (4119) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (4129) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (4139) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (4149) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (4159) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (4169) sccb: pin_sda 26 pin_scl 27  I (4169) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0  I (4319) camera: Detected OV2640 camera I (4319) camera: Allocating 1 frame buffers (150 KB total) I (4339) camera: Allocating 150 KB frame buffer in OnBoard RAM I (4939) connect_wlan_main: Initializing SD card E (4959) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107 E (4959) connect_wlan_main: Failed to initialize the card (263). Make sure SD card lines have pull-up resistors in place. I (4969) server_ota: Start CheckOTAUpdateCheck ... Start CheckOTAUpdateCheck ... I (4989) server_ota: SHA-256 for the partition table: : 9d4a2809ae90fb20709a8ca3dd3ac3462e1e73286bcd31b689060c91de06fa3a I (5049) server_ota: SHA-256 for bootloader: : 15f52f58b38b015f8d77a7fd637080c32b397905d47e4ca1bf5bbf1c6abe34bf I (5779) server_ota: SHA-256 for current firmware: : 9e85de4055be332de6ebd46bca00b10d3bbdb260efcb2c79c0f0bfc418eeb3da CheckOTAUpdate Partition: ESP_OK File is locked: /sdcard/wlan.ini - wait for 1 Logfile opened: 

Die beiden Zeilen mit Logfile opended und die nachfolgende enthalten kryptische Zeichen: LastMsg

jomjol commented 3 years ago

Hello @plin2, I had the same failure one time and it was a corupted wlan.ini, because I had it opened on the PC for changing and just pulled out the SD card. Repairing the SD-card (or formating - I don't remember) and configuring wlan.ini again solved the problem.

Best regards, jomjol

plin2 commented 3 years ago

current status:

Will see sow things continue ...

plin2 commented 3 years ago

When I change the configuration and reboot I end up in a boot loop again. When I unplug from electricity and plug in again, it seems to work.

jomjol commented 3 years ago

Strange behaviour. I just uploaded a new rolling and all the test with OTA-update and reboot did work well.

plin2 commented 3 years ago

Well, I tried several things, nothing worked and finally looked at the code. I searched for the string 'Logfile opened:' and found it in code/components/jomjol_logfile/ClassLogFile.cpp. In line 68 you print that output before testing if the fopen was ok

pFile = fopen(_fn.c_str(), "a+"); printf("Logfile opened: %s\n", _fn.c_str()); ` if (pFile!=NULL) {`

I guess it would be better to do that after checking the return code. Hopefully that way we will find out the malformed filename.

Screenshot of the relevant serial output: ESP32CAM_log_20210124

jomjol commented 3 years ago

Hello @plin2,

this line only prints the name of the file to open (printf("Logfile opened: %s\n", _fn.c_str());). If the file opening failed in the line before, then the pointer pFile will be equal to NULL, which is then checked in the error handling later on.

As you are the only one, currently reporting this problem, one more thing came to my mind. You wrote some post above, that you format your SD-card with VFAT32. I'm only using FAT32:

grafik

Could that be a difference? Could you check this?

Otherwise I I can offer to do a personal meeting, e.g. with skype and we can discuss this a bit easier. Only question is, how to exchange the adresses. I dont't want to publish them here in this public issue. Do you have a chat on iobroker, fhem or openhab?

Best regards, jomjol

plin2 commented 3 years ago

After several tests with different devices, SD cards and configs I found out that the SD card was causing the problems. With a fresh card everything works fine.

P.S.: printf("Logfile opened: %s\n", _fn.c_str()) My guess was simply that the garbage that was printed as filename might contain some special characters that cause some damage and crashes the system..

plin2 commented 3 years ago

Make sure you have one device at home to test :-)