Commit Graph

512 Commits

Author SHA1 Message Date
Michael (XIAO Xufeng)
d2f9113d14 bootloader: fix the WRSR format for ISSI flash chips
1. The 2nd bootloader always call `rom_spiflash_unlock()`, but never help to clear the WEL bit when exit. This may cause system unstability.

   This commit helps to clear WEL when flash configuration is done.

   **RISK:** When the app starts, it didn't have to clear the WEL before it actually write/erase. But now the very first write/erase operation should be done after a WEL clear. Though the risk is little (all the following write/erase also need to clear the WEL), we still have to test this carefully, especially for those functions used by the OTA.

2. The `rom_spiflash_unlock()` function in the patch of ESP32 may (1) trigger the QPI, (2) clear the QE or (3) fail to unlock the ISSI chips.

   Status register bitmap of ISSI chip and GD chip:

| SR | ISSI | GD25LQ32C |
| -- | ---- | --------- |
| 0  | WIP  | WIP       |
| 1  | WEL  | WEL       |
| 2  | BP0  | BP0       |
| 3  | BP1  | BP1       |
| 4  | BP2  | BP2       |
| 5  | BP3  | BP3       |
| 6  | QE   | BP4       |
| 7  | SRWD | SRP0      |
| 8  |      | SRP1      |
| 9  |      | QE        |
| 10 |      | SUS2      |
| 11 |      | LB1       |
| 12 |      | LB2       |
| 13 |      | LB3       |
| 14 |      | CMP       |
| 15 |      | SUS1      |

   QE bit of other chips are at the bit 9 of the status register (i.e. bit 1 of SR2), which should be read by RDSR2 command.

   However, the RDSR2 (35H, Read Status 2) command for chip of other vendors happens to be the QIOEN (Enter QPI mode) command of ISSI chips. When the `rom_spiflash_unlock()` function trys to read SR2, it may trigger the QPI of ISSI chips.

   Moreover, when `rom_spiflash_unlock()` try to clear the BP4 bit in the status register, QE (bit 6) of ISSI chip may be cleared by accident. Or if the ISSI chip doesn't accept WRSR command with argument of two bytes (since it only have status register of one byte), it may fail to clear the other protect bits (BP0~BP3) as expected.

   This commit makes the `rom_spiflash_unlock()` check whether the vendor is issi. if so, `rom_spiflash_unlock()` only send RDSR to read the status register, send WRSR with only 1 byte argument, and also avoid clearing the QE bit (bit 6).

3. `rom_spiflash_unlock()` always send WRSR command to clear protection bits even when there is no protection bit active. And the execution of clearing status registers, which takes about 700us, will also happen even when there's no bits cleared.

   This commit skips the clearing of status register if there is no protection bits active.

Also move the execute_flash_command to be a bootloader API; move
implementation of spi_flash_wrap_set to the bootloader
2022-10-17 19:15:25 +08:00
Song Ruo Jing
ed3a570e20 rtc_clk: Fix rtc8m calibration failure after cpu/core reset
Explicitly guarantee 8md256 clk is enabled before calibration
2022-10-12 12:46:41 +08:00
Michael (XIAO Xufeng)
d2debfaddf Merge branch 'bugfix/phy_regi2c_critical_section_v4.1' into 'release/v4.1'
esp_phy: use spinlock to avoid regi2c access conflicts (v4.1)

See merge request espressif/esp-idf!17694
2022-05-06 23:32:24 +08:00
Michael (XIAO Xufeng)
a1aa2f13b3 Merge branch 'bugfix/fix_x32k_startup_slow_bug_v4.1' into 'release/v4.1'
bugfix: Fix xtal 32k not oscillate or oscillate too slowly issue for esp32 (v4.1)

See merge request espressif/esp-idf!17592
2022-04-28 17:14:10 +08:00
Michael (XIAO Xufeng)
d146c48f76 Merge branch 'bugfix/fix_uart_set_line_inverse_breaking_change_issue_v4.1' into 'release/v4.1'
Bugfix(uart): fix uart_set_line_inverse breaking change issue (v4.1)

See merge request espressif/esp-idf!17595
2022-04-25 10:15:57 +08:00
Michael (XIAO Xufeng)
a8e00c3691 esp_phy: use spinlock to avoid regi2c access conflicts 2022-04-06 15:20:03 +08:00
Michael (XIAO Xufeng)
c419c50c25 regi2c: use safe version of spinlock, instead of ISR ver 2022-04-06 15:04:03 +08:00
laokaiyao
387fb06aa0 i2s: fixed DAC no output issue
Closes https://github.com/espressif/esp-idf/issues/6470
2022-03-28 20:13:54 +08:00
houwenxiang
205c409d19 driver(uart): fix uart_set_line_inverse breaking change issue
closes https://github.com/espressif/esp-idf/issues/4581
2022-03-25 15:19:02 +08:00
chaijie
9100cd558e ESP32: Fix xtal 32k not oscillate or oscillate too slowly issue
ESP32 in revision0 and revision1 uses touchpad to provide
current to oscillate xtal 32k. But revision2 and revision3
do not need to do that.
Note: touchpad can not work and toupad/ULP wakeup sources
are not available when toupad provides current to xtal 32k
2022-03-25 14:20:54 +08:00
Jiang Jiang Jian
e604f638c7 Merge branch 'feature/refactor_phy_access_v4.1' into 'release/v4.1'
esp_wifi: refactor PHY access (Backport v4.1)

See merge request espressif/esp-idf!16985
2022-03-03 17:40:25 +08:00
morris
89a6396297 Merge branch 'bugfix/touch_ll_get_sleep_time_v4.1' into 'release/v4.1'
Fixed error in "touch_ll_get_sleep_time" function for ESP32 (v4.1)

See merge request espressif/esp-idf!16250
2022-03-02 19:19:34 +08:00
morris
81492361fc Merge branch 'bugfix/mcpwm-deadtime-preset-config-backport_v4.1' into 'release/v4.1'
MCPWM/deadtime: fix and sync preset deadtime modes with well-known definition (backport v4.1)

See merge request espressif/esp-idf!14624
2022-03-02 18:05:59 +08:00
Li Hang Fan
2f2d2e776c MCPWM/deadtime: fix and sync preset deadtime modes with well-known definition (backport v4.1) 2022-03-02 18:05:59 +08:00
Sergey Gorban
8bb2eb299e Fixed error in "touch_ll_get_sleep_time" function for ESP32
Merges https://github.com/espressif/esp-idf/pull/6895
2022-02-28 09:45:10 +00:00
Xia Xiaotian
5056892b9b esp_wifi: store PHY digital registers before disabling PHY and load
them after enabling PHY
2022-02-24 14:35:48 +08:00
Cao Sen Miao
19d2a765d3 psram: add ESP32-D0WD-R2-V3 support 2022-01-10 11:13:00 +08:00
Jiang Jiang Jian
488930b9f7 Merge branch 'bugfix/enable_gpio_20_v4.1' into 'release/v4.1'
gpio: Enable IO20 on ESP32 (backport v4.1)

See merge request espressif/esp-idf!15024
2021-12-03 03:37:33 +00:00
Jiang Jiang Jian
31203908a3 Merge branch 'bugfix/fix_adc-dma_reading_gap_for_esp32_backport_v4.1' into 'release/v4.1'
bugfix(adc): missing ranges of ADC codes in ESP32 (backport v4.1)

See merge request espressif/esp-idf!12878
2021-12-03 03:26:04 +00:00
Alberto García Hierro
f1a024e374 Enable IO20 on ESP32
Some newer ESP32 variants (like ESP32-PICO-V3 and ESP32-PICO-MINI-02)
do implement this pin and it can be used as a normal GPIO.

Fixes #6016
Fixes #6837

Closes https://github.com/espressif/esp-idf/pull/6918

(cherry picked from commit 6deaefde69)
2021-08-31 20:45:17 +08:00
Omar Chebib
c27290f205 regi2c: add a spinlock for accessing (reg)I2C devices
When not compiling bootloader, a spinlock will be used for reading or writing
I2C internal devices/registers.
When compiling for bootloader, no need to use any lock.
2021-07-31 17:30:07 +08:00
chenjianqiang
59a07d40ad psram: support for esp32-pico-v3-02
1. Support for 16Mbit PSRAM
2. Support for esp32-pico-v3-02
3. Use package identifier to look up SPI flash/PSRAM WP Pin, unless overridden
2021-07-22 18:19:23 +08:00
fuzhibo
21150d9286 bugfix(adc): missing ranges of ADC codes in ESP32 2021-07-04 22:22:40 +08:00
Renz Bagaporo
bf341d966c components: fix ldgen check errors 2021-06-21 09:52:03 +10:00
Cao Sen Miao
7180526645 spi_flash: fix cs line setup to make the flash driver more stable 2021-06-15 15:11:47 +08:00
Jiang Jiang Jian
d3f11b1e9d Merge branch 'bugfix/fix_uart_set_rx_timeout_feature_v41' into 'release/v4.1'
Bugfix/fix uart set rx timeout feature (backport v4.1)

See merge request espressif/esp-idf!11538
2021-05-10 03:41:08 +00:00
Alex Lisitsyn
538117a904 Bugfix/fix uart set rx timeout feature (backport v4.1) 2021-05-10 11:41:02 +08:00
Li Shuai
f417181e62 deep sleep: optimize sleep current in wifi softap mode 2021-04-29 14:14:15 +08:00
Marius Vikhammer
02ce0744f0 rtc: increase CI acceptance range for calc 8M test 2021-04-09 15:06:37 +08:00
Michael (XIAO Xufeng)
c10fd0edb2 Merge branch 'bugfix/uart_read_o2_v4.1' into 'release/v4.1'
hal: workaround for UART FIFO read on ESP32 with -O2 optimization (backport v4.1)

