mtnbkr88 / ESP32CAMRemotePIR

ESP32-CAM Remote PIR Solar Powered Picture/Video Emailer
12 stars 2 forks source link

Compilation error : 'ADC2_GPIO12_CHANNEL' was not declared in this scope #4

Closed Patsjemoe closed 1 year ago

Patsjemoe commented 1 year ago

Hi, When compiling, I get following error : 'ADC2_GPIO12_CHANNEL' was not declared in this scope adc2_config_channel_atten(ADC2_GPIO12_CHANNEL, ADC_ATTEN_11db); Any suggestions ? regards Ludo

Patsjemoe commented 1 year ago

Hi Ed, In the comiler, it suggested to use ADC2_CHANNEL_9 instead of ADC2_GPIO12_CHANNEL....using this, the compile error disappeared, but now the camera does not initialize. E (3057) ledc: ledc_stop(661): LEDC is not initialized E (3097) camera: Camera probe failed with error 0x105(ESP_ERR_NOT_FOUND) Camera init failed with error 0x105, trying again...E (3197) gpio: gpio_install_isr_service(449): GPIO isr service already installed It seems difficult to find information on which channel to use for ESP32CAM. The only info I found was channel 5, but then it give a fatal core error. Did you post your latest working program ? Any suggestions ? Regards Ludo

mtnbkr88 commented 1 year ago

Hi Ludo, My research says ADC2_GPIO12_CHANNEL is defined in soc/adc_channel.h which my Arduino environment appears to be finding. In adc_channel.h is:

define ADC2_GPIO12_CHANNEL ADC2_CHANNEL_5

You didn't tell me the fatal error that gives. The program I posted compiles and works fine in my environment which is Arduino 1.8.15 and in the Boards Manager I'm using esp32 version 1.0.2 (not any of the newer versions). Try that configuration and let me know if it works.

Patsjemoe commented 1 year ago

Hi Ed, Thank you for your feedback. I do not find adc_channel.h in your file as #include.... Shouldn't that be? This may be the reason of my first error...? I will retry tomorrow and confirm error. Regards Ludo

Op za 5 nov. 2022 21:54 schreef mtnbkr88 @.***>:

Hi Ludo, My research says ADC2_GPIO12_CHANNEL is defined in soc/adc_channel.h which my Arduino environment appears to be finding. In adc_channel.h is:

define ADC2_GPIO12_CHANNEL ADC2_CHANNEL_5

You didn't tell me the fatal error that gives. The program I posted compiles and works fine in my environment which is Arduino 1.8.15 and in the Boards Manager I'm using esp32 version 1.0.2 (not any of the newer versions). Try that configuration and let me know if it works.

— Reply to this email directly, view it on GitHub https://github.com/mtnbkr88/ESP32CAMRemotePIR/issues/4#issuecomment-1304639834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMBAJWEXTIG4WF35HOM7GDWG3CQNANCNFSM6AAAAAARX3UWPA . You are receiving this because you authored the thread.Message ID: @.***>

mtnbkr88 commented 1 year ago

Hi Ludo, I did not explicitly include adc_channel.h. The .ino file I uploaded is the file I used. I think the esp32 v1.0.2 configuration I use as described above automatically pulls in ADC2_GPIO2_CHANNEL. Other esp32 versions or other Arduino versions may behave differently. Ed

Patsjemoe commented 1 year ago

Hi Ed, Including soc/adc_channel no longer gives an error, it compiles fine. (ESP32 version 2.0.5) It starts up , connects to internet, wakes up bij timer ,until config camera..then it goes wrong.

Loading initial values from EEPROM

Remote trigger set to 0

Remote IP address set to 0.0.0.0

Email address set to @.***

Motion email action set to 1

Wakeup Time set to 11300

Wakeup caused by timer, power on, or reset - starting config web server

Before startWebServer Free Heap: 202992

After startWebServer Free Heap: 180764

config camera

Before camera init Free Heap: 180564

E (3132) ledc: ledc_stop(661): LEDC is not initialized

