各位,我无法确定这是主题还是题外话,但感觉与编程有关。
我有一块 ESP32 板,嵌入 NodeMCU 中。我已将 UART2USB 串行监视器直接连接到 ESP32 的 RX-TX,最初在通电后将其打印到串行控制台上:
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0008,len:8
load:0x3fff0010,len:3480
load:0x40078000,len:7804
ho 0 tail 12 room 4
load:0x40080000,len:252
entry 0x40080034
I (46) boot: ESP-IDF v2.0-3-gbef9896 2nd stage bootloader
我按照 Espressif 的说明构建了最简单的 helloworld 程序:
#include <stdio.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
void app_main(void)
{
printf("Hello world!\n");
/* Print chip information */
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
printf("This is %s chip with %d CPU core(s), WiFi%s%s, ",
CONFIG_IDF_TARGET,
chip_info.cores,
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
printf("silicon revision %d, ", chip_info.revision);
printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
printf("Minimum free heap size: %d bytes\n", esp_get_minimum_free_heap_size());
for (int i = 10; i >= 0; i--) {
printf("Restarting in %d seconds...\n", i);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
printf("Restarting now.\n");
fflush(stdout);
esp_restart();
}
此外,我成功地(我相信)编译并刷新了这个 hello world 示例(没有错误)到 ESP32。
但是之后,这会打印到串行监视器上:
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57
RTCWDT_RTC_RESET
不断重复。只有当我切断电源时才会停止。
正如我所说,我无法决定这个问题的“切题性”,因为我不确定这种有问题的行为是否是“helloworld”示例中的某种错误,或者来自其他地方。
我可能不小心删除了引导加载程序,所以我做了一个
make flash
。
这在构建文件夹中创建了一个
bootloader.bin
,我尝试刷新它,但这不会改变任何东西。
我通过
解决了这个问题首先,擦除闪存,这可以使用 esptool 来完成,或者如果您使用 platformio,则在 platformio 选项卡 -> 平台 - 擦除闪存下有一个菜单
esptool 命令:
python esptool.py --port COMxx --chip esp32 erase_flash
第二,清理并重建代码,然后将其上传到您的微型计算机。
希望这会有所帮助