You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 4, 2023. It is now read-only.
4.***To be able to compile without error and automatically detect and display BOARD_NAME on Arduino SAMD (Nano-33-IoT, etc) boards***, you have to copy the whole [Arduino SAMD cores 1.8.8](Packages_Patches/arduino/hardware/samd/1.8.8) directory into Arduino SAMD directory (~/.arduino15/packages/arduino/hardware/samd/1.8.8).
160
+
4.***To be able to compile without error and automatically detect and display BOARD_NAME on Arduino SAMD (Nano-33-IoT, etc) boards***, you have to copy the whole [Arduino SAMD cores 1.8.9](Packages_Patches/arduino/hardware/samd/1.8.9) directory into Arduino SAMD directory (~/.arduino15/packages/arduino/hardware/samd/1.8.9).
161
161
162
-
Supposing the Arduino SAMD version is 1.8.8. These files must be copied into the directory:
Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z
167
167
@@ -230,6 +230,45 @@ To use the old standard cpp way, just
230
230
---
231
231
---
232
232
233
+
### HOWTO Use analogRead() with ESP32 running WiFi and/or BlueTooth (BT/BLE)
234
+
235
+
Please have a look at [**ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example**](https://github.com/khoih-prog/ESP_WiFiManager/issues/39) to have more detailed description and solution of the issue.
236
+
237
+
#### 1. ESP32 has 2 ADCs, named ADC1 and ADC2
238
+
239
+
#### 2. ESP32 ADCs functions
240
+
241
+
- ADC1 controls ADC function for pins **GPIO32-GPIO39**
242
+
- ADC2 controls ADC function for pins **GPIO0, 2, 4, 12-15, 25-27**
243
+
244
+
#### 3.. ESP32 WiFi uses ADC2 for WiFi functions
245
+
246
+
Look in file [**adc_common.c**](https://github.com/espressif/esp-idf/blob/master/components/driver/adc_common.c#L61)
247
+
248
+
> In ADC2, there're two locks used for different cases:
249
+
> 1. lock shared with app and Wi-Fi:
250
+
> ESP32:
251
+
> When Wi-Fi using the ADC2, we assume it will never stop, so app checks the lock and returns immediately if failed.
252
+
> ESP32S2:
253
+
> The controller's control over the ADC is determined by the arbiter. There is no need to control by lock.
254
+
>
255
+
> 2. lock shared between tasks:
256
+
> when several tasks sharing the ADC2, we want to guarantee
257
+
> all the requests will be handled.
258
+
> Since conversions are short (about 31us), app returns the lock very soon,
259
+
> we use a spinlock to stand there waiting to do conversions one by one.
260
+
>
261
+
> adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock.
262
+
263
+
264
+
- In order to use ADC2 for other functions, we have to **acquire complicated firmware locks and very difficult to do**
265
+
- So, it's not advisable to use ADC2 with WiFi/BlueTooth (BT/BLE).
266
+
- Use ADC1, and pins GPIO32-GPIO39
267
+
- If somehow it's a must to use those pins serviced by ADC2 (**GPIO0, 2, 4, 12, 13, 14, 15, 25, 26 and 27**), use the **fix mentioned at the end** of [**ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example**](https://github.com/khoih-prog/ESP_WiFiManager/issues/39) to work with ESP32 WiFi/BlueTooth (BT/BLE).
0 commit comments