arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
21.97k stars 4.77k forks source link

ESP32 TTGO Camera Mini CAM: Init failed to get the frame on time #9861

Closed victorclaessen closed 3 years ago

victorclaessen commented 3 years ago

PROBLEM DESCRIPTION

A clear and concise description of what the problem is. My camera doesn't work. I flashed tasmota32-webcam.bin onto a TTGO Camera Mini (link to image of the device) and configured it, but I get the error CAM: Init failed to get the frame on time.

The pinout configuration for the camera can be found here (black pcb version): https://github.com/Xinyuan-LilyGO/TTGO_Camera_Mini/blob/master/TTGO_Camera_Mini.ino#L42

This is my configuration in tasmota: ttgo-mini My assumption was that the CAM_DATA pins 1-8 correspond to the Y2-Y9 pins. Without the CAM_DATA pins, the device is not recognised at all. [E][camera.c:1049] camera_probe(): Detected camera not supported. [E][camera.c:1249] esp_camera_init(): Camera probe failed with error 0x20004 21:49:43 CAM: Init failed with error 0x20004

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

- [x] If using rules, provide the output of this command: `Backlog Rule1; Rule2; Rule3`:

Rules output here: NO RULES

- [x] Provide the output of this command: `Status 0`:

STATUS 0 output here: 21:51:07 CMD: status 0 21:51:07 RSL: stat/tasmota_82EB90/STATUS = {"Status":{"Module":1,"DeviceName":"Tasmota","FriendlyName":["Tasmota"],"Topic":"tasmota_82EB90","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}} 21:51:07 RSL: stat/tasmota_82EB90/STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota/release/tasmota.bin.gz","RestartReason":"Vbat power on reset","Uptime":"0T00:01:35","StartupUTC":"2020-11-14T20:49:32","Sleep":50,"CfgHolder":4617,"BootCount":5,"BCResetTime":"2020-11-14T21:19:04","SaveCount":13}} 21:51:07 RSL: stat/tasmota_82EB90/STATUS2 = {"StatusFWR":{"Version":"9.1.0(webcam)","BuildDateTime":"2020-11-07T12:35:02","Core":"1_0_4","SDK":"v3.2.3-14-gd3e562907","CpuFrequency":240,"Hardware":"ESP32","CR":"373/699"}} 21:51:07 RSL: stat/tasmota_82EB90/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["Zeezicht_M2M",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["0000800B","2805C8000100060000005A00000000000000","00000000","00006000","00000000"]}} 21:51:07 RSL: stat/tasmota_82EB90/STATUS4 = {"StatusMEM":{"ProgramSize":1185,"Free":1984,"Heap":111,"PsrMax":4095,"PsrFree":4095,"ProgramFlashSize":16384,"FlashSize":16384,"FlashFrequency":40,"FlashMode":3,"Features":["00000809","8FDAC787","00140001","000000CF","010013C0","40000981","80004000","00000000"],"Drivers":"1,2,3,4,5,7,8,9,10,12,20,21,24,26,27,29,81","Sensors":"1,2,3,5,6"}} 21:51:07 RSL: stat/tasmota_82EB90/STATUS5 = {"StatusNET":{"Hostname":"Lilycam","IPAddress":"10.29.7.65","Gateway":"10.29.9.4","Subnetmask":"255.255.240.0","DNSServer":"10.29.0.1","Mac":"8C:AA:B5:82:EB:90","Webserver":2,"WifiConfig":4,"WifiPower":17.0}} 21:51:07 RSL: stat/tasmota82EB90/STATUS6 = {"StatusMQT":{"MqttHost":"","MqttPort":1883,"MqttClientMask":"DVES%06X","MqttClient":"DVES_82EB90","MqttUser":"DVES_USER","MqttCount":0,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30}} 21:51:07 RSL: stat/tasmota_82EB90/STATUS7 = {"StatusTIM":{"UTC":"2020-11-14T20:51:07","Local":"2020-11-14T21:51:07","StartDST":"2020-03-29T02:00:00","EndDST":"2020-10-25T03:00:00","Timezone":"+01:00","Sunrise":"07:58","Sunset":"17:10"}} 21:51:07 RSL: stat/tasmota_82EB90/STATUS10 = {"StatusSNS":{"Time":"2020-11-14T21:51:07"}} 21:51:07 RSL: stat/tasmota_82EB90/STATUS11 = {"StatusSTS":{"Time":"2020-11-14T21:51:07","Uptime":"0T00:01:35","UptimeSec":95,"Heap":111,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"Wifi":{"AP":1,"SSId":"Redacted_M2M","BSSId":"1E:EC:BA:8A:63:86","Channel":1,"RSSI":76,"Signal":-62,"LinkCount":1,"Downtime":"0T00:00:03"}}}

