Xinyuan-LilyGO / LilyGo-Cam-ESP32S3

44 stars 16 forks source link

Streaming works only when serial monitor attached #3

Closed maxpersg closed 1 year ago

maxpersg commented 1 year ago

The source code seems to work only when a serial monitor is connected. If i disconnect the serial monitor, the stream stops and therefore i cannot connect this to a power plug to stream video. Any workarounds/

lewisxhe commented 1 year ago

Add compilation parameters to platfromioi.ini so that it will not start USB printing and blocking

build_ flags =
-UARDUINO_USB_CDC_ON_BOOT

If you are using the arduino IDE, it is the same

Tools -> USB CDC ON BOOT -> Disable

maxpersg commented 1 year ago

thank you. it worked. I'm trying to get this to work in ESPHome, but i keep getting this:

[W][esp32_camera:166]: Got invalid frame from camera!

It will only work once when i flash the factory firmware and flash the ESPHome immediately without disconnecting the device. Any help would be appreciated. Thanks!

I tried to insert the source code to turn on the camera channel:

void setup() {

    /*********************************
     *  step 1 : Initialize power chip,
     *  turn on camera power channel
    ***********************************/
    if (!PMU.begin(Wire, AXP2101_SLAVE_ADDRESS, I2C_SDA, I2C_SCL)) {
        Serial.println("Failed to initialize power.....");
        while (1) {
            delay(5000);
        }
    }
    //Set the working voltage of the camera, please do not modify the parameters
    PMU.setALDO1Voltage(1800);  // CAM DVDD  1500~1800
    PMU.enableALDO1();
    PMU.setALDO2Voltage(2800);  // CAM DVDD 2500~2800
    PMU.enableALDO2();
    PMU.setALDO4Voltage(3000);  // CAM AVDD 2800~3000
    PMU.enableALDO4();

    // TS Pin detection must be disable, otherwise it cannot be charged
    PMU.disableTSPinMeasure();

  // ========== AUTO GENERATED CODE BEGIN ===========
  // async_tcp:
  //   {}
  // esphome:
  //   name: esp-cam2
  //   friendly_name: ESP_CAM2void setup() {

    /*********************************
     *  step 1 : Initialize power chip,
     *  turn on camera power channel
    ***********************************/
    if (!PMU.begin(Wire, AXP2101_SLAVE_ADDRESS, I2C_SDA, I2C_SCL)) {
        Serial.println("Failed to initialize power.....");
        while (1) {
            delay(5000);
        }
    }
    //Set the working voltage of the camera, please do not modify the parameters
    PMU.setALDO1Voltage(1800);  // CAM DVDD  1500~1800
    PMU.enableALDO1();
    PMU.setALDO2Voltage(2800);  // CAM DVDD 2500~2800
    PMU.enableALDO2();
    PMU.setALDO4Voltage(3000);  // CAM AVDD 2800~3000
    PMU.enableALDO4();

    // TS Pin detection must be disable, otherwise it cannot be charged
    PMU.disableTSPinMeasure();

  // ========== AUTO GENERATED CODE BEGIN ===========
  // async_tcp:
  //   {}
  // esphome:
  //   name: esp-cam2
  //   friendly_name: ESP_CAM2
....

but i keep hitting this error:

ELF file SHA256: 9315270de48ff309

E (5269) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0
Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x2a (SPI_FAST_FLASH_BOOT)
Saved PC:0x40377484
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x43c
load:0x403b6000,len:0xbd0
load:0x403ba000,len:0x29c8
entry 0x403b61d8
E (205) esp_core_dump_flash: No core dump partition found!
E (205) esp_core_dump_flash: No core dump partition found!
[I][logger:258]: Log initialized
[C][ota:469]: There have been 9 suspected unsuccessful boot attempts.
[D][esp32.preferences:113]: Saving 1 preferences to flash...
[D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[I][app:029]: Running through setup()...
[I][i2c.arduino:175]: Performing I2C bus recovery
E (10255) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (10255) task_wdt:  - loopTask (CPU 1)
E (10255) task_wdt: Tasks currently running:
E (10255) task_wdt: CPU 0: IDLE
E (10255) task_wdt: CPU 1: IDLE
E (10255) task_wdt: Aborting.

abort() was called at PC 0x4202d334 on core 0

Backtrace: 0x40377876:0x3fc975b0 0x4037d5e1:0x3fc975d0 0x40384135:0x3fc975f0 0x4202d334:0x3fc97670 0x40378d79:0x3fc97690 0x420b1743:0x3fcf4830 0x4202db99:0x3fcf4850 0x4037eb74:0x3fcf4870
lewisxhe commented 1 year ago

ESPHOME is unable to use this board at present, because ESPHOME does not integrate the PMU driver code. The camera cannot work normally

maxpersg commented 1 year ago

anyway if i can add this as a custom component to ESPhome?

lewisxhe commented 1 year ago

Well, first of all, you need to turn on the camera voltage of the PMU to access the camera normally

maxpersg commented 1 year ago

yes, but the comment i insert this line

PMU.begin(Wire, AXP2101_SLAVE_ADDRESS, I2C_SDA, I2C_SCL);

i get this: [I][i2c.arduino:175]: Performing I2C bus recovery

it thn goes into an infinite reboot

lewisxhe commented 1 year ago

'''PMU.begin(Wire, AXP2101_SLAVE_ADDRESS, 7,6);'''

Change to try this

lewisxhe commented 1 year ago

still there ? If you still have problems, please reopen