I´m doing a small project with Arduino iot cloud. I only use a simply code for relays control with an esp32 repo:
My esp32 controller is giving this error:
[430093][E][esp32-hal-adc.c:170] __analogRead(): GPIO0: ESP_ERR_TIMEOUT: ADC2 is in use by Wi-Fi. Please see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/adc.html#adc-limitations for more info
I found this thread closed a time ago but it diden´t helps me.
I'm not using analog pins. I tried to remove my realys control code and leave only the connection code and still is giving this error.
Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.
Hi @jhonnyfc
I have posted on this forum before for this bug and I hope this helps you.
The bug is in ...\ArduinoIoTCloud\src\utility\time\NTPUtils.cpp in the function
int NTPUtils::getRandomPort(int const min_port, int const max_port)
{ #ifdef BOARD_HAS_ECCX08
return ECCX08.random(min_port, max_port); #else
randomSeed(__analogRead(0));
return random(min_port, max_port); #endif
}
If I am correct, the line randomSeed(__analogRead(0)); is intended to read a random/floating voltage from GIO0 and simply use it as a seed in the next line that returns a random port number.
This is an issue on all my ES32 programs that talk to ArduinoIOCloud.
My work-around is to modify the line to randomSeed(0);
This stops it throwing the error. Since I am not using time functions it doesn't appear to create a problem. However the 'random number' generated will always be the same as it reseeds with the same value every call and takes the first value in the random number sequence.
If that worries you you could comment out the whole line and the random number will be taken as the next value in the sequence.
I use PlatformIO as my IDE which makes finding and 'fixing' this easy. I am not sure how you would do it in Arduino IDE.
Hi @mick3000,
I have the same problem but i cannot locate the file in question. I'm using platform io, could you help with some more detailed instructions on where exactly this file is located?
Thanks!
In your project in Platform IO you should navigate to Your Project.pio\libdeps\esp32dev\ArduinoIoTCloud\src\utility\time\NTPUtils.cpp
The following code starts at row 93
int NTPUtils::getRandomPort(int const min_port, int const max_port)