- [x] Provide the output of the Console log output when you experience your issue; if applicable:
  _(Please use_ `weblog 4` _for more debug information)_

Console output here: 21:31:15 RSL: tele/tasmota_82EB90/INFO1 = {"Module":"ESP32-DevKit","Version":"9.1.0(webcam)","FallbackTopic":"cmnd/DVES_82EB90_fb/","GroupTopic":"cmnd/tasmotas/"} 21:31:15 RSL: tele/tasmota_82EB90/INFO2 = {"WebServerMode":"Admin","Hostname":"Lilycam","IPAddress":"10.29.7.65"} 21:31:15 RSL: tele/tasmota_82EB90/INFO3 = {"RestartReason":"Software reset CPU"} [E][camera.c:1344] esp_camera_fb_get(): Failed to get the frame on time! 21:31:22 CAM: Init failed to get the frame on time 21:31:22 QPC: Reset



### TO REPRODUCE
_Steps to reproduce the behavior:_
Install tasmota 9.1.0 on TTGO Camera Mini, configure as above.

### EXPECTED BEHAVIOUR
_A clear and concise description of what you expected to happen._
I was expecting the camera to work.

### SCREENSHOTS
_If applicable, add screenshots to help explain your problem._
Included screenshot of configuration above

### ADDITIONAL CONTEXT
_Add any other context about the problem here._

**(Please, remember to close the issue when the problem has been addressed)**

(edit: added additional checkmark I forgot to check)
Jason2866 commented 3 years ago

This is the default setting

// CAMERA_MODEL_AI_THINKER default template pins
#define PWDN_GPIO_NUM     32
#define RESET_GPIO_NUM    -1
#define XCLK_GPIO_NUM      0
#define SIOD_GPIO_NUM     26
#define SIOC_GPIO_NUM     27

#define Y9_GPIO_NUM       35
#define Y8_GPIO_NUM       34
#define Y7_GPIO_NUM       39
#define Y6_GPIO_NUM       36
#define Y5_GPIO_NUM       21
#define Y4_GPIO_NUM       19
#define Y3_GPIO_NUM       18
#define Y2_GPIO_NUM        5
#define VSYNC_GPIO_NUM    25
#define HREF_GPIO_NUM     23
#define PCLK_GPIO_NUM     22

according to your link there are missing some GPIO defines in your setup

//! New version is black PCB, please use these pins
#define PWDN_GPIO_NUM    -1
#define RESET_GPIO_NUM   -1
#define XCLK_GPIO_NUM    32
#define SIOD_GPIO_NUM    13
#define SIOC_GPIO_NUM    12

#define Y9_GPIO_NUM      39
#define Y8_GPIO_NUM      36
#define Y7_GPIO_NUM      38
#define Y6_GPIO_NUM      37
#define Y5_GPIO_NUM      15
#define Y4_GPIO_NUM      4
#define Y3_GPIO_NUM      14
#define Y2_GPIO_NUM      5

#define VSYNC_GPIO_NUM   27
#define HREF_GPIO_NUM    25
#define PCLK_GPIO_NUM    19
Jason2866 commented 3 years ago

Edit sorry. Setup looks correct so far. Please try latest development version. We have changed the used ArduinoESP32 core. There are many fixes and enhancements done! Edit2: Does the Camera work with the example sketch you linked?

victorclaessen commented 3 years ago

