KV-DB初始化失败

Wi-Fi 设备、Wi-Fi 低功耗设备、Wi-Fi BLE 双模设备、Ethernet设备、Ethernet+Wi-Fi设备等
Post Reply
hws
Posts: 9

硬件平台:esp32s3
TuyaOS版本:tuyaos-iot_3.6.111-beta.11_esp32_esp32s3_1.0.32
在运行tuya_iot_init_params(NULL, &init_param) 时会失败,

代码:

Code: Select all

extern "C" void app_main()
{
// nvs_init();
//
// int ret = xTaskCreatePinnedToCore(app_start, "Init", 1024 * 8, nullptr, 24, nullptr,1);
// if (ret != pdPASS) {
// log_e("Init task ret %d", ret);
// }

OPERATE_RET rt = OPRT_OK;
TY_INIT_PARAMS_S init_param = {0};

init_param.init_db = true;
strcpy(init_param.sys_env, TARGET_PLATFORM);
rt = tuya_iot_init_params(NULL, &init_param);
if (rt != OPRT_OK)
{
log_e("IOT: Failed to init tuya params! error code: %d",rt);
//return;
}
//init_sd_fatfs();

//IOT::instance().begin();
}

单独运行此段代码仍然初始化失败。
打印的log为:

Code: Select all

(00:59:47.024) TKL_LOG: [01-01 00:00:00 ty I][tal_thread.c:184] thread_create name:sys_timer,stackDepth:4096,totalstackDepth:4096,priority:5

I (00:59:47.035) TKL_LOG: [01-01 00:00:00 ty I][tal_thread.c:184] thread_create name:wq_system,stackDepth:9216,totalstackDepth:13312,priority:3

I (00:59:47.049) TKL_LOG: [01-01 00:00:00 ty I][tal_thread.c:184] thread_create name:wq_highpri,stackDepth:6144,totalstackDepth:19456,priority:4

I (00:59:47.064) pp: pp rom version: e7ae62f
I (00:59:47.068) net80211: net80211 rom version: e7ae62f
W (1202) wifi:wifi osi_nvs_open fail ret=4353

I (00:59:47.078) wifi_init: rx ba win: 6
I (00:59:47.083) wifi_init: tcpip mbox: 32
I (00:59:47.087) wifi_init: udp mbox: 6
I (00:59:47.092) wifi_init: tcp mbox: 6
I (00:59:47.096) wifi_init: tcp tx win: 5744
I (00:59:47.101) wifi_init: tcp rx win: 5744
I (00:59:47.106) wifi_init: tcp mss: 1440
I (00:59:47.111) wifi_init: WiFi IRAM OP enabled
I (00:59:47.116) wifi_init: WiFi RX IRAM OP enabled
I (00:59:47.123) TKL_LOG: [01-01 00:00:00 ty I][tal_thread.c:184] thread_create name:health_monitor,stackDepth:4096,totalstackDepth:23552,priority:5

I (00:59:47.136) TKL_LOG: [01-01 00:00:00 ty I][mqc_app.c:429] mqc app init ...

I (00:59:47.146) TKL_LOG: [01-01 00:00:00 ty E][log_seq.c:873] logseq empty

I (00:59:47.153) TKL_LOG: [01-01 00:00:00 ty N][simple_flash.c:446] key_addr: 0x0 block_sz 4096

I (00:59:47.165) TKL_LOG: [01-01 00:00:00 ty E][simple_flash.c:466] key data is not matched magic(0x3a2d3e45),crc32(0xe2d8782c)

I (00:59:47.175) TKL_LOG: [01-01 00:00:00 ty E][simple_flash.c:480] flash is encrypted or empty

I (00:59:47.184) TKL_LOG: [01-01 00:00:00 ty E][simple_flash_app.c:355] create_flash_hand_and_init err 10

I (00:59:47.195) TKL_LOG: [01-01 00:00:00 ty E][tuya_ws_db.c:446] db init fails -1

I (00:59:47.203) TKL_LOG: [01-01 00:00:00 ty E][tuya_iot_com_api.c:79] db init fails -1

I (00:59:47.212) TKL_LOG: [01-01 00:00:00 ty E][tuya_iot_com_api.c:129] ret:-1

[ 1344][E][app_main.cpp:294] app_main(): IOT: Failed to init tuya params! error code: -1

请帮忙看看可能是什么原因!

Attachments
log.txt
(4.31 KiB) Downloaded 83 times
partitions.csv
(521 Bytes) Downloaded 86 times

Tags:
JSHANG
Posts: 35

Re: KV-DB初始化失败

从日志上看模组没有授权导致的。

hws
Posts: 9

Re: KV-DB初始化失败

问题已经解决了,原因是flash没有经过涂鸦的产测,需要用ws_db_init_mf()初始化flash。
还有几个问题想问一下:
1.https://developer.tuya.com/cn/docs/iot- ... pzb0cmytl7文档说明要使用涂鸦的产测工具来初始化flash,这个工具是开放的嘛,我是否可以使用;有没有接口可以查询flash的初始化情况,不然我在程序里加ws_db_init_mf(),每次程序启动都要初始化flash.
2.我的TuyaOS 针对esp32s3 使用的esp-idf 框架版本是v4.4.1,该版本框架有一些未实现的功能,比如esp_bt_controller_mem_release() 接口,源码为:

Code: Select all

esp_err_t esp_bt_controller_mem_release(esp_bt_mode_t mode)
{
ESP_LOGW(BT_LOG_TAG, "%s not implemented, return OK", __func__);
return ESP_OK;
}

想问有没有针对esp32的TuyaOS使用esp-idf v5.0 以上稳定支持的版本。

愚者千虑必有一得
Posts: 499

Re: KV-DB初始化失败

你好,生产授权的软件是开放的,有专门给开发者使用的免账号版本,你可以参考这个文章:https://developer.tuya.com/cn/docs/iot/ ... v15oujgz00

esp-idf版本的问题,我们现在支持的是4.4.1版本,主要是稳定可商用,如果你有一些新功能的需求,可以尝试自己先做一些代码的搬移合并,我们目前短期没有更新升级的计划。

Post Reply