Pic, len=10346

Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Core 1 register dump:

PC : 0x400d349f PS : 0x00060c30 A0 : 0x800d3460 A1 : 0x3ffb20d0

A2 : 0x3ffc4ad8 A3 : 0x3ffc4994 A4 : 0xfffffffe A5 : 0x00000000

A6 : 0x3ffcf220 A7 : 0x3ffc498c A8 : 0x3ffc498c A9 : 0x3ffb2090

A10 : 0x00000021 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x00000000

A14 : 0x3ffcf220 A15 : 0x00000000 SAR : 0x00000007 EXCCAUSE: 0x0000001c

EXCVADDR: 0x00000002 LBEG : 0x4008d5d5 LEND : 0x4008d5e5 LCOUNT : 0xfffffffe

Backtrace:0x400d349c:0x3ffb20d00x400d345d:0x3ffb2100 0x400d473f:0x3ffb2120 0x400d5a99:0x3ffb21b0 0x400d63a1:0x3ffb27b0 0x400d6e58:0x3ffb27d0 0x400df8ae:0x3ffb2820

note : with esp32 version 1.0.2 installed, I get following error : Error resolving FQBN: getting build properties for board esp32:esp32:esp32cam: invalid option 'CPUFreq'

Compilation error: Error resolving FQBN: getting build properties for board esp32:esp32:esp32cam: invalid option 'CPUFreq' Compilation error: Error resolving FQBN: getting build properties for board esp32:esp32:esp32cam: invalid option 'CPUFreq'

regards Ludo

On Sun, 6 Nov 2022 at 01:44, mtnbkr88 @.***> wrote:

Hi Ludo, I did not explicitly include adc_channel.h. The .ino file I uploaded is the file I used. I think the esp32 v1.0.2 configuration I use as described above automatically pulls in ADC2_GPIO2_CHANNEL. Other esp32 versions or other Arduino versions may behave differently. Ed

— Reply to this email directly, view it on GitHub https://github.com/mtnbkr88/ESP32CAMRemotePIR/issues/4#issuecomment-1304680416, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMBAJVLHXA7JAXUZB2BD6DWG35P3ANCNFSM6AAAAAARX3UWPA . You are receiving this because you authored the thread.Message ID: @.***>

mtnbkr88 commented 1 year ago

Ludo, There is definitely a difference between your environment and mine. I had trouble with ESP32 versions higher than 1.0.2 so I didn't use them. I used ESP32-CAM boards based on AI thinker. Here are my settings in Arduino.

- Go to Tools->Board->Boards Manager....
- Search for ESP32 and press Install button for "ESP32 by Espressif Systems". (Use version 1.0.2)
- Go to Tools->Board->ESP32 Wrover Module.
- Upload Speed "921600"
- Flash Frequency "80MHz"
- Flash Mode "QIO"
- Partition Scheme "Default 4MB with spiffs" or "Default 4MB with ffat"
  either one should support firmware builds up to 1.3MB and OTA  
- Core Debug Level "None"
- Port "COM6" - can only set this after FTDI adapter is plugged in USB 
  (When using the serial monitor, set its baud rate to 115200)
mtnbkr88 commented 1 year ago

I also installed an ESP Exception Decoder. This will allow you to find the line in your code that is giving an exception. Find and download the EspExceptionDecoder.jar from the internet and install as follows:

mtnbkr88 commented 1 year ago

If you haven't already, you might want to install a basic ESP32 camera example test program from the examples area of Arduino or EspressIf to be sure your board and camera work correctly before trying my program which is more complex.

Patsjemoe commented 1 year ago

Hi Ed, I had done this already, but could not use it yet due to the errors. I tried to install it in version 2.0, but it only works with 1.18 due to java.... regards Ludo

On Sun, 6 Nov 2022 at 18:31, mtnbkr88 @.***> wrote:

I also installed an ESP Exception Decoder. This will allow you to find the line in your code that is giving an exception. Find and download the EspExceptionDecoder.jar from the internet and install as follows:

  • Create folder C:\Users\Owner\Documents\Arduino\tools\EspExceptionDecoder\tool.
  • Place EspExceptionDecoder.jar in it.
  • Restart Arduino IDE. ESP Exception Decoder can now be found under Tools. If an exception occurs, copy the trace dump and paste it into the ESP Exception Decoder window and it will give more clues for what went wrong.

— Reply to this email directly, view it on GitHub https://github.com/mtnbkr88/ESP32CAMRemotePIR/issues/4#issuecomment-1304852376, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMBAJW2LXDC26BSLMDVUBDWG7MPDANCNFSM6AAAAAARX3UWPA . You are receiving this because you authored the thread.Message ID: @.***>

Patsjemoe commented 1 year ago

Hi Ed, Here I used ESP32cam...changed to ESP32 wrover module. Partition scheme in version 1.8.15 is different : I took minimal SPIFFS, large apps with ota... [image: image.png] In both your program as well as a basic esp32cam webserver, I had following error : xtensa-esp32-elf-g++: error: unrecognized command line option '-mfix-esp32-psram-cache-strategy=memw' exit status 1 Error during compilation for board ESP32 Wrover Module Looking further into it... regards Ludo

On Sun, 6 Nov 2022 at 18:24, mtnbkr88 @.***> wrote:

Ludo, There is definitely a difference between your environment and mine. I had trouble with ESP32 versions higher than 1.0.2 so I didn't use them. I used ESP32-CAM boards based on AI thinker. Here are my settings in Arduino.

  • Go to Tools->Board->Boards Manager....
  • Search for ESP32 and press Install button for "ESP32 by Espressif Systems". (Use version 1.0.2)
  • Go to Tools->Board->ESP32 Wrover Module.
  • Upload Speed "921600"
  • Flash Frequency "80MHz"
  • Flash Mode "QIO"
  • Partition Scheme "Default 4MB with spiffs" or "Default 4MB with ffat" either one should support firmware builds up to 1.3MB and OTA
  • Core Debug Level "None"
  • Port "COM6" - can only set this after FTDI adapter is plugged in USB (When using the serial monitor, set its baud rate to 115200)

— Reply to this email directly, view it on GitHub https://github.com/mtnbkr88/ESP32CAMRemotePIR/issues/4#issuecomment-1304850892, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMBAJSJ5B3NAKMNUOW7GIDWG7LSTANCNFSM6AAAAAARX3UWPA . You are receiving this because you authored the thread.Message ID: @.***>

Patsjemoe commented 1 year ago

Hi Ed, I wonder if there is a conflict between different installed versions./..

regards Ludo

On Sun, 6 Nov 2022 at 19:52, Ludo Kustermans @.***> wrote:

Hi Ed, Here I used ESP32cam...changed to ESP32 wrover module. Partition scheme in version 1.8.15 is different : I took minimal SPIFFS, large apps with ota... [image: image.png] In both your program as well as a basic esp32cam webserver, I had following error : xtensa-esp32-elf-g++: error: unrecognized command line option '-mfix-esp32-psram-cache-strategy=memw' exit status 1 Error during compilation for board ESP32 Wrover Module Looking further into it... regards Ludo

On Sun, 6 Nov 2022 at 18:24, mtnbkr88 @.***> wrote:

Ludo, There is definitely a difference between your environment and mine. I had trouble with ESP32 versions higher than 1.0.2 so I didn't use them. I used ESP32-CAM boards based on AI thinker. Here are my settings in Arduino.

  • Go to Tools->Board->Boards Manager....
  • Search for ESP32 and press Install button for "ESP32 by Espressif Systems". (Use version 1.0.2)
  • Go to Tools->Board->ESP32 Wrover Module.
  • Upload Speed "921600"
  • Flash Frequency "80MHz"
  • Flash Mode "QIO"
  • Partition Scheme "Default 4MB with spiffs" or "Default 4MB with ffat" either one should support firmware builds up to 1.3MB and OTA
  • Core Debug Level "None"
  • Port "COM6" - can only set this after FTDI adapter is plugged in USB (When using the serial monitor, set its baud rate to 115200)