I was going back and forth between the 9.1.0 release and the development binary from 2020-11-15. At some point (while I was on the 9.1.0 release) I realised that I made a mistake in CAM_DATA_6 that I linked to pin23 above, but should have been pin 38. I then saw that pin38 was not exposed in this template, so I made a new template.

{"NAME":"TTGO Camera Mini","GPIO":[1,0,0,0,5090,5088,0,0,5056,5024,5089,5091,0,0,0,5184,0,640,608,0,0,5152,0,5120,0,0,0,0,4992,1,0,0,5094,5092,5093,5095],"FLAG":0,"BASE":1} Then as user set 0 to LinkLed if you want, and 33 to Button 1.

And after applying this template, I got a video stream!

I did have trouble moving to the development firmware, because the error returned. In the end, what worked was flashing the original firmware, then erasing flash, then flashing the development release. It may have something to do with the power management feature that it mentioned on this page, something about turning off the current limit of the AXP192. Not sure.

Edit 1: update template plus comments about pin 0 and 33 Edit 2: after a reboot, I again get the same error and the camera doesn't work anymore. Argh! Edit 3: the sketch I linked doesn't seem to boot at all.

Jason2866 commented 3 years ago

Maybe this helps https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/ Have you seen this remarks in the Tasmota Webcam driver? Try a lower Resolution.


* ESP32 webcam based on example in   Arduino-ESP32 library
--
*
* Template as used on ESP32-CAM WiFi + bluetooth Camera Module   Development Board ESP32 With Camera Module OV2640 Geekcreit for Arduino
* {"NAME":"AITHINKER   CAM","GPIO":[4992,1,1,1,1,5088,1,1,1,1,1,1,1,1,5089,5090,0,5091,5184,5152,0,5120,5024,5056,0,0,0,0,4928,1,5094,5095,5092,0,0,5093],"FLAG":0,"BASE":1}
*
* Supported commands:
* WcStream     = Control streaming, 0 = stop, 1 = start
* WcResolution = Set   resolution
*     0 = FRAMESIZE_96x96,  (96x96)
*     1 = FRAMESIZE_QQVGA2 (128x160)
*     2 = FRAMESIZE_QCIF (176x144)
*     3 = FRAMESIZE_HQVGA (240x176)
*     4 = FRAMESIZE_QVGA (320x240)
*     5 = FRAMESIZE_CIF (400x296)
*     6 = FRAMESIZE_VGA (640x480)
*     7 = FRAMESIZE_SVGA (800x600)
*     8 = FRAMESIZE_XGA (1024x768)
*     9 = FRAMESIZE_SXGA (1280x1024)
*    10 = FRAMESIZE_UXGA (1600x1200)
* WcMirror     = Mirror picture, 0 = no, 1 = yes
* WcFlip       = Flip picture, 0 = no, 1 = yes
* WcSaturation = Set   picture Saturation -2 ... +2
* WcBrightness = Set picture   Brightness -2 ... +2
* WcContrast   = Set picture Contrast -2 ... +2
*
* Only boards with PSRAM should be used. To enable PSRAM board   should be se set to esp32cam in common32 of platform_override.ini
* board                   = esp32cam
* To speed up cam processing cpu frequency   should be better set to 240Mhz in common32 of platform_override.ini
* board_build.f_cpu       = 240000000L
* remarks for AI-THINKER
* GPIO0 zero must be disconnected from any wire after programming   because this pin drives the cam clock and does
* not tolerate any capictive load
* flash led = gpio 4
* red led = gpio 33
ascillato2 commented 3 years ago

Please when you have time, tell us if this solves your issue. Thanks.

victorclaessen commented 3 years ago

I tried WcResolution 0 through 10, makes no difference (i.e. I get the same error 0x20004). In the original firmware as received from AliExpress, which I backed up but do not have a link to the source from, the streaming works at any resolution (albeit at lower framerates with increasing resolution).

victorclaessen commented 3 years ago

I found the code that produces the firmware it was shipped with originally here and specifically the readme for this model. It works at the highest resolution.