T1被不同GPIO唤醒后,调用tkl_wakeup_source_type_get获取到的gpio_num相同

Wi-Fi 设备、蜂窝设备、WuKongAI、开发板、TuyaOS 移植等


Post Reply
moehentai
Posts: 2

版本:3.11.11
平台:T1
问题描述:T1有两个GPIO唤醒源P8和P9,唤醒后tkl_wakeup_source_type_get获取到的gpio_num均为8,应该怎么区分唤醒的gpio?
是否必现:是

Attachments
Serial Debug 2025-07-17 145625.txt
(57.58 KiB) Downloaded 4 times
JSHANG
Posts: 74

Re: T1被不同GPIO唤醒后,调用tkl_wakeup_source_type_get获取到的gpio_num相同

在3.11.11版本上验证,通过tkl_wakeup_source_type_get可以区分是gpio8, 还是gpio9唤醒的,请检查自己设置唤醒的gpio配置,和gpio接的对不对, 本地测试如下:
配置gpio8和gpio9唤醒, tkl_wakeup.c 里面的测试代码:
#if 1
void wakeup_unit_test(void)
{
TUYA_WAKEUP_SOURCE_BASE_CFG_T cfg;

Code: Select all

memset(&cfg, 0, sizeof(cfg));

#if 0
cfg.source = TUYA_WAKEUP_SOURCE_TIMER;
cfg.wakeup_para.timer_param.ms = 60000;

Code: Select all

tkl_wakeup_source_set(&cfg);

#endif
cfg.source = TUYA_WAKEUP_SOURCE_GPIO;
cfg.wakeup_para.gpio_param.gpio_num = 8;
cfg.wakeup_para.gpio_param.level = TUYA_GPIO_WAKEUP_HIGH;
tkl_wakeup_source_set(&cfg);

Code: Select all

cfg.wakeup_para.gpio_param.gpio_num = 9;
cfg.wakeup_para.gpio_param.level = TUYA_GPIO_WAKEUP_HIGH;
tkl_wakeup_source_set(&cfg);

//cfg.source = TUYA_WAKEUP_SOURCE_GPIO;
//tkl_wakeup_source_clear(&cfg);

//cfg.source = TUYA_WAKEUP_SOURCE_TIMER;
//tkl_wakeup_source_clear(&cfg);

tkl_cpu_sleep_mode_set(1, TUYA_CPU_DEEP_SLEEP);

}
#endif

gpio8 触发唤醒:
hal_machw_enter_monitor_mode
[01-01 00:00:01 ty D][4119][prod_test.c:172] prodtest_listen_start success
[01-01 00:00:01 ty D][41fe][prod_test.c:77] beacon ssid error:0
[01-01 00:00:01 ty D][4119][prod_test.c:274] -------------ssid filter-------------
[01-01 00:00:01 ty N][4119][prod_test.c:352] cannot found prod ssid,ret:-6
[01-01 00:00:01 ty D][4119][tuya_app_main.c:212] device_init in
[01-01 00:00:01 ty I][4119][tal_thread.c:200] thread_create name:gfw_core,stackDepth:5120,totalstackDepth:29696,priority:3
[01-01 00:00:01 ty I][4119][tal_thread.c:200] thread_create name:lp_irq_task,stackDepth:2048,totalstackDepth:31744,priority:3
tkl_wakeup_source_type_get: source 0 gpio 8
tkl_wakeup_source_set: wake_up_way 0x1 sleep_time 0 gpio_index_map 0x100 gpio_edge_map 0x0 gpio_last_index_map 0x0 gpio_last_edge_map 0x0
tkl_wakeup_source_set: wake_up_way 0x1 sleep_time 0 gpio_index_map 0x300 gpio_edge_map 0x0 gpio_last_index_map 0x0 gpio_last_edge_map 0x0
*******************************tuya_os_adapt_set_cpu_lp_mode,en = 1, mode = 1
deep sleep enable

gpio9触发唤醒:
update_ongoing_1_bcn_update
hal_machw_enter_monitor_mode
[01-01 00:00:01 ty D][4119][prod_test.c:172] prodtest_listen_start success
[01-01 00:00:01 ty D][4119][prod_test.c:274] -------------ssid filter-------------
[01-01 00:00:01 ty N][4119][prod_test.c:352] cannot found prod ssid,ret:-6
[01-01 00:00:01 ty D][4119][tuya_app_main.c:212] device_init in
[01-01 00:00:01 ty I][4119][tal_thread.c:200] thread_create name:gfw_core,stackDepth:5120,totalstackDepth:29696,priority:3
[01-01 00:00:01 ty I][4119][tal_thread.c:200] thread_create name:lp_irq_task,stackDepth:2048,totalstackDepth:31744,priority:3
tkl_wakeup_source_type_get: source 0 gpio 9
tkl_wakeup_source_set: wake_up_way 0x1 sleep_time 0 gpio_index_map 0x100 gpio_edge_map 0x0 gpio_last_index_map 0x0 gpio_last_edge_map 0x0
tkl_wakeup_source_set: wake_up_way 0x1 sleep_time 0 gpio_index_map 0x300 gpio_edge_map 0x0 gpio_last_index_map 0x0 gpio_last_edge_map 0x0
*******************************tuya_os_adapt_set_cpu_lp_mode,en = 1, mode = 1
deep sleep enable

Post Reply