See merge request espressif/esp-idf!12660
2021-03-22 07:41:40 +00:00
Jiang Jiang Jian
b8c1824e37 Merge branch 'bugfix/spiram_reserve_size_pr5373_v4.1' into 'release/v4.1'
SPIRAM reserved memory size fixes (v4.1)

See merge request espressif/esp-idf!11517
2021-03-22 04:33:53 +00:00
Omar Chebib
8db219c292 hal: workaround for UART FIFO read on ESP32 with -O2 optimization 2021-03-09 14:18:28 +08:00
Darian Leung
fb2d6a44eb CAN: ISR runs when cache is disabled
This commit adds the feature where the CAN ISR will continue to
run even if the cache is disabled. Whilst cache is disabled, any
received messages will go into the RX queue, and any pending TX
messages in the TX queue will be transmitted. This feature should
be enabled using the CONFIG_CAN_ISR_IN_IRAM option.
2021-03-09 08:47:58 +08:00
Darian Leung
c2afe02507 CAN: Fix BRP field initialization onf ESP32 ECO3
This commit zero initializes the brp_div field on ESP32 ECO3
to prevent incorrect timing configuration.
2021-03-09 08:47:58 +08:00
Darian Leung
5311a60af2 CAN: Simplify caps header
This commit simplifies the defines made in the _caps.h header. Kconfig
option dependencies were moved into the LL, and the check for a
valid BRP has bee simplified.
2021-03-09 08:47:57 +08:00
Angus Gratton
42b126e4dd Merge branch 'bugfix/sign_compare_warning_in_soc_component' into 'release/v4.1'
fix sign compare warning in soc component

See merge request espressif/esp-idf!11434
2021-02-09 11:05:12 +08:00
morris
e85a444cd0 mcpwm: fix wrong capture edge 2021-02-06 21:45:51 +08:00
Cao Sen Miao
cabe0a44b7 adc_i2s: solve the i2s_adc issue when using wifi 2020-12-15 20:57:02 +08:00
negativekelvin
161569e3f9 Fix reserved psram region
Closes https://github.com/espressif/esp-idf/pull/5373

Closes https://github.com/espressif/esp-idf/issues/5821
2020-12-08 17:43:49 +11:00
morris
ec2817a285 soc: fix comparison error in soc component
Closes https://github.com/espressif/esp-idf/issues/6120
2020-12-02 12:23:17 +08:00
Alex Lisitsyn
40636d6a49 uart: fix uart_ll_is_tx_idle to inline into handler correctly when opt for size
Closes https://github.com/espressif/esp-idf/issues/5694
2020-11-23 12:16:57 +08:00
Jiang Jiang Jian
d09d5479a8 Merge branch 'feature/light_sleep_reject_v4.1' into 'release/v4.1'
sleep: enable sleep reject when entering light sleep (backport v4.1)

See merge request espressif/esp-idf!9500
2020-11-22 20:48:39 +08:00
Li Shuai
ab63824600 added psram stack check in backtrace 2020-11-20 07:13:11 +00:00
Michael (XIAO Xufeng)
ab1f6299ff Merge branch 'bugfix/fix_uart_module_enable_issue_v4.1' into 'release/v4.1'
Bugfix (uart):  fix uart module reset issue (release/v4.1)

See merge request espressif/esp-idf!8592
2020-11-05 10:32:28 +08:00
Michael (XIAO Xufeng)
7cbf4c4330 Merge branch 'bugfix/fix_i2s_reset_issue_v4.1' into 'release/v4.1'
driver(I2S): Fix I2S reset issue for release/v4.1

See merge request espressif/esp-idf!9584
2020-11-05 09:05:50 +08:00
houwenxiang
eda943b7c5 driver(uart): fix uart module reset issue (release/v4.1)
On ESP32, due to fifo reset issue, UART2 will work incorrectly if reset the fifo of UART1(TX fifo and RX fifo). The software can workaround the RX fifo reset issue,

  while the TX fifo reset issue can not. When UART2 is used and UART1 is used as the log output port, a software reset can reproduce this issue. So we should reset the UART memory

  before the software reset to solve this problem.
2020-11-04 18:41:43 +08:00
houwenxiang
9f6f510ce2 driver(I2S): Fix I2S reset issue for release/v4.1
`i2s_start` reseting I2S in incorrect order causeing the word-order error.
2020-11-04 08:18:20 +00:00
morris
353826cacc rmt: fix RMT data trancate issue
Closes https://github.com/espressif/esp-idf/issues/5992
2020-10-27 19:43:11 +08:00
Michael (XIAO Xufeng)
214cc69fc1 Merge branch 'bugfix/spi_master_multiple_dev_with_diff_cs_lvl_4.1' into 'release/v4.1'
spi_master: correctly set cs polarity (4.1)

See merge request espressif/esp-idf!10392
2020-09-21 10:19:33 +08:00
Michael (XIAO Xufeng)
edb19cd748 Merge branch 'bugfix/fix_rtcio_adc_driver_for_esp32' into 'release/v4.1'
rtc(adc/rtcio): fix adc rtcio driver for esp32

See merge request espressif/esp-idf!8347
2020-09-14 10:57:26 +08:00