Commit Graph

357 Commits

Author SHA1 Message Date
Rodrigo Garcia
b1d072df9f
Implements UART SerialHardware Refactoring on top of IDF (#5549)
## Summary
This PR is a complete reffactoring of UART Serial Hardware and respective HAL in order to use IDF instead of current Register manipulation approach. 

It  implements Arduino SerialEvent functionality. 

Fix #5287  
Fix #5273 
Fix #5519 
Fix #5247 
Fix #5403
Fix #5429
Fix #5047
Fix #5463
Fix #5362 
Fix #5112  
Fix #5443 

## Impact
It solves many reported issues related to UART.
It was tested and works fine for ESP32, ESP-S2 and ESP32-C3.
2021-08-23 17:25:33 +03:00
Lori
94809ce38b
fix: timerRead() is returning the last read value, not the actual #3434 (#5498) 2021-08-23 17:19:37 +03:00
Me No Dev
90c01dab77
Fix build error in ESP-IDF
Fixes: https://github.com/espressif/arduino-esp32/issues/5562
2021-08-19 13:54:10 +03:00
me-no-dev
b580bb23fd Add log_buf to pretty print buffers
```
/* 0x0000 */ 0x7b, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // {{..............
/* 0x0010 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // ................
```
2021-08-17 17:01:16 +03:00
Rodrigo Garcia
2af8cc3485
Fixes Touchpad Interrupt (#5527)
Fixes #5493 

## Summary
PR #4996 has broken Touch Interrupt functionality by removing a single line of code used to set a Register.


## Impact
This PR fixes issue #5493 by reverting the removal of necessary code as described above.
2021-08-12 10:05:47 +03:00
Me No Dev
e5bd18d6aa
Fix I2C Scan for S2 and C3 (#5528)
Thanks @chegewara

I2C Scan was failing because i2c_master_write does not accept size of 0. This change checks and skips that call if no length is provided (usually when scanning)
2021-08-12 10:03:33 +03:00
Me No Dev
0b0dfab3cf
Fix race in log_printf (#5523)
Fixes: https://github.com/espressif/arduino-esp32/issues/5513

Can still race if Serial.begin() is not called in setup()
2021-08-11 13:46:08 +03:00
Me No Dev
5fd737925f
Fix wrong attenuation being set to pins (#5522)
Fixes: https://github.com/espressif/arduino-esp32/issues/5503
2021-08-11 13:05:26 +03:00
Me No Dev
5bb8177aa1
Add initial support for USB MSC (#5466)
* Add initial support for USB MSC

* Add Firmware Upload/Download With MSC

Current running firmware is available as file inside the MSC Disk. To update the firmware on the ESP, just copy a regular firmware bin into the drive

* Support overwriting of the firmware file

Overwriting a file is done totally differently on MacOS, Windows and Linux. This change supports it on all of them.

* Allow CDC, FirmwareMSC and DFU to be enabled on boot

* Add example ESP32-S2 USB-ONLY board

* Various device code optimizations

Added `end()` methods to MSC classes
Made begin() methods safe to be called multiple times
Optimized CDC class

* Fix CDC Connect/Disconnect detection in Arduino IDE on Windows

* Rework cdc_write

* Update ESP32-S2 board configs
2021-08-02 15:35:13 +03:00
me-no-dev
023ae75b97 Rework pulseIn to work on ESP32-C3
Fixes: https://github.com/espressif/arduino-esp32/issues/5488
2021-08-02 14:53:11 +03:00
chegewara
9406f8e464
Weaken tinyusb callbacks (#5475) 2021-07-29 14:52:30 +03:00
Rodrigo Garcia
65eafd16b5
Fixes ESP32-S2 LEDC PWM #5375 #5050 (#5452)
Fixes: #5375
Fixes: #5050
2021-07-26 20:37:44 +03:00
rtrbt
3780b5c924
Unbreak integer to string conversion functions. (#5423) (#5438) 2021-07-26 16:06:13 +03:00
vortigont
34125cee1d
Examples update, add a note for configTime() that only one ntp server is supported by lwip (#5343)
lwip lib bundled with esp32 Arduino supports only one ntp server. Any additional servers set are just silently ignored.
This default is different from esp8266 Arduino core and very confusing. Most of the examples provided uses 3 different ntp servers for redundancy while only the first one is used actually.
Addressing issue #4964
2021-07-22 20:09:28 +03:00
Rodrigo Garcia
5458df0a54
Fixes Serial.end() hanging on ESP32-S2 (#5434)
Fixes: #5429
2021-07-21 17:02:06 +03:00
me-no-dev
4ada3f5804 Fix Windows USB issues
- Device will not reset if previous baudrate was not 9600
- CDC Device is not recognized if WebUSB is enabled
2021-07-20 13:36:27 +03:00
Me No Dev
268595c743
Various USB fixes (#5422)
* Fix compile archive arguments for the new toolchain

* Add menu to S2 for picking through which port to upload

Internal USB CDC requires to reset and wait for the new port (because persistence is not yet stable)

* USB CDC should also be started in main

* Fix URL and USB version for WebUSB

* Update vendor callback API

* Update CDC::write to use TX_DONE semaphore

* Update USB_Serial example
2021-07-20 11:59:13 +03:00
Me No Dev
16f4b0f5ba
IDF master d93887f9f (#5336)
* Update toolchain

* Update package_esp32_index.template.json

* add optional component dependencies after Kconfig options are known (#5404)

Until this commit, Kconfig options (e.g. CONFIG_TINYUSB_ENABLED) were
used in conditions preceding idf_component_register to determine which
components need to be added to `arduino` component requirements.
However the Kconfig options aren't known at the early expansion stage,
when the component CMakeLists.txt files are expanded the first time
and requirements are evaluated. So all the conditions evaluated as if
the options were not set.
This commit changes the logic to only add these components as
dependencies when the Kconfig options are known. Dependencies become
"weak", which means that if one of the components isn't included into
the build for some reason, it is not added as a dependency.
This may happen, for example, if the component is not present in the
`components` directory or is excluded by setting `COMPONENTS` variable
in the project CMakeLists.txt file.
This also ensures that if the component is not present, it will not be
added as a dependency, and this will allow the build to proceed.

Follow-up to https://github.com/espressif/arduino-esp32/pull/5391.
Closes https://github.com/espressif/arduino-esp32/issues/5319.

* IDF master d93887f9f

* PlatformIO updates for CI (#5387)

* Update PlatformIO CI build script

- Switch to the latest toolchains 8.4.0 for ESP32, ESP32S2, ESP32C3
- Use PlatformIO from master branch for better robustness

* Update package.json for PlatformIO

Co-authored-by: Ivan Grokhotkov <ivan@espressif.com>
Co-authored-by: Valerii Koval <valeros@users.noreply.github.com>
2021-07-17 01:57:49 +03:00
Ivan Grokhotkov
eac8b2def3
fix port{Input,Output,Mode}Register macros for chips with <=32 pins (#5402)
Closes https://github.com/espressif/arduino-esp32/issues/5378
2021-07-16 23:42:08 +03:00
Me No Dev
a9bd39de66
Fix pin attenuation being overwritten (#5399)
Fixes: #5041
2021-07-16 17:34:25 +03:00
Me No Dev
dd25e2b9d6
Fix some WiFi issues (#5395)
* Add back ARDUINO_EVENT_WIFI_READY

Fixes: https://github.com/espressif/arduino-esp32/issues/5315

* use strncpy and strncmp for WiFi SSID and Password in AP and STA

Fixes: https://github.com/espressif/arduino-esp32/issues/5367

* Implement timeout for waitForConnectResult

Fixes: https://github.com/espressif/arduino-esp32/issues/5330

* Remove old definition of "reverse" from stdlib_noniso

Fixes: https://github.com/espressif/arduino-esp32/issues/5045

* Make "reverse" noniso conditional on ESP_DSP
2021-07-16 14:48:57 +03:00
Rodrigo Garcia
676f5cfe30
fix UART FIFO test for being full (#5390)
Fixes #5362
2021-07-16 03:21:49 +03:00
Rodrigo Garcia
f4f1c8956b
pinMatrixInDetach() has wrong parameter (#5385)
Fixes #5112
Call to pinMatrixInDetach() was changed from version 1.0.6 in version 2.0.0 injecting a bug as seen in cores/esp32/esp32-hal-uart.c
80418fadcf

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2021-07-15 02:07:43 +03:00
me-no-dev
cbcba53dff Improve error message when ADC2 can not be used because WiFi is On
reference: https://github.com/espressif/arduino-esp32/issues/102
2021-07-08 13:58:17 +03:00
me-no-dev
8f46bade7a Fix hardware timers
Fixes: https://github.com/espressif/arduino-esp32/issues/5337
Fixes: https://github.com/espressif/arduino-esp32/issues/4743

Thanks to @maxgerhardt
2021-06-28 15:44:30 +03:00
Clemens Kirchgatterer
21947ebe76
Make String::concat() faster for some types. (#5307)
* Make String::concat() faster for some types.

This patch removes the unneeded call to `strlen()` when concatenating some types to a `String`. Additionally it fixes some whitespace for consistency.

* Update WString.cpp
2021-06-18 13:10:40 +03:00
Jason2866
ea236e28e5
Fix incorrect Flash Size in Esp32c3 (#5279)
original PR #5278 from @s-hadinger, which is not accepted because of failure of CLAassistant

`ESP.getFlashChipSize()` always returns `0` on Esp32c3 due to a change in the Flash layout. It looks like to Espressif documentation was not updated accordingly.

https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/api-reference/storage/spi_flash.html#spi-flash-size

- Esp32 and Esp32s3 have the flash information update by esptool.py
and decribed here
- https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/spi_flash.html
Esp32c3 has no image information at 0x0000 and contrary to the docu
this information is at offset 0x0000
2021-06-11 13:46:14 +03:00
lbernstone
b5ee7ddeed
Convert hall read to use hal/idf (#5268)
Fixes #4866
2021-06-10 11:58:08 +03:00
Dirk O. Kaar
77f504453f
WMath.cpp doesn't include Arduino.h, where makeWord(h, l) is declared, common denominator type therefore is uint8_t, which is in use already in Arduino.h, too. (#5230)
Fixes #5229
2021-06-09 12:40:08 +03:00
Me No Dev
a618fc1361
IDF master c13afea63 (#5214)
esp-dsp: master 7cc5073
esp-face: master 420fc7e
esp-rainmaker: f1b82c7
esp32-camera: master 6f8489e
esp_littlefs: master b58f00c
2021-05-31 16:32:51 +03:00
Ato Araki
a1d8b959b0
Fix length typo (#5189) 2021-05-18 14:01:20 +03:00
Clemens Kirchgatterer
2082945d36
Make LOOP_STACK_SIZE user configurable at compile-time. (#5173)
This PR lets the user override the LOOP STACK SIZE set in sdkconfig (for example with -DARDUINO_LOOP_STACK_SIZE=12288).
2021-05-18 13:58:56 +03:00
me-no-dev
82161bebe3 Use cpu_hal_get_cycle_count for all chips 2021-04-19 14:25:09 +03:00
Basile
55b8f67d80
In esp32-hal-log, direct calls to ESP_LOG_x macros is more efficient than using intermediate function log_to_esp (#5081)
As indicated in https://github.com/espressif/arduino-esp32/issues/4845#issuecomment-820540642_ it is more efficient to call directly the ESP LOG macros. This spares a function call, a 512b buffer and a call to vsnprintf. No change in functionality.
2021-04-19 12:30:01 +03:00
lbernstone
b45cf11ff1
Fixed ESP::getCycleCount for S2/C3 (#5075)
Fixes #5071
2021-04-19 12:28:06 +03:00
Richard Strassheim
01c8cae0dc
Added method to change the ledc PWM frequency programmatically (#5003)
Added method to change the ledc PWM frequence programmatically
Returning frequency from ledcChangeFrequency
2021-04-17 02:06:58 +03:00
lbernstone
9f1330c70c
esp32s2 temp sensor (#5044) 2021-04-15 14:32:03 +03:00
Unexpected Maker
ec7aeb4903
Removed ProS2 and added TinyS2 to boards.txt (#5037) 2021-04-15 14:31:41 +03:00
lbernstone
81b7c47203
Serial::end hang (#5047)
workaround for #5043. There is a timing issue with HardwareSerial::end. I'm not sure what is hung, but it should be possible to see this in jtag, as it does cause a reboot if you let it. The delay needs to be before you detach the device!?
2021-04-15 12:46:53 +03:00
Me No Dev
404a31f445
Initial Esp32c3 Support (#5060) 2021-04-14 18:10:05 +03:00
me-no-dev
371f382db7 Fix Serial RX and add option for FIFO Full Threshold in Serial.begin
Fixes: https://github.com/espressif/arduino-esp32/issues/5005
2021-04-08 15:29:53 +03:00
me-no-dev
425619dfea Fix upload over USB CDC (USB serial must be set to 0) 2021-04-05 20:24:46 +03:00
me-no-dev
8645971981 Fix delayMicroseconds() to use 64bit period
fixes: https://github.com/espressif/arduino-esp32/issues/5000
2021-04-05 15:15:09 +03:00
Me No Dev
5502879a5b
v2.0.0 Add support for ESP32S2 and update ESP-IDF to 4.4 (#4996)
This is very much still work in progress and much more will change before the final 2.0.0

Some APIs have changed. New libraries have been added. LittleFS included.

Co-authored-by: Seon Rozenblum <seonr@3sprockets.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: geeksville <kevinh@geeksville.com>
Co-authored-by: Mike Dunston <m_dunston@comcast.net>
Co-authored-by: Unexpected Maker <seon@unexpectedmaker.com>
Co-authored-by: Seon Rozenblum <seonr@3sprockets.com>
Co-authored-by: microDev <70126934+microDev1@users.noreply.github.com>
Co-authored-by: tobozo <tobozo@users.noreply.github.com>
Co-authored-by: bobobo1618 <bobobo1618@users.noreply.github.com>
Co-authored-by: lorol <lorolouis@gmail.com>
Co-authored-by: geeksville <kevinh@geeksville.com>
Co-authored-by: Limor "Ladyada" Fried <limor@ladyada.net>
Co-authored-by: Sweety <switi.mhaiske@espressif.com>
Co-authored-by: Loick MAHIEUX <loick111@gmail.com>
Co-authored-by: Larry Bernstone <lbernstone@gmail.com>
Co-authored-by: Valerii Koval <valeros@users.noreply.github.com>
Co-authored-by: 快乐的我531 <2302004040@qq.com>
Co-authored-by: chegewara <imperiaonline4@gmail.com>
Co-authored-by: Clemens Kirchgatterer <clemens@1541.org>
Co-authored-by: Aron Rubin <aronrubin@gmail.com>
Co-authored-by: Pete Lewis <601236+lewispg228@users.noreply.github.com>
2021-04-05 14:23:58 +03:00
me-no-dev
a31f30529d fix spiTransferBytesNL() writes past end of data_out
Fixes: https://github.com/espressif/arduino-esp32/issues/4935
2021-03-15 10:40:50 +02:00
me-no-dev
8dc70e0add Revert "Update licenses"
This reverts commit 4b3f5c8ed4.
2021-03-11 12:11:53 +02:00
me-no-dev
93d5b8c672 Fix String::replace()
Fixes: https://github.com/espressif/arduino-esp32/issues/4920
2021-03-10 17:13:14 +02:00
me-no-dev
4d95e3a7ea Fix BT not starting correctly and SPP Coex not working
Fixes: https://github.com/espressif/arduino-esp32/issues/4912
2021-03-09 01:56:47 +02:00
me-no-dev
dd834b3372 Ensure that String::setLen() is always after any memory operation
Since `String::setLen()` is now modifying the buffer, this change is required to ensure that the proper buffer is changed.
2021-03-05 12:00:39 +02:00
me-no-dev
0e55f775d3 Fixing issue in String::remove 2021-03-04 22:41:46 +02:00