-
Notifications
You must be signed in to change notification settings - Fork 1.6k
esp_wifi_connect() does not yield to other tasks? (GIT8266O-176) #616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
连接 Wi-Fi 的时候会有 13-14 优先级的 task 用于计算 Wi-Fi 的 key,这个时间暂时没有办法优化。 |
Hi @donghengqaz , |
could you please seperate the task to small pieces ?It's Unacceptable in real time control system 。 |
Hi @metadata1984 , hi @donghengqaz, I investigated a bit more. I'm not longer able to reproduce the issue related to a succesfully connection, but using instead a right ssid with a WRONG password, the issue is always present: 900 ms of latency on ANY task priority level (0 to 14). So, we are loosing the freertos scheduler at all, the idle / tick hooks and the freertos tick count too. I also seen that the critical sections (vPortEnterCritical and vPortExitCritical (port.c)) are supposed to stops interrupts on level 1 only, but it seems to me to the used portDISABLE_INTERRUPTS macro is disabling up to the level 3 instead (hardware timers). Anyway, vPortEnterCritical and vPortExitCritical are not related to the latency (a logic analyzer confirmed it to me), so, the true issue must be located elsewhere, likely in the closed wifi driver. |
missed information: tests performed using clock: 160Mhz, freertos freq.: 250Hz. I will try soon to lower the frequency to 100hz freq. in search of changes of the issue. |
Update: changing the freertos frequency does nothing. I also confirm that all hardware interrupts are disabled, even Timer 1 interrupts. |
I mean that when do the Wi-Fi connection, the software will close the hardware interrupt and get AP's information and do some calculation, and this behavior should cost some time, so not only task switch but also other hardware interrupt is pending. |
Hi @donghengqaz |
cpu frq: 80MHZ,freertos frq default settings。 |
I found anther similar issue today。IT may be useful。 when task2 code like that: wifi_station_set_config_current(&stationConf); // here the task1 block about 1s。 then i change the code wifi_station_set_config(&stationConf); // here burn the firmware and start ,task1 block about 1s in first system boot。 what ‘s the wrong。。。。。。。。。。。 |
BTW burn the firmware and start system scandone block 1s。 but reboot the system the log output reconnect the blocking issue disappear。。。 |
Hi @metadata1984, |
Closing due to lack of response, please feel free to reopen if this is still an issue. Thanks. |
Environment
Development Kit:Node Mcu
IDF version (git rev-parse --short HEAD to get the commit id.): V3.1
Development Env: Eclipse
Operating System: Windows
Power Supply: USB
Problem Description
测试项目给予 esp8266_rtos_3.1 。测试代码中带两个任务.任务1 使用examples的http_request事例不停连接测试地址,任务2驱动led屏幕。任务2优先级11.
测试代码中,任务2不停刷新液晶屏幕。测试发现当任务1执行完esp_wifi_connect()后。任务2液晶被挂起大约1s左右。
当串口输出如下日志后,任务2重新执行。
[18:47:52.699]收←◆scandone
[18:47:53.705]收←◆state: 0 -> 2 (b0)
state: 2 -> 3 (0)
[18:47:53.754]收←◆state: 3 -> 5 (10)
add 0
aid 5
pm open phy_2,type:2 0 0
cnt
任务2中的关键代码
IRAM_ATTR void tm3130_send_data(uint32_t data)
{
TM_DIN_PIN_GPIO_LOW();
// ets_delay_us(200);
// ETS_NMI_LOCK();
ETS_INTR_LOCK();
// asm volatile("nop;nop;");
TM_ONE_HIGH_DELAY();
TM_DIN_PIN_GPIO_LOW();
TM_ONE_LOW_DELAY();
}else{
// asm volatile("nop;nop;");
TM_ZERO_HIGH_DELAY();
TM_DIN_PIN_GPIO_LOW();
TM_ZERO_LOW_DELAY();
}
// ETS_NMI_UNLOCK();
ets_delay_us(200);
TM_DIN_PIN_GPIO_HIGH();
}
按照文档说明,esp_event_loop的优先级为10,但是任务2的优先级为11.按理可抢占。但测试发现任务2被暂停接近1s。 此问题应如何解决?
The text was updated successfully, but these errors were encountered: