Skip to content
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

Fix no WiFi RF packet send issue and upgrade to IDF v4.4(latest) #23

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions air_firmware/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,9 @@ esp_err_t set_wifi_fixed_rate(WIFI_Rate value)
WIFI_PHY_RATE_MCS7_LGI,
WIFI_PHY_RATE_MCS7_SGI,
};
esp_err_t err = esp_wifi_internal_set_fix_rate(ESP_WIFI_IF, true, (wifi_phy_rate_t)rates[(int)value]);

esp_err_t err = esp_wifi_config_80211_tx_rate(ESP_WIFI_IF, (wifi_phy_rate_t)rates[(int)value]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rates in that array were hand-tuned for the esp_wifi_internal_set_fix_rate API. Not sure if they map well to the esp_wifi_config_80211_tx_rate API. I used wireshark to capture the packets and validate the rates for each of the setting.

Copy link
Contributor Author

@lida2003 lida2003 Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug findings: please check and compare under one factor only.
Because I made a mess here.

a) sdkconfig will cause "interface invalid"
b) no RF packet send might be caused by "esp_wifi_internal_set_fix_rate"
c) printf internal buffer is NOT enough for last two parameters "WLAN S: %d, R: %d, E: %d, D: %d, %%: %d || FPS: %d, D: %d || D: %d, E: %d\n"

//esp_err_t err = esp_wifi_internal_set_fix_rate(ESP_WIFI_IF, true, (wifi_phy_rate_t)rates[(int)value]);
//esp_err_t err = esp_wifi_internal_set_fix_rate(ESP_WIFI_IF, true, (wifi_phy_rate_t)value);
if (err == ESP_OK)
s_wlan_rate = value;
Expand Down Expand Up @@ -1002,7 +1004,7 @@ IRAM_ATTR static void wifi_tx_proc(void *)
}
else //other errors
{
//LOG("Wlan err: %d\n", res);
//LOG("Wlan err: 0x%x\n", res);
s_stats.wlan_error_count++;
xSemaphoreTake(s_wlan_outgoing_mux, portMAX_DELAY);
end_reading_wlan_outgoing_packet(packet);
Expand Down Expand Up @@ -1457,19 +1459,19 @@ extern "C" void app_main()

{
int core = tskNO_AFFINITY;
BaseType_t res = xTaskCreatePinnedToCore(&wifi_tx_proc, "Wifi TX", 2048, nullptr, 1, &s_wifi_tx_task, core);
BaseType_t res = xTaskCreatePinnedToCore(&wifi_tx_proc, "Wifi TX", 2560, nullptr, 1, &s_wifi_tx_task, core);
if (res != pdPASS)
LOG("Failed wifi tx task: %d\n", res);
}
{
int core = tskNO_AFFINITY;
BaseType_t res = xTaskCreatePinnedToCore(&wifi_rx_proc, "Wifi RX", 2048, nullptr, 1, &s_wifi_rx_task, core);
BaseType_t res = xTaskCreatePinnedToCore(&wifi_rx_proc, "Wifi RX", 2560, nullptr, 1, &s_wifi_rx_task, core);
if (res != pdPASS)
LOG("Failed wifi rx task: %d\n", res);
}
{
int core = tskNO_AFFINITY;
BaseType_t res = xTaskCreatePinnedToCore(&sd_write_proc, "SD Write", 4096, nullptr, 1, &s_sd_write_task, core);
BaseType_t res = xTaskCreatePinnedToCore(&sd_write_proc, "SD Write", 5120 /*4096*/, nullptr, 1, &s_sd_write_task, core);
if (res != pdPASS)
LOG("Failed sd write task: %d\n", res);
}
Expand All @@ -1489,7 +1491,7 @@ extern "C" void app_main()
if (s_uart_verbose > 0 && millis() - s_stats_last_tp >= 1000)
{
s_stats_last_tp = millis();
LOG("WLAN S: %d, R: %d, E: %d, D: %d, %%: %d || FPS: %d, D: %d || D: %d, E: %d\n",
LOG("S: %d, R: %d, E: %d, D: %d, %%: %d | FPS: %d, D: %d | D: %d, E: %d\n",
s_stats.wlan_data_sent, s_stats.wlan_data_received, s_stats.wlan_error_count, s_stats.wlan_received_packets_dropped, s_wlan_outgoing_queue.size() * 100 / s_wlan_outgoing_queue.capacity(),
(int)s_stats.video_frames, s_stats.video_data, s_stats.sd_data, s_stats.sd_drops);
print_cpu_usage();
Expand Down
Loading