Commit Graph

331 Commits

Author SHA1 Message Date
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
me-no-dev
22a488cf23 Fix String::clear() not clearing the string properly
Fixes: https://github.com/espressif/arduino-esp32/issues/4893
2021-03-04 21:20:27 +02:00
Aron Rubin
bd3addeb8e
Fixed use of Bluedroid instead of BT in HAL. (#4879)
Fixed use of CONFIG_BLUEDROID_ENABLED instead of CONFIG_BT_ENABLED in HAL. This prevented compilation with Nimble-only configuration without apparent benefit.
2021-03-01 23:55:04 +02:00
lbernstone
3fe7c2e8cd
Add div by zero check back into WMath::map (#4853)
* Add div by zero check back into WMath::map
* include esp32-hal-log.h

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2021-02-24 19:04:36 +02:00
martirius
b8dab5ed1a
Added possibility to use ESP32-IDF log insted of redefined one (#4845)
With this PR user can select to use the original ESP-IDF log instead of the redefined one.

User can also redefine the log function as per [Logging Library](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/log.html#_CPPv419esp_log_set_vprintf14vprintf_like_t) so he can for example redirect logs to a file.

To enable this change just add -DUSE_ESP32_LOG to build flags.
User can also change the default TAG (that now is ES32) to whatever it wants adding '-DTAG="tag_value"' to build flags
2021-02-23 00:18:15 +02:00
me-no-dev
4b3f5c8ed4 Update licenses 2021-02-18 12:14:35 +02:00
estshorter
55442a05a4
Remove an unused variable 'channel' (#4725) 2021-01-21 14:31:25 +02:00
drmpf
15db297130
availableForWrite (#4664)
added availableForWrite to Print.h to make compatible with Arduino Print.h
2021-01-11 11:43:10 +02:00
kabir-plod
a0ef17a9dd
Use non-deprecated DPORT values in SPI HAL (#4682) 2021-01-11 11:40:18 +02:00
Nikhil Choudhary
be77bd4e27
Resolve crash with timer interrupt functions called from ISR (#4684) 2021-01-11 11:39:39 +02:00
coylen
7d5bf9e385
[1.0.5] Make looptask stack size configurable (#4564)
Added guarded define to set the stacksize on the main looptask.
Advantage of this is that build_flags can be used to provide a different value for the stack size should it be neccessary
default behaviour is unaffected
2020-12-02 11:52:04 +02:00
Pavel Melnikov
534f0810a6
fix bitWrite macro (#4507)
Fixes https://github.com/espressif/arduino-esp32/issues/4466
2020-11-09 17:08:13 +02:00
M Hotchin
28a8073069
Fix issue 4095 (#4503)
pgmspace.h missing 'pgm_get_far_address'
2020-11-08 04:55:59 +02:00
Mark D
56a7ae8712
Trailing spaces (#3738)
* fix typo in WiFiMulti

* clean up trailing spaces

* clean up script file used in cleaning

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2020-11-02 22:11:26 +02:00
sasaki takeru
3491ca7845
Add virtual beginMulticast(...) stub to UDP class (#4061)
https://github.com/arduino/ArduinoCore-sam/pull/6/files

It is used here:
https://github.com/arduino-libraries/ArduinoMDNS/blob/master/MDNS.cpp#L150
2020-11-02 20:26:50 +02:00
Alexandre Trevizoli
25bd585c25
Corrections of Stream.Find, FindUntil and added FindMulti - like AVR-Core Libraries (#3442)
* Corrections of Find, FindUntil and FindMulti

Find has some bug that is not working with Ethernet.find() so, I copied code from Stream.h and Stream.cpp in AVR-CORE library and now it's working perfectly.
I don't know where was the error, but an Ethernet.find compiled to MEGA2560 was working but not working when compiled to esp32, after corrections of code (copy of AVR-Core libraries) it's working perfect.
So probably has some error on original ESP32-Core library.

Below is part of code that was working with MEGA2560 and not with ESP32 libraries.
client.find never return TRUE with ESP32 original library and with AVR it's works.

boolean esp32_fw_update(EthernetClient &client, DecodedHeader &header, const String &field_filename, const String &field_crc) {

  char bound[header.boundary.length()+3];
  char term[]="\r\n";
  
  strcpy(bound,header.boundary.c_str());
  strcat(bound,term);
  while (client.find(bound)) { 
    String line=client.readStringUntil('\r');

* Update Stream.h

* Update Stream.cpp

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2020-10-14 15:20:40 +03:00
Dirk-Willem van Gulik
d79a1f3d10
Add an aditional (void *) arg to the RMT callback (much like Ticker() et.al.). (#3345)
* Add an aditional (void *) arg to the RMT callback - to allow more flexible handling of the callback (e.g. by passing a private struct or a class pointer). Same pattern as used by the Ticker() and many others. Example updated & new example with a trapoline added.

* Fix example for new API

* Fix lint warnings

* Add a second missed example.

* Correct timeout & improve socket error handling.
2020-10-14 14:41:50 +03:00
lienbacher
2243081f85
add I2C_RX_FIFO_OVF_INT_ST handling to i2c_isr_handler_default (#4342)
Fixes crash on ESP32 when I2C FiFo overflows and interrupt function is unable to handle crash and throws this error:
[E][esp32-hal-i2c.c:1013] i2c_isr_handler_default(): unknown int=4

Co-authored-by: 0xDEADBEEF <0xde4dbeef@gmail.com>
2020-10-01 15:40:42 +03:00
lbernstone
a9cb7c6d6f
mismatched parameter names. Fixes #4310 (#4313) 2020-10-01 15:35:40 +03:00
Bert Melis
f98fc7ee9f
fix hwSerial tx only flush (#4263) 2020-10-01 15:30:45 +03:00
brian-r-calder
8fcc914853
Added facility to invert the polarity of input UART bits. (#4200) 2020-10-01 13:58:48 +03:00
TANAKA Masayuki
a55265f74b
Fix clockCyclesPerMicrosecond Change from fixed value to current value (#3993) 2020-09-30 15:16:20 +03:00
robertpoll
c18d50cb91
Use esp_partition_* functions in Updater.cpp (#3898)
Background

The current implementation of Update() uses the spi_flash_* api to write and read from flash. These functions ignore the partition->encrypted flag and always write raw data to flash even if the partition is marked as encrypted.

Changes in this PR

Update() now uses the esp_partition_* api.
Wrapper functions for esp_partition_* added to ESP.cpp. This was done to maintain a consistent approach to the way the spi_flash_* functions were used. I note though that not all of the esp-idf functions are used are wrapped, for example esp_ota_get_next_update_partition() so it may be that these should not be added?
The current implementation of Update() changes the first (magic) byte of firmware to 0xFF on write, and then when the firmware is completely written changes it back to ESP_IMAGE_HEADER_MAGIC. This works without erasing the sector because flash bits can be changed from 1->0 (but not 0->1). If the flash is encrypted then the actual data written to flash will not be all ones, so this approach will not work. In addition, encrypted flash must be written in 16 byte blocks. So, instead of changing the first byte the changed code stashes the first 16 bytes, and starts writing at the 17th byte, leaving the first 16 bytes as 0xFF. Then, in _enablePartition() the stashed bytes can be successfully written.
Benefits

Whilst it's not possible to use encrypted flash directly from either the Arduino IDE or PIO it's reasonably straightforward to compile and flash a bootloader with the necessary support from a simple esp-idf project and then use ArduinoOTA for subsequent updates. This PR enables the use of this workflow until such time as encrypted flash is supported, and is a first (small) step toward adding support.
Regardless of the above, the esp_partition_* api is recommended over the api_flash_* api.
Application code should mostly use these esp_partition_* API functions instead of lower level spi_flash_* API functions. Partition table API functions do bounds checking and calculate correct offsets in flash, based on data stored in a partition table.
2020-09-30 15:06:19 +03:00
lbernstone
80418fadcf
Fixes UART detach. Fixes #3878 (#3894)
* Fixes UART detach.  Fixes #3878

* 0 is not a good holder value for pins!

* 0 is not a good holder value for pins!
2020-09-30 15:04:18 +03:00
Martijn Scheepers
7e9d42da68
ESP.getChipModel() and ESP.getChipCores() (#3847)
* ESP.getChipModel() returns model of the chip

* ESP.getChipCores() returns the core count.

* Example gives chip model, revision and core count.

* Read efuse for chipmodel

Co-authored-by: Martijn Scheepers <ms@SDNengineering.nl>
2020-09-30 14:57:36 +03:00
Admar Schoonen
e34e0b45de
Fixed bug where mutex would not be unlocked (#3837)
Fixed bug where uartResizeRxBuffer() did not unlock mutex if creation of queue failed.
2020-09-30 14:56:41 +03:00
Dirk O. Kaar
4204869ec9
Extend Print class for 64bit integers. (#3688)
* Extend Print class for 64bit integers.

modulo 32bit and 64bit tuned for code size.

* Fix 32bit long used in long long printNumber.
2020-09-30 14:31:36 +03:00