— Reply to this email directly, view it on GitHub https://github.com/mtnbkr88/ESP32CAMRemotePIR/issues/4#issuecomment-1304850892, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMBAJSJ5B3NAKMNUOW7GIDWG7LSTANCNFSM6AAAAAARX3UWPA . You are receiving this because you authored the thread.Message ID: @.***>

Patsjemoe commented 1 year ago

Hi Ed, ....sorry for hte many mails.... I had installed version 1.02, but it seems you need to do also an update ....now I can select the right Default 4MB with spiffs Still errors....but moving forward... regards Ludo

On Sun, 6 Nov 2022 at 19:52, Ludo Kustermans @.***> wrote:

Hi Ed, Here I used ESP32cam...changed to ESP32 wrover module. Partition scheme in version 1.8.15 is different : I took minimal SPIFFS, large apps with ota... [image: image.png] In both your program as well as a basic esp32cam webserver, I had following error : xtensa-esp32-elf-g++: error: unrecognized command line option '-mfix-esp32-psram-cache-strategy=memw' exit status 1 Error during compilation for board ESP32 Wrover Module Looking further into it... regards Ludo

On Sun, 6 Nov 2022 at 18:24, mtnbkr88 @.***> wrote:

Ludo, There is definitely a difference between your environment and mine. I had trouble with ESP32 versions higher than 1.0.2 so I didn't use them. I used ESP32-CAM boards based on AI thinker. Here are my settings in Arduino.

  • Go to Tools->Board->Boards Manager....
  • Search for ESP32 and press Install button for "ESP32 by Espressif Systems". (Use version 1.0.2)
  • Go to Tools->Board->ESP32 Wrover Module.
  • Upload Speed "921600"
  • Flash Frequency "80MHz"
  • Flash Mode "QIO"
  • Partition Scheme "Default 4MB with spiffs" or "Default 4MB with ffat" either one should support firmware builds up to 1.3MB and OTA
  • Core Debug Level "None"
  • Port "COM6" - can only set this after FTDI adapter is plugged in USB (When using the serial monitor, set its baud rate to 115200)

— Reply to this email directly, view it on GitHub https://github.com/mtnbkr88/ESP32CAMRemotePIR/issues/4#issuecomment-1304850892, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMBAJSJ5B3NAKMNUOW7GIDWG7LSTANCNFSM6AAAAAARX3UWPA . You are receiving this because you authored the thread.Message ID: @.***>

mtnbkr88 commented 1 year ago

Glad you are making progress. I don't think the example camera program worked for me the first time either. Like I said, work on getting the example camera program working. Once you get that working it should be simple to get my program working. My program uses OTA for firmware updates so you will need to choose a partition scheme that supports OTA. I don't use spiffs so your choice if you want to allocate space for spiffs.

Patsjemoe commented 1 year ago

Hi Ed, Did a new clean install of 1.8.15 with espressif 1.0.2, and it works now 😀....touch wood it will stay that way . I must admit, when seeing soo many errors yesterday, it made me feel like it would never work.... WIth the installation of 1.8.15, I then had also issues with my arduino 2.0 version, but it seems that the espressif board version 1.02 that I installed, also is installed in the version 2.0...I am not sure if there is a way to be sure the version remains only in the arduino version where you install it.... Ludo

Op zo 6 nov. 2022 22:29 schreef mtnbkr88 @.***>:

Glad you are making progress. I don't think the example camera program worked for me the first time either. Like I said, work on getting the example camera program working. Once you get that working it should be simple to get my program working. My program uses OTA for firmware updates so you will need to choose a partition scheme that supports OTA. I don't use spiffs so your choice if you want to allocate space for spiffs.

