1. Fix WiFi timer enable twice issue
2. Fix a softAP compatibility issue
3. Fix ebuf alloc counter issue
4. remove nvs_flash_init() in esp_wifi_init()
5. Fix scan only find few APs after set bssid
6. Fix can not connect to hidden SoftAP
7. Remove group key entry before connecting ot AP
Moves the ets_timer_arm() / ets_timer_disarm() code paths to RAM
Overhead is 740 bytes of IRAM, 0 bytes DRAM
(For comparison: If all of esp_timer.c is moved to RAM, overhead is 1068 bytes IRAM and 480 bytes DRAM.)
Some frameworks based on ESP-IDF need to be able to decide whether to
initialize SPI RAM after the application has started. This change splits
out part of esp_spiram_init which manipulate cache MMU into a separate
function. Applications can disable cache, call esp_spiram_init_cache,
re-enable cache, and then call esp_spiram_init.
Disabling and re-enabling the cache can be achieved using functions
provided in esp_spi_flash.h.
This commit fixes bugs with the dual core changes to freeRTOS tick and idle hooks.
Interrupt watchdog now registers tick hooks to both cores.
API for cross core tick and idle hook registration were also added
The way these hooks are implemented at the moment, once you register a tick or idle task hook, it is run by both cores, leading to intermittent crashes that are difficult to explain (and debug). One solution is to register the hook with the core that is currently running, which is what this patch attempts to do.
Merges https://github.com/espressif/esp-idf/pull/781
Legacy API of task watchdog used the same function esp_task_wdt_feed() to add
and feed a task. This caused issues of implicitly adding a task to the wdt list
if the function was used in shared code.
The new API introduces init, adding, feeding, deleting, deinit functions. Tasks
must now be explicitly added to the task watchdog using their handles. Deletion
must also be explicit using task handles. This resolves the issue of implicit
task additions to the task watchdog due to shared code calling
esp_task_wdt_feed().
Task watchdog is now fully configurable at runtime by calling the init and
deinit functions.
Also added functions to get the handles of idle tasks of the other core. This
helps when adding idle tasks to the watchdog at run time.
Configuring the task watchdog using menu config is still available, however
menu config will only result in calling the init and add functions for idle
tasks shortly after the scheduler starts.
Menu config also allows for using legacy behavior, however the legacy behavior
willcall the new API functions but with slight variations to make them legacy
compatible.
Documentation and example have also been updated
gcov_rtio.c headers updated to prevent error of freertos header files being
included in the wrong order.
Resolves issue TW#13265
The two task watchdog timer bugs are as follows...
1) If only a single task existed on the wdt task list, and esp_task_wdt_feed()
was only called once, the watchdog triggers but fails to print task name
2) If a single task already exists on the task wdt list, and another task calls
esp_task_wdt_feed() once, the watchdog fails to trigger
Problem stemmed from the loop responsible for resetting the watchdog timer
having incorrect loop parameters. The loop failed to traverse the full length
of the task wdt list
In release mode, switches in rtc_clk_bbpll_set would be converted to
jump tables. These tables would be placed into .rodata, which caused
rtc_clk_cpu_freq_set to be unusable while cache is disabled. This
manifested itself in crashes when exiting from light sleep:
https://esp32.com/posting.php?mode=reply&f=13&t=3089#pr14590
1. add adc2 coexistence
2. change NOW() to WDEV_NOW()
3. call ets_timer_done() before calling ets_timer_setfn()
4. fix the bug that api lock is not unlocked when call esp_wifi_stop()
twice
5. more hmac tx buffer limit from 32 to 64.
1. Support built-in ADC for I2S.
2. Modify code of ADC, made no change to the original APIs.
3. Add APIs in I2S:
esp_err_t i2s_set_adc_mode(adc_unit_t adc_unit, adc1_channel_t adc_channel);
4. Add I2S ADC/DAC example code.
5. add old-fashion definition to make it more compatible
6. replase spi_flash_ APIs with esp_partition_ APIs
7. add example of generating audio table from wav
8. change example sound
1. Occupy conn[9] for adv. The max connection number of bluetooth controller decrease to 9. (Previously, it is 10)
2. modify the enum of setting BLE TX power corresponding to connection's.
3. fix libbtdm_app.a cwitch jump table
ESPNOW is a kind of WiFi communication bettween WiFi devices, no
matter they are connected to each other or not. Once two WiFi
devices are paired, they can send data to or receive data from
each other. The data is transmitted in action frame which can
be encrypted with CCMP method. ESPNOW also support mutilcast frame
transmitting.
Fix warnings where undefined vars are used.
Make Kconfig emit "FOO=" for unset bool options
To ensure make variables are always defined, even if empty.
When writing auto.conf, include symbols disabled by dependency to make sure all make variables are always defined.
Fixesespressif/esp-idf#137
Cherry-picked from https://github.com/espressif/esp-idf/pull/138
Since timestamps are 64-bit, loosing one bit of range due to sign does
not present an issue, however for applications doing calculations on
timestamps, signed return type is more convenient.
The implementation of esp_timer_get_time used a critical section, which
resulted in a call time of ~1.8us. To make esp_timer_get_time more
useable as a high-resolution time source, this change replaces the lock
with polling. Call time is reduced to ~0.7us.
All peripheral clocks are default enabled after chip is powered on.
When CPU starts, if reset reason is CPU reset, disable those clocks
that are not enabled before reset. Otherwise, disable all those
useless clocks.
These peripheral clocks must be enabled when the peripherals are
initialized and disabled when they are deinitialized.
If two different types of SHA hashes were active in the hardware
concurrently, a race condition meant the SHA unit could be incorrectly
reset leading to all-zero results.
If scheduler switches cores in narrow window during esp_dport_access_stall_other_cpu_start(), could cause the stall
interrupt to occur on the running CPU - halting the CPU until WDT cleans up.
Related to https://github.com/espressif/esp-idf/issues/630
1. add sens_struct.h
2. add definition of RTCCNTL and RTCIO
3. modify touch pad examples
4. update example code.
5. add comments add option in menuconfig
6. fix issue that pad index 8 and 9 are mismatched
7. add touch_pad_read_filtered() api to get value filtered by iir filter
8. modify touch pad isr func
9. Make the items in perihperal.ld in the sequence of address
10. delete Kconfig for touch pad
11. add touchpad filter APIs to adjust the filter
12. add touch_pad into index.rst
13. add touch_pad in Doxyfile
14. add touch_pad.rst
Previously VFS driver for UART could only use simple non-blocking
functions to read from and write to the UART. UART driver provides more
complex blocking and interrupt-driven functions, which can be used
instead.
This commit adds optional support for using UART driver's functions.
Also added is a more flexible mechanism for configuring newline
conversion rules on input and output.
This commit also fixes a bug that all UARTs shared one static variable
used as a character buffer in newline conversion code. This variable is
changed to be per-UART.
1. Hello World application shows no footprint difference before and
after this change
2. examples/ethernet/ethernet application compiles properly (can't
test with my board)
This is no longer required since the functions automatically get
pulled in based on the usage. A quick summary of footprint
comparisions before and after these set of patches is shown below:
Hello-World: (simplified for readability)
old Total image size:~ 104902 bytes (.bin may be padded larger)
old Total image size:~ 105254 bytes (.bin may be padded larger)
Per-archive contributions to ELF file:
Archive File DRAM .data & .bss IRAM Flash code & rodata Total
old libesp32.a 1973 177 4445 3939 2267 12801
new libesp32.a 1973 185 4473 3939 2267 12837
new libnvs_flash.a 0 92 0 274 8 374
new libstdc++.a 0 0 0 24 0 24
For some reason, nvs_flash.a (~400bytes) gets pulled in (particularly
the nvs_flash_init() function).
Power-Save: (simplified for readability)
old Total image size:~ 421347 bytes (.bin may be padded larger)
old Total image size:~ 421235 bytes (.bin may be padded larger)
old libtcpip_adapter.a 0 81 0 1947 115 2143
new libtcpip_adapter.a 0 69 0 1897 115 2081
The size actually shrinks a bit, since the AP interface function
doesn't get pulled in.
Since only the used interface's start function gets called, it pulls
in only the functions that are required in the current application,
thereby saving footprint.
Restart being a lower-layer system-level function, needn't depend on
the higher level Wi-Fi libraries.
This also enables us to get rid of one more WIFI_ENABLED ifdef check
For config-only components, component.mk should now contain "COMPONENT_CONFIG_ONLY := 1"
Also refactored some of the generation of linker paths, library list. This required cleaning up the way the bootloader
project works, it's now mostly independent from the parent.
NVS is used to store PHY calibration data, WiFi configuration, and BT
configuration. Previously BT examples did not call nvs_flash_init,
relying on the fact that it is called during PHY init. However PHY init
did not handle possible NVS initialization errors.
This change moves PHY init procedure into the application, and adds
diagnostic messages to BT config management routines if NVS is not
initialized.
Currently the last 128KB of DRAM is reserved for the bootloader & early boot stacks. This means if >192KB of static DRAM
is allocated, the only available heap is this region - which is disabled until the scheduler starts. As a result, you
get either heap corruption on early boot if the static data overlaps startup heap (leading to very weird errors), or
FreeRTOS will fail to start when it can't malloc() anything.
Long term fix is to move the stacks & bootloader data to the very end of RAM, and only reserve that part for early
boot. This is a little fiddly because of also wanting to make sure this memory is not preemptively fragmented when it
gets reintroduced to the heap. This will become more important if/when we have more static allocation options in the
future.
For now, these errors make it clear why the boot has failed.
Ref TW13909
Because of errata related to BOD reset function, brownout is handled as follows:
- attach an ISR to brownout interrupt
- when ISR happens, print a message and do a software restart
- esp_restart_nonos enables RTC watchdog, so if restart fails,
there will be one more attempt to restart (using the RTC
watchdog)
RTC watchdog didn’t have any actions configured for any of the stages.
This change configures it to use SW_SYSTEM_RESET at stage 0 and a
full reset at stage 1. The timeout is now calculated based on
RTC_SLOW_CLK frequency.
Specifying -fexceptions for the compiler is not enough.
- add necessary zero padding after .eh_frame section
- link .gcc_except_table_table in a way flash script does not complain
- call __registrer_frame_info before global constructors
Kudos jcmvbkbc for the necessary help.
Implements support for system level traces compatible with SEGGER
SystemView tool on top of ESP32 application tracing module.
That kind of traces can help to analyse program's behaviour.
SystemView can show timeline of tasks/ISRs execution, context switches,
statistics related to the CPUs' load distribution etc.
Also this commit adds useful feature to ESP32 application tracing module:
- Trace data buffering is implemented to handle temporary peaks of events load
Bug occurs when core dump destination in menuconfig is set to flash. When
programme crashes, xt_unhandled_exception or panicHandler will both trigger
commonErrorHandler. commonErrorHandler calls esp_core_dump_to_flash which
will attempt to use DPORT functions and hang due to trying to a stall and already
stalled processor (already stalled in xt_unhandled_exception and panicHandler).
Program will eventually be rebooted when wdt expires.
Added esp_dport_access_int_deinit after calls to haltOtherCore() so that DPORT
functions don't try to halt and already halted cpu hence preventing hang.
Fixes TW#12944 https://github.com/espressif/esp-idf/issues/646
Small changes to clock calibration value will cause increasing errors
the longer the device runs. Consider the case of deep sleep, assuming
that RTC counter is used for timekeeping:
- before sleep:
time_before = rtc_counter * calibration_val
- after sleep:
time_after = (rtc_counter + sleep_count) * (calibration_val + epsilon)
where 'epsilon' is a small estimation error of 'calibration_val'.
The apparent sleep duration thus will be:
time_after - time_before = sleep_count * (calibration_val + epsilon)
+ rtc_counter * epsilon
Second term on the right hand side is the error in time difference
estimation, it is proportional to the total system runtime (rtc_counter).
To avoid this issue, this change makes RTC_SLOW_CLK calibration value
persistent across restarts. This allows the calibration value update to
be preformed, while keeping time after update same as before the update.
This fixes a bug introduced by !848, where APP CPU would not be reset
during esp_restart, if esp_restart was called from a task running on APP
CPU, and wouldn’t be reset by PRO CPU on startup.
This change replaces stalling APP CPU with resetting it.
Also adds a non-automated esp_restart tests.
DPORT access protection can not work when the other CPU is stalled.
Writes to DPORT registers in esp_restart caused the program to hang due
to access protection, and the reset happened due to RTC_WDT, not SW_RST.
This change adds esp_dport_access_int_deinit function and calls it from
esp_restart once the other core is stalled.
This seems to clean up some of the more wrong addr2line output results (not
sure why, something to do with optimisations I think - perhaps the return
address may also be a jump target from some earlier line of the code.)
Previously, this resulted in task stack frames turning up incorrectly in the backtrace, ie
Backtrace: 0x400d22a0:0x3ffb0fa0 0x40085a3c:0x3ffb0fc0 0x400f32c4:0x3ffb0fe0 0x40081965:0x3ffb1010
0x400d22a0: esp_vApplicationIdleHook at /home/esp/esp-idf/components/esp32/./freertos_hooks.c:
52
0x40085a3c: prvIdleTask at /home/esp/esp-idf/components/freertos/./tasks.c:4431
0x400f32c4: i2c_isr_handler_default at /home/esp/esp-idf/components/driver/./i2c.c:598
0x40081965: _xt_lowint1 at xtensa_vectors.o:?
Fix is to implement abort() via an unhandled exception rather than a breakpoint, I think
because of relative priority of exception types.
Another approach would be to assign a software-only INUM to abort()ing and defined a
PANIC_RSN_ABORTED, but this is more complex and interrupt numbers are more scarce than RAM!
When ‘reset halt’ command is executed, OpenOCD will take the APP CPU
out of reset and enable the clock. At this point, user can set a
breakpoint on code which will run on APP CPU. Previously, app startup
code would do another reset of APP CPU, thereby removing any breakpoints
which may have been set. This change makes APP CPU reset conditional on
DPORT_APPCPU_CLKGATE_EN bit, which is 0 by default but is set to 1 by
OpenOCD after reset.
To increase the chances that the examples work out of the box, this
change is raising the default deep sleep wakeup delay to 1ms.
If GPIO15 is low at startup, ROM code takes less time to execute
(because no logging is performed), so more time may be needed to allow
flash chip to become ready.
Fix Dport access in interrupts
Dport accesses would re-enable interrupts unconditionally, breaking things when called in an ISR. This saves and restores the interrupt status, fixing this.
This fixes a crash in the SPI slave driver, and possibly other things.
See merge request !772
1. Name change from chopper to carrier, block diagram update, minor changes to example codes
2. mcpwm_reg.h changed, brought uniformity in comments, worked on suggestions, duty to accept float. Some name changes!
3. Minor readme changes and Indetation
4. Minor change: move mcpwm_reg.h and mcpwm_struct.h to new path
5. Minor change: addition of BLDC example code and Readme
6. Name changed from epwm to mcpwm
7. Improve the reg name in mcpwm_struct.h
8. Name change chopper>carrier, deadband>deadtime
1. Enlarge wifi task stack size by 512Bytes to fix potential stack overflow issue
2. Modify wifi hmac tx queue size from 12 to 32 because we already limit the buffer number in ebuf
management module
add API to get chip info
This change adds an API to get chip info, such as chip model, enabled capabilities, size of embedded flash, silicon revision.
Hello_world example is modified to print out the information about the chip. The example is also simplified by moving all code into the main task.
Ref TW12031.
See merge request !549
esp32: update wifi lib for some bugfix
1. Fix wifi ebuf free twice issue
2. Fix wifi internal assert issue
3. Fix a bug in esp_wifi_stop
4. Fix wifi crash issue
5. Fix wifi run out of memory when 10 udp connection stability test
See merge request !745
Optimize configuration of base MAC address
Application developer can call APIs to configure base MAC address
instead of using menuconfig.
See merge request !744
component/esp32 : fix dualcore bug
1. When dual core cpu run access DPORT register, must do protection.
2. If access DPORT register, must use DPORT_REG_READ/DPORT_REG_WRITE and DPORT_XXX register operation macro.
See merge request !742
1. When dual core cpu run access DPORT register, must do protection.
2. If access DPORT register, must use DPORT_REG_READ/DPORT_REG_WRITE and DPORT_XXX register operation macro.
SPI: Various fixes (examples, mem leak, arg check)
- Fix SPI master example to use DMA-capable memory for display initialization. Fixes https://github.com/espressif/esp-idf/issues/551
- SPI master: Do not leak DMA descriptor pointer array on free
- SPI Master/Slave: Check if DMA'ed buffers actually live in DMA-capable memory
See merge request !735
component/bt: fix some bugs related to bluetooth sniff mode in controller
1. fix some bugs in bluetooth sniff mode in controller
2. export some symbols to esp32.rom.ld including functions and global variables in ROM code
3. update libbtdm.a which includes "IRAM_ATTR" addition or removal for some functions
See merge request !729
1. fix some bugs in bluetooth sniff mode in controller
2. export some symbols to esp32.rom.ld including functions and global variables in ROM code
3. update libbtdm.a which includes "IRAM_ATTR" addition or removal for some functions
esp32: select 8M clock as RTC_FAST_CLK on startup
Even though RTC_CLK_CONFIG_DEFAULT correctly had RTC_FAST_FREQ_8M as the
fast clock, the bootloader modified fast_freq field to the currently
selected RTC_FAST_CLK (so that the clock choice is not affected by the
bootloader). The application startup code never switched to 8M clock,
which caused the default (XTAL/4) to be used as RTC_FAST_CLK. This had
caused a number of issues, such as touch pads not working in deep sleep.
Fixes https://github.com/espressif/esp-idf/issues/542.
Ref TW12053.
See merge request !709
optimize scan before station connecting to AP
1. Store the information of AP(ssid, password, bssid, channel, etc)
into nvs when station connects to AP successfully. If station
connects to the same AP next time, it will scan the stored channel of the AP
first.
2. Add a parameter of channel for scanning before connecting to AP.
If the channel is set to 0, station will scan full channels. If it
is set to 1~13, station will only scan the channel.
See merge request !704
1. Store the information of AP(ssid, password, bssid, channel, etc)
into nvs when station connects to AP successfully. If station
connects to the same AP next time, it will scan the stored channel of the AP
first.
2. Add a parameter of channel for scanning before connecting to AP.
If it is set to 1~13, station will scan starting from the channel.
If the channel of AP is unknown, set it to 0.
Even though RTC_CLK_CONFIG_DEFAULT correctly had RTC_FAST_FREQ_8M as the
fast clock, the bootloader modified fast_freq field to the currently
selected RTC_FAST_CLK (so that the clock choice is not affected by the
bootloader). The application startup code never switched to 8M clock,
which caused the default (XTAL/4) to be used as RTC_FAST_CLK. This had
caused a number of issues, such as touch pads not working in deep sleep.
Fixes https://github.com/espressif/esp-idf/issues/542.
Ref TW12053.
esp32: Core dump sanity checks
Adds sanity checks when doing core dump to flash
- CRC for core dump flash partition config
- Tasks with corrupted TCBs are skipped
- Assertions to check that nothing is written beyond core dump flash partition
Ref TW11879
See merge request !686
- CRC for core dump flash partition config
- Tasks with corrupted TCBs are skipped
- Assertions to check that nothing is written beyond core dump flash partition
- RTC_CNTL_SLOWCLK_FREQ define is removed; rtc_clk_slow_freq_get_hz
function can be used instead to get an approximate RTC_SLOW_CLK
frequency
- Clock calibration is performed at startup. The value is saved and used
for timekeeping and when entering deep sleep.
- When using the 32k XTAL, startup code will wait for the oscillator to
start up. This can be possibly optimized by starting a separate task
to wait for oscillator startup, and performing clock switch in that
task.
- Fix a bug that 32k XTAL would be disabled in rtc_clk_init.
- Fix a rounding error in rtc_clk_cal, which caused systematic frequency
error.
- Fix an overflow bug which caused rtc_clk_cal to timeout early if the
slow_clk_cycles argument would exceed certain value
- Improve 32k XTAL oscillator startup time by introducing bootstrapping
code, which uses internal pullup/pulldown resistors on 32K_N/32K_P
pins to set better initial conditions for the oscillator.
XTAL frequency detection, support for selecting XTAL frequency
This MR adds more robust XTAL frequency detection code (which gets run in the bootloader) and an option to set XTAL frequency in Kconfig. By default we still use autodetection, since it is more reliable than the one used in ROM code.
This will help with issues about XTAL frequency detection in high ambient temperature conditions.
Ref TW12008
See merge request !694
esp32: update wifi lib for limitting dynamic wifi buffer
Add limit for all dynamic wifi ebuf to avoid wifi run out of memory in some extreme scanrio.
The default max allocated dynamic tx buffer is 32
The default max allocated dynamic rx buffer is 64, make default value is bigger because when all packets we received are small packets, e.g. the length is 64Bytes, then 64K can hold 1000 packets, so 64 maybe a good candidate default value, anyway the customer can configure it via menuconfig.
The default dynamic wifi internal long/long-long mgmt is 32, generally 32 is enough for mgmt packet (beacon/auth/assoc/probe/null etc). Generally when all the 32 mgmt buffer is run out of memory, it means internal wifi state machine may has problem, we need to debug it.
See merge request !683
There are some RODATAs of libphy.a that are called in ISR. So need
to put them into DRAM to avoid access them when R/W SPI flash. Due
to the RODATAs which are called in ISR haven't been picked out to
put into DRAM, put all of the RODATA of libphy.a into DRAM. This
will be optimized in the future.
Base MAC address can be stored in default manufacture-defined or customer
pre-defined place in EFUSE and other place e.g. flash or EEPROM.
If choose to use base MAC address which is stored in other place, please
call esp_base_mac_addr_set_external() before initializing WiFi/BT/Ehternet.
Remove ESP_EARLY_LOGI before bss is initialized; it crashes the CPU
There's an ESP_EARLY_LOGI line that can get called before the BSS is initialized; the early logging code doesn't cope well with that: it checks if FreeRTOS is up, but the variables it uses for that contains garbage because it isn't cleared yet, giving the wrong result. The logging code then tries to set a mux, crashing the entire system. This patch removes the log line and adds a warning at the BSS initialization line not to do anything complex before that point.
Fixes https://github.com/espressif/esp-idf/issues/523
See merge request !671
- Implements application tracing module which allows to send arbitrary
data to host over JTAG. This feature is useful for analyzing
program modules behavior, dumping run-time application data etc.
- Implements printf-like logging functions on top of apptrace module.
This feature is a kind of semihosted printf functionality with lower
overhead and impact on system behaviour as compared to standard printf.
Detect invalid cache access
This MR adds always-on feature which detects cache invalid access and triggers panic handler when invalid access interrupt is raised.
See merge request !660
Confusion here is that original ROM has two functions:
* SPIReadModeCnfig() - sets mode, calls enable_qio_mode/disable_qio_mode
* SPIMasterReadModeCnfig() - As above, but doesn't set QIO mode in status register
However we never want to use the ROM method to set/clear QIO mode flag, as not all flash chips work this way. Instead we
do it in flash_qio_mode.c in bootloader.
So in both cases (ROM or "patched ROM") we now call SPIMasterReadModeCnfig(), which is now named
esp_rom_spiflash_config_readmode().
Introduce soc component, add source of rtc_clk and rtc_pm libraries
This MR adds parts of the RTC library source code (initialization, clock selection functions, sleep functions). WiFi-related power management functions are kept inside the precompiled library. Most of RTC library APIs have been renamed.
Default CPU frequency option in Kconfig is set to 160MHz, pending qualification of 240MHz mode at high temperatures.
Register header files are moved into the new soc component, which will contain chip-specific header files and low-level non-RTOS-aware APIs (such as rtc_ APIs). Some of the files from ESP32 component were also moved: cpu_util.c, brownout.c, and the corresponding header files. Further refactoring of ESP32 component into more meaningful layers (chip-specific low level functions; chip-specific RTOS aware functions; framework-specific RTOS-related functions) will be done in future MRs.
See merge request !633
1) fixed SPI_read_status: added check for flash busy flag in matrix mode
2) fixed SPI_page_program: enable write before writing data to SPI FIFO
3) SPI flash ROM funcs replacement is controlled via menuconfig option
esp32: initialize cross-core interrupt in single core mode
The software interrupt originally used as the cross-core interrupt is
now also used to yield from a FreeRTOS critical section; therefore it
must be initialized for single core mode as well.
Fixes https://github.com/espressif/esp-idf/issues/496
See merge request !640
fix warnings generated by ESP_ERROR_CHECK(variable) in release builds
This uses the same pattern as “assert” in release builds to silence the
warning. At the same time, we make sure that if a statement is wrapped
into ESP_ERROR_CHECK, it is executed in release build as well.
Fixes https://github.com/espressif/esp-idf/issues/497
See merge request !641
This uses the same pattern as “assert” in release builds to silence the
warning. At the same time, we make sure that if a statement is wrapped
into ESP_ERROR_CHECK, it is executed in release build as well.
The software interrupt originally used as the cross-core interrupt is
now also used to yield from a FreeRTOS critical section; therefore it
must be initialized for single core mode as well.
Fixes https://github.com/espressif/esp-idf/issues/496
If static tx buffer is selected, WiFi tx buffers are allocated when WiFi is initialized and released
when WiFi is de-initialized. If dynamic tx buffer is selected, WiFi tx buffer is allocated when tx
data is delivered from LWIP to WiFi and released when tx data is sent out by WiFi.
The size of each static tx buffers is fixed to about 1.6KB and the size of dynamic tx buffers is
depend on the length of the data delivered from LWIP.
If PSRAM is enabled, "STATIC" should be selected to guarantee enough WiFi tx buffers.
If PSRAM is disabled, "DYNAMIC" should be selected to improve the utilization of RAM.
ULP coprocessor toolchain integration
- build system support for ULP coprocessor toolchain
- documentation for ULP coprocessor instruction set
- documentation for ULP code execution flow, loading programs, exchanging data
- example: counting pulses using ULP
See merge request !394
Reset WIFI mac when wifi start and update wifi lib
1. reset wifi mac when wifi start
2. roll back rx hung workaround for beacon timeout
3. fix amsdu ap interface wrong issue
4. fix amsdu header parse error
5. fix amsdu flag wrong issue
6. PHY: V350, fix BT rssi bug
7. RTC: V225, fix bt will be not work when wifi is reset
See merge request !606
SPI flash operations lock for shorter periods
Based on bug report here:
https://esp32.com/viewtopic.php?f=13&t=1489&p=6816#p6773
Long SPI flash erase (and possibly write/read) cycles block all tasks on both CPUs for an extended period, and can lead to WiFi dissassociation (and general priority inversion.)
This MR inserts preemption breaks into large operations (all erases, writes every 8KB, reads every 16KB).
Overhead of a single spi_flash_guart_start()/spi_flash_guard_end() cycle measured at approx 67us (assuming no preemption.)
See merge request !600
Error handling in NVS initialization
Previously nvs_flash_init worked under an assumption that there should always be at least one free page available. This is true during normal operation, but in some cases (such as when changing application partition table from a non-OTA to an OTA one), NVS partition may get truncated, which will cause empty pages to be lost.
This MR adds error checks for this condition, and updates code which calls `nvs_flash_init` to check for the return code.
For most examples, a simple `ESP_ERROR_CHECK` is added around `nvs_flash_init`. For NVS examples and the OTA example, more robust error handling is added.
This change also removes nvs_flash_init calls from examples which don't use NVS.
See merge request !582
idf_monitor: Small fixes (baud rate, EOL, /dev/tty.X on macOS, Ctrl-T on failure)
* "make monitor" now passed the configured baud rate.
Closes#436https://github.com/espressif/esp-idf/issues/436
* Pass toolchain prefix from sdkconfig into monitor tool
* Allow setting EOL in idf_monitor.py, use CRLF by default
* Detect if /dev/tty.X is used on macOS, warn and replace with /dev/cu.X
* If a build fails or gdb exits, ignore Ctrl-T (allowing Ctrl-T Ctrl-A/F to be same key sequence everywhere)
* Add a note about winpty on Windows.
Ref 02fdf8271d (commitcomment-21369196)
* Fix problems with Console.cancel() not existing in older pyserial
* Print more user-friendly symbols for "start of iram" and "start of flash"
See merge request !594
1. reset wifi mac when wifi start
2. roll back rx hung workaround for beacon timeout
3. fix amsdu ap interface wrong issue
4. fix amsdu header parse error
5. fix amsdu flag wrong issue
6. PHY: V350, fix BT rssi bug
7. RTC: V225, fix bt will be not work when wifi is reset
This is to avoid confusion when idf_monitor prints the first symbol in each section, ie "WindowOverflow4" or similar,
when bootloader prints the section mapping address.
Closes#447https://github.com/espressif/esp-idf/issues/447
1. Add low speed channels for LEDC module.
2. Improve fade object allocate mechanism.
3. Improve ledc example, add 2 low speed channels in example.
4. Remove debug code
5. Improve the register bit field name of slow clock.
1. add options to disable nvs
2. add station keepalive with softap
3. fix beacon rx start time not accurate issue
4. set wifi rx desc/buffer boundary check to internal memory boundary
add wakeup from touch sensor, and deep sleep example
- add new deep sleep wakeup mode
- change documentation to explain incompatibilities between different wakeup mode, add error checks
- add new ULP instructions necessary for ULP wakeup scenario
- fix issues with I_WR_REG, I_SLEEP, I_END instructions
- add deep sleep example, illustrating the use of timer, gpio, touch, and ULP wakeup triggers
See merge request !461
component/bt: optimize stack size of Bluetooth Tasks and make them be configurab…
Bluetooth tasks' stack size are optimized and can be configured by the CONFIG_NEWLIB_NANO_FORMAT option.
See merge request !559
Allow separate ethernet & wifi configuration
If only 1/2 of ethernet & WiFi are enabled in config, the other interface is no longer linked into the firmware.
* Fixes bug where enabling Ethernet but not WiFi would fail to compile.
* Also means that enabling WiFi but not Ethernet no longer links some unused ethernet interface functions.
See merge request !525
Feature/add user set mac
1. Add menuconfig for user to set mac address of wifi, bt and ethernet.
2. Add the number of MAC address generated from efuse for user to choose.
3. Add MAC address derive method.
See merge request !542
1. RTC V214: modify APLL function for the chip of ECO version.
2. Add API phy_close_rf() and use it in esp_phy_deinit() instead of pm_close_rf().
3. RTC V213: fix BT will not work when BT-init is called more than once.
Optimize or release memory in bluetooth
1. add option to release about 30K from BT if BLE only
2. later BT/BLE will be separated by BT/BLE macro, but this option should use when user make sure that in BLE only mode.
See merge request !520
This change adds esp_deep_sleep_get_wakeup_cause, which returns the
source which has caused wakeup from deep sleep.
Similar to esp_deep_sleep_get_ext1_wakeup_status, a function is added
to check touch pad wakeup status: esp_deep_sleep_get_touchpad_wakeup_status.
This function returns the touch pad which has caused wakeup.
ULP and touch FSMs in ESP32 revisions 0 and 1 do not operate correctly
if RTC_PERIPH power domain is force powered on (ESP_PD_OPTION_ON).
Both ULP and touch still work, but clock frequency of the ULP may be
incorrect and touch values may be off by considerable amount. As such,
when these wakeup modes are used, RTC_PERIPH power domain has to be set
to ESP_PD_OPTION_AUTO (or, in the current implementation,
ESP_PD_OPTION_OFF — though this will change in the future when _OFF will
actually *force* the power domain to be powered off).
Because EXT0 wakeup source requires RTC_PERIPH to be powered ON, mark
ULP and touch wakeup sources as incompatible with EXT0. Workaround for
this is to use EXT1 wakeup source instead, which offers similar or
better functions without having to keep RTC_PERIPH powered on.
In case WiFi/BT stack has been enabled but wasn’t disabled, some RTC
bits may be left enabled, causing increased current consumption.
This change returns some of the bits back to their default values.
1. add new APIs bt controller enable/disab/deinit
2. make bt controller work need to call two APIs of esp_bt_controller_init and enable
3. modify phy init to make mac reset once
1. add a macro in menuconfig for users to choose whether store phy calibration data into NVS or not.
2. rename some disable phy and rf APIs so that existing code which calls old APIS will fail to compile.
1. Add disable PHY and RF when WiFi and BT are both disabled(including call sniffer disable API).
2. Do not init PHY and RF when cpu start. Init PHY and RF when call Wifi or BT start APIs(including sniffer enable API).
3. Add a temporary lib: librtc_clk.a and will delete it when CPU frequency switching function is done.
4. Add an function to get OS tick rate.
5. Do not put the whole pp.a in iram0, only put lmac.o, ieee80211_misc.o, ets_time.o and wdev.o in iram0.
phy_init: don’t rewrite valid calibration data
In the default PHY init routine, calibration data is loaded from NVS.
Most of the time the incremental changes to calibration will be fairly
small, so we don’t need to rewrite the existing calibration data stored
in the NVS.
Possible enhancement to be done in the future: expose a function in PHY
library to tell how big was the change in calibration data. If the
change was significant, then calibration data stored in NVS should be
updated.
See merge request !487
1. Reduce the default static rx buffer size from 25 to 10
2. Adjust ampdu interrupt size to 3, namely, raise 1 interrupt per 3-mpdu
3. Make a copy for all received packets, including AMSDU/AMPDU/MPDU
4. Fix softap mis-forward issue
5. Fix pp q full issue
6. Fix sniffer copy wrong content issue
In the default PHY init routine, calibration data is loaded from NVS.
Most of the time the incremental changes to calibration will be fairly
small, so we don’t need to rewrite the existing calibration data stored
in the NVS.
Possible enhancement to be done in the future: expose a function in PHY
library to tell how big was the change in calibration data. If the
change was significant, then calibration data stored in NVS should be
updated.
esp32: Fixes watchdog problem when printing core dump to uart
1) Fixes watchdog problem when printing core dump to uart
2) Also fixes generation of core dumps when flash cache is disabled
See merge request !472
1. fix ampdu<->mpdu<->ampdu switch may cause rx slow issue by put mpdu into ampdu reorder queue
2. fix each ac first sending always fail issue by adding retry
1. modify the discover retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,8,15,15)s.
2. add DHCP_DOES_ARP_CHECK to menuconfig for users to specify if do a ARP check on the offered address.
If enable, one more second will be taken in obtaining IP address.
3. update wifi libs
Move PHY options out of WiFi config, improve descriptions
- move PHY-related settings into new menu, make it dependent on WIFI_ENABLED || BT_ENABLED
- improve descriptions of Ethernet Kconfig options
See merge request !443
ESP32_PHY_MAX_TX_POWER option is only meaningful for WiFi, so previous
change made it depend on WIFI_ENABLED. However if WiFi is not enabled,
but BT is, this option becomes undefined which breaks phy_init_data
generation.
This change turns ESP32_PHY_MAX_TX_POWER into a hidden parameter, which
depends on PHY_ENABLED. New user-visible parameter,
ESP32_PHY_MAX_WIFI_TX_POWER is introduced which depends on WIFI_ENABLED
and is used as default value for ESP32_PHY_MAX_TX_POWER if WIFI_ENABLED
is set. Otherwise ESP32_PHY_MAX_WIFI_TX_POWER is set to 20.
fixes for issues observed when using spi_flash
This MR fixes three unrelated issues:
- Race condition in spi_flash_enable_interrupts_caches_and_other_cpu
when operations on unpinned tasks are performed.
The issue is reported in https://github.com/espressif/esp-idf/pull/258
- esp_intr_noniram_disable doesn’t disable interrupts when compiled in
release mode. This issue manifested itself with an illegal instruction
exception when task WDT ISR was called at the time when flash was
disabled.
Fixes https://github.com/espressif/esp-idf/issues/263.
- Tick hooks on CPU1 were not called if CPU0 scheduler was disabled for
significant amount of time (which could happen when doing flash erase).
The issue manifested itself as “INT WDT timeout on core 1” error.
Fixes https://github.com/espressif/esp-idf/issues/219.
See merge request !441
When compiling in release mode, compiler was choosing same register for
oldint and intmask variables, so INTENABLE was never modified.
This effectively broke disabling of non-IRAM interrupts during flash
operations, observed in the existing tests if task watchdog is enabled.
This change adds an extra constraint tells the compiler that output
operand should not be placed into the same register as an input one.
Delete option to select core timer 2 as a FreeRTOS tick source
Core timer 2 is unusable for FreeRTOS ticks because it triggers a high-level interrupt. This MR deletes the option to select it.
Ref https://github.com/espressif/esp-idf/issues/234
See merge request !418
update wifi lib: fix some wifi lib bugs
1. net80211: fix get ap info error(a4614877)
2. tw9358: sta mac same with softap(ea38d32c)
3. tw9221: scan channel error when connected(183d469c)
See merge request !425
fixes for github issues
This MR includes commits from several Github PRs, as well some fixes for issues reported on Github and on the forum.
- compile PHY-related code only when WiFi is enabled
- fix macOS setup instructions
- fix some of the Sphinx warnings
- update docs index, improve structure of the readme-
- wifi: fix typos, rename ESP_ERR_WIFI_NOT_START to ESP_ERR_WIFI_NOT_STARTED
- sdmmc: fix explanation of flash voltage regulator configuration efuses
- sdmmc: change idx num of example
- fix i2c_get_period name
- fix esp_log_level_set function name in docs
See merge request !420
If using WIFI_INIT_CONFIG_DEFAULT, error message will point out lack
of WiFi. Otherwise linker errors on WiFi symbols should help give a
clue as to what is broken.
Piggy-backs on changes in !420, ref github #230#237
esp32 core dump to flash
1. menuconfig option to select where to store core dump: flash, uart or disable
2. Saving of core dump to flash
3. Partition table definitions files with core dump partition
4. Python scripts to support core dump generation from GDB command line
See merge request !341
The following issues mentioned during MR!341 review were fixed:
1) Core dump test application description
2) Usage of CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH and CONFIG_ESP32_ENABLE_COREDUMP_TO_UART
3) FLASH_GUARD_START macro usage is fixed in flash API
4) Core dump module logging facility
5) cache util functions doc updated
6) interactive delay before print core dump to uart
7) core dump partion support in build system
Deep sleep stub may call ets_update_cpu_frequency, which has been moved from ROM to IRAM.
Restore the ROM version in the linker script, call it ets_update_cpu_frequency_rom, use it in the deep sleep stub.
1) PS is fixed up to allow GDB backtrace to work properly
2) MR!341 discussion: in core dump module: esp_panicPutXXX was replaced by ets_printf.
3) MR!341 discussion: core dump flash magic number was changed.
4) MR!341 discussion: SPI flash access API was redesigned to allow flexible critical section management.
5) test app for core dump feature was added
6) fixed base64 file reading issues on Windows platform
7) now raw bin core file is deleted upon core loader failure by epscoredump.py
Complimentary changes:
1) Partition table definitions files with core dump partition
2) Special sub-type for core dump partition
3) Special version of spi_flash_xxx
4) espcoredump.py is script to get core dump from flash and print useful info
5) FreeRTOS API was extended to get tasks snapshots
Clean up WiFi & Bluetooth config options
* Splits "WiFi" configuration out from ESP32 configuration submenu to its own menu.
* Renames "BT" to "Bluetooth", enabling Bluetooth is now in this option not the ESP32 submenu.
* Also disables compiling/linking of BT stack if Bluetooth is disabled, saves some build time.
See merge request !397
add wpa2 set id api and modify null data tx description
1. wpa2: add wpa2 set id api
2. low rate: modify null data tx description
See merge request !402
ethernet: support flow control
(1) Only fullduplex mode support flow ctrl .
(2) Fix reboot exception which caused by not-reset EMAC hardware (such as DMA) when reset CPU.
See merge request !392
Add option to automatically set a watchpoint at the end of the swapped-in task
This should make stack overflows easier to debug because it triggers a debug exception as soon as the stack is overwritten, not later when a context switch happens. Marked as a FreeRTOS debug feature because it doesn't give a nice error message and uses up a watchpoint.
See merge request !389
Fix OpenOCD detection code
In the current master, detection of an attached OCD is broken. This fixes it.
I also snuck in two unrelated checks in intr_alloc which return from a function that is asserted earlier in the code. This makes the code behave better when they are called erroneously in a production build.
See merge request !377
SDMMC peripheral driver, SD protocol driver, FATFS library, VFS integration
This MR contains:
- SDMMC host peripheral driver
- SD protocol driver in sdmmc component (can be extended to support MMC/eMMC and SPI based hosts)
- ChaN's FATFS library v0.12b
- VFS integration
- FAT access via VFS is thread-safe (unless same file is read/written/unlinked/renamed from different tasks)
- Support for POSIX directory-related functions in VFS (and in vfs_fatfs.c)
- unit test for the above
- Example
- API documentation
Will be done in other MRs:
- Support for spi_flash IO driver for FatFs
- SPI host driver and support for SPI mode commands in sdmmc component
- MMC/eMMC support in sdmmc component
- Support for slightly higher 53/26.6MHz clocks (currently I'm using 20MHz for DS and 40MHz for HS, instead of 25MHz/50MHz per standard), and arbitrary low clocks (e.g. 4MHz).
See merge request !353
C++ support
This change adds necessary support for compiling C++ programs:
- linking against libstdc++
- implementation of static initialization guards using FreeRTOS primitives: since we don't have condition variables at our disposal, and we don't want to allocate a synchronization primitive for every guard variable generated by the compiler, we imitate condition variables using a combination of a mutex, counting semaphore, and a counter (based on [Microsoft Research paper](https://www.microsoft.com/en-us/research/wp-content/uploads/2004/12/ImplementingCVs.pdf), albeit because we don't need *arbitrary* code to use these CVs, implementation gets simpler).
Note that libstdc++ also contains an implementation of `__cxa_guard_{acquire,release,abort}` functions. These implementations come from an `#ifndef GXX_THREADS` branch, i.e. are not aware of multthreading. There are three ways of replacing these libstdc++ functions with our implementation:
1. Move our code into gcc. Pros: cleanest solution. Cons: Such changes are unlikely to be merged by any upstream, so we end up maintaining our own forks of {gcc,crosstool-ng}.
2. Use library as it is built by crosstool, use `ar` to delete one object file (`guards.o`), add this library to ESP-IDF. Pros: easy to implement. Cons: libstdc++ is a 15MB binary 😯
3. Keep using libstdc++ from crosstool, force our implementation to be linked using a `-u` linker flag. Pros: no impact on repo size, easy to implement. Cons: somewhat less clean than 1 (and about as hacky as 2).
For the reasons mentioned, option (3) looks like the best tradeoff.
Ref. TW6702
See merge request !364
Enable bootloader entropy source for RNG
Enables an entropy source when bootloader starts up, which both seeds the RNG for use before WiFi/BT stack is enabled and provides an adequate RNG for secure boot & flash encryption key generation.
A prerequisite was enabling 80MHz operation, so the CPU is now set to 80MHz as soon as second stage bootloader starts running.
See merge request !363
esp32: ets_update_cpu_frequency should set tick scale for both CPUs
ets_update_cpu_frequency ROM function updates g_ticks_per_us, which is has two copies, one for each CPU.
The APP CPU copy of g_ticks_per_us never got updated, resulting in shorter delays produced by ets_delay_us on the APP CPU.
This MR replaces ROM ets_update_cpu_frequency with a copy in IRAM which updates scaling factors on both of the CPUs.
So now we get expected delays (in microseconds):
```
ets_delay_us core=0 expected=50000 actual=50014
ets_delay_us core=1 expected=50000 actual=50015
vTaskDelay core=0 expected=50000 actual=49428
vTaskDelay core=1 expected=50000 actual=50000
```
Reported on the forum: http://esp32.com/viewtopic.php?f=2&t=713#p3722
See merge request !373
SPI master driver
This merge requests adds an SPI Master driver. This driver is (of course) multithread capable, has device abstraction, has command queueing, DMA support and all other sorts of nice things you'd expect from a SPI driver.
See merge request !332
modify bootloader dram start address, swap app bss and data segments
Modify bootloader dram_seg from address 0x3ffc0000 to 0x3fff0000, len from 0x20000 to 0x10000.
Also put app .data before .bss, to reduce the chance .data collides with ROM bootloader stack.
See merge request !375