— Reply to this email directly, view it on GitHub https://github.com/mtnbkr88/ESP32CAMRemotePIR/issues/4#issuecomment-1304898366, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMBAJQAZBS2UZSZ3RKTGQLWHAILLANCNFSM6AAAAAARX3UWPA . You are receiving this because you authored the thread.Message ID: @.***>

Patsjemoe commented 1 year ago

Hi Ed, From the Arduino forum I received following : (was not 100% sure...). 1.8.15 has the log4j security vulnerability; you're advised to upgrade to 1.8.19 or go back a few to before 1.8.13 Just that you know it may have an issue... regards Ludo

On Mon, 7 Nov 2022 at 12:07, Ludo Kustermans @.***> wrote:

Hi Ed, Did a new clean install of 1.8.15 with espressif 1.0.2, and it works now 😀....touch wood it will stay that way . I must admit, when seeing soo many errors yesterday, it made me feel like it would never work.... WIth the installation of 1.8.15, I then had also issues with my arduino 2.0 version, but it seems that the espressif board version 1.02 that I installed, also is installed in the version 2.0...I am not sure if there is a way to be sure the version remains only in the arduino version where you install it.... Ludo

Op zo 6 nov. 2022 22:29 schreef mtnbkr88 @.***>:

Glad you are making progress. I don't think the example camera program worked for me the first time either. Like I said, work on getting the example camera program working. Once you get that working it should be simple to get my program working. My program uses OTA for firmware updates so you will need to choose a partition scheme that supports OTA. I don't use spiffs so your choice if you want to allocate space for spiffs.

— Reply to this email directly, view it on GitHub https://github.com/mtnbkr88/ESP32CAMRemotePIR/issues/4#issuecomment-1304898366, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMBAJQAZBS2UZSZ3RKTGQLWHAILLANCNFSM6AAAAAARX3UWPA . You are receiving this because you authored the thread.Message ID: @.***>

mtnbkr88 commented 1 year ago

Hi Ludo, I very happy to hear you got it working. I'm not losing any sleep over security vulnerabilities in my ESP32 projects. Thanks for letting me know. If you install Arduino 1.8.19 with espressif 1.0.2 and get it working please let me know. Enjoy! Ed

Patsjemoe commented 1 year ago

Hi Ed, I tested with arduino 1.8.19 and espressif 1.0.2 and it worked well. Just 1 more question : I saw that you connect directly the output of the pir (5V) to the esp32cam. It is difficult to find a datasheet showing if the GPIO pins are 5V tolerant.....you never had any issue ? Or did you get confirmation that they are 5V tolerant ? I can also change to a 3.3V level with a transistor, levels are then reversed....this is also OK, but have to change also the conditional checks on the level op GPIO13 further in the program...how many places should I find ? regards Ludo

On Mon, 7 Nov 2022 at 17:47, mtnbkr88 @.***> wrote:

Hi Ludo, I very happy to hear you got it working. I'm not losing any sleep over security vulnerabilities in my ESP32 projects. Thanks for letting me know. If you install Arduino 1.8.19 with espressif 1.0.2 and get it working please let me know. Enjoy! Ed

— Reply to this email directly, view it on GitHub https://github.com/mtnbkr88/ESP32CAMRemotePIR/issues/4#issuecomment-1305892022, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMBAJTK4ATO5QU646ZDPM3WHEXB3ANCNFSM6AAAAAARX3UWPA . You are receiving this because you authored the thread.Message ID: @.***>

mtnbkr88 commented 1 year ago

Hi Ludo, Glad to hear Arduino 1.8.19 and espressif 1.0.2 are good. I've been running my PIR setup for years and there is definitely no issue with using the 5V out from the PIR. For a while I did use a transistor between the PIR and ESP32 but it did not work well. Also, the PIR I use is HC-SR501. I had a lot of problems with false positives but after much research I found that putting a 220nF capacitor between pins 12 and 13 on the main chip as shown here (https://redfox314.tweakblogs.net/blog/16895/esp8266-and-hc-sr501-false-positives) solved it. My solar setup has been rock solid sitting on top of a fence post watching my driveway for years. Ed