From beb545c0eac9ad69bd1976146173e566dcfe8fe9 Mon Sep 17 00:00:00 2001 From: xiehang Date: Tue, 21 Mar 2023 10:49:02 +0800 Subject: [PATCH] cert_test: example: Fix cert_test blocking issue --- examples/phy/cert_test/README.md | 63 +++++++++++++++------------ examples/phy/cert_test/main/cmd_phy.c | 22 +++++----- 2 files changed, 48 insertions(+), 37 deletions(-) diff --git a/examples/phy/cert_test/README.md b/examples/phy/cert_test/README.md index b5ff530578..ee41af138c 100644 --- a/examples/phy/cert_test/README.md +++ b/examples/phy/cert_test/README.md @@ -60,49 +60,58 @@ Press TAB when typing command name to auto-complete. I (598) main_task: Returned from app_main() phy> phy> tx_contin_en 1 -I (4788) phy: Tx continuous test! -phy> +I (11870) phy: Tx continuous test! +phy> phy> tx_contin_en 0 -I (7518) phy: Tx packet test! -phy> +I (19860) phy: Tx packet test! +phy> phy> cbw40m_en 1 -I (10668) phy: cbw40m_en: 1 -phy> +I (25660) phy: cbw40m_en: 1 +phy> phy> cbw40m_en 0 -I (13238) phy: cbw40m_en: 0 -phy> +I (33490) phy: cbw40m_en: 0 +phy> +phy> esp_tx -n 1 -r 0x0 -p 0 -l 1000 -d 1000 -c 0 +I (39640) phy: Wifi tx out: chan=1, rate=0x0, BK=0, len=1000, delay=1000, tx_num=0 +phy> phy> cmdstop -I (8828) phy: Tx Over 0x0 -phy> +I (45460) phy: Tx Over 0x0 +phy> phy> esp_rx -n 1 -r 0 -I (19348) phy: wifi rx start: channel is 1, rate is 0x0 -phy> +I (51130) phy: wifi rx start: channel is 1, rate is 0x0 +phy> phy> cmdstop -I (142881) phy: Total: 535 Correct: 474 RSSI: -650 noise: -960 gain: 531 para1: 5759 para2: 3 +I (58800) phy: rx_num: 166 rx_rssi: -527 phy> phy> get_rx_result -I (145991) cmd_phy: Total: 535, Correct: 474, RSSI: -650, flag: 1 -phy> +I (66350) cmd_phy: Desired: 167, Correct: 166, RSSI: -527, flag: 1 +phy> phy> wifiscwout -e 1 -c 1 -p 0 -I (98308) phy: wifi single carrier tx out, single carrier is in 1 channel, power is about (2 -phy> +I (80310) phy: wifi single carrier tx start: chan=1, pwr=20-0.0 +phy> +phy> wifiscwout -e 0 -c 1 -p 0 +I (88260) phy: wifi single carrier tx stop +phy> phy> esp_ble_tx -p 8 -n 1 -l 37 -t 2 -s 0x71764129 -r 0 -m 0 -I (319138) phy: fcc_le_tx_syncw: txpwr=8,chan=1,len=37,data_type=2,syncw=0x71764129,rate=0,tx_ -phy> +I (91470) phy: ble_tx:pwr=8,chan=1,len=37,type=2,syncw=0x71764129,rate=0,txnum=0 +phy> phy> cmdstop -I (321208) phy: rw done! ce9 -phy> +I (98650) phy: rw done! e22e +phy> phy> esp_ble_rx -n 1 -s 0x71764129 -r 0 -I (2898) phy: RW LE V9 RX PER -phy> +I (104990) phy: RW LE V9 RX PER +phy> phy> cmdstop -I (381241) phy: 3 0 0 0 3 0 0 0 0 0 p -263 -86 -279 a8 -100 -77 +I (130260) phy: rx_num: 0 rx_rssi: 0 phy> phy> get_rx_result -I (383871) cmd_phy: Total: 3, Correct: 0, RSSI: 0, flag: 2 -phy> +I (139550) cmd_phy: Desired: 0, Correct: 0, RSSI: 0, flag: 2 +phy> phy> bt_tx_tone -e 1 -n 1 -p 0 -I (56008) phy: BT TX TONE START! +I (151900) phy: BT TX TONE START! +phy> +phy> bt_tx_tone -e 0 -n 1 -p 0 +I (191970) phy: BT TX TONE STOP! phy> ``` diff --git a/examples/phy/cert_test/main/cmd_phy.c b/examples/phy/cert_test/main/cmd_phy.c index 4672a866ae..35365861d0 100644 --- a/examples/phy/cert_test/main/cmd_phy.c +++ b/examples/phy/cert_test/main/cmd_phy.c @@ -13,6 +13,8 @@ #define TAG "cmd_phy" +#define CERT_TASK_PRIO 2 + #if CONFIG_ESP_PHY_ENABLE_CERT_TEST static phy_args_t phy_args; @@ -67,7 +69,7 @@ static int esp_phy_get_rx_result_func(int argc, char **argv) esp_phy_get_rx_result(&rx_result); - ESP_LOGI(TAG, "Total: %lu, Correct: %lu, RSSI: %d, flag: %lu", rx_result.phy_rx_total_count, + ESP_LOGI(TAG, "Desired: %lu, Correct: %lu, RSSI: %d, flag: %lu", rx_result.phy_rx_total_count, rx_result.phy_rx_correct_count, rx_result.phy_rx_rssi, rx_result.phy_rx_result_flag); return 0; @@ -111,7 +113,7 @@ static int esp_phy_cbw40m_en_func(int argc, char **argv) static int esp_phy_wifi_tx_func(int argc, char **argv) { - phy_wifi_tx_s cmd; + static phy_wifi_tx_s cmd; int nerrors = arg_parse(argc, argv, (void **) &phy_wifi_tx_args); if (nerrors != 0) { arg_print_errors(stderr, phy_wifi_tx_args.end, argv[0]); @@ -160,14 +162,14 @@ static int esp_phy_wifi_tx_func(int argc, char **argv) ESP_LOGW(TAG, "Default packet_num is 0"); } - xTaskCreate(cert_wifi_tx, "cert_wifi_tx", 1024 * 10, (void *)&cmd, 10, NULL); + xTaskCreate(cert_wifi_tx, "cert_wifi_tx", 1024 * 10, (void *)&cmd, CERT_TASK_PRIO, NULL); return 0; } static int esp_phy_wifi_rx_func(int argc, char **argv) { - phy_wifi_tx_s cmd; + static phy_wifi_rx_s cmd; int nerrors = arg_parse(argc, argv, (void **) &phy_wifi_rx_args); if (nerrors != 0) { arg_print_errors(stderr, phy_wifi_rx_args.end, argv[0]); @@ -188,7 +190,7 @@ static int esp_phy_wifi_rx_func(int argc, char **argv) ESP_LOGW(TAG, "Default rate is PHY_RATE_1M"); } - xTaskCreate(cert_wifi_rx, "cert_wifi_rx", 1024 * 20, (void *)&cmd, 10, NULL); + xTaskCreate(cert_wifi_rx, "cert_wifi_rx", 1024 * 20, (void *)&cmd, CERT_TASK_PRIO, NULL); return 0; } @@ -253,7 +255,7 @@ void cert_ble_rx(void *arg) static int esp_phy_ble_tx_func(int argc, char **argv) { - phy_ble_tx_s cmd; + static phy_ble_tx_s cmd; int nerrors = arg_parse(argc, argv, (void **) &phy_ble_tx_args); if (nerrors != 0) { arg_print_errors(stderr, phy_ble_tx_args.end, argv[0]); @@ -309,14 +311,14 @@ static int esp_phy_ble_tx_func(int argc, char **argv) ESP_LOGW(TAG, "Default tx_num_in is 0"); } - xTaskCreate(cert_ble_tx, "cert_ble_tx", 4096, (void *)&cmd, 10, NULL); + xTaskCreate(cert_ble_tx, "cert_ble_tx", 4096, (void *)&cmd, CERT_TASK_PRIO, NULL); return 0; } static int esp_phy_ble_rx_func(int argc, char **argv) { - phy_ble_rx_s cmd; + static phy_ble_rx_s cmd; int nerrors = arg_parse(argc, argv, (void **) &phy_ble_rx_args); if (nerrors != 0) { arg_print_errors(stderr, phy_ble_rx_args.end, argv[0]); @@ -324,7 +326,7 @@ static int esp_phy_ble_rx_func(int argc, char **argv) } if (phy_ble_rx_args.channel->count == 1) { - cmd.channel = phy_ble_tx_args.channel->ival[0]; + cmd.channel = phy_ble_rx_args.channel->ival[0]; } else { cmd.channel = 1; ESP_LOGW(TAG, "Default channel is 1"); @@ -344,7 +346,7 @@ static int esp_phy_ble_rx_func(int argc, char **argv) ESP_LOGW(TAG, "Default rate is PHY_BLE_RATE_1M"); } - xTaskCreate(cert_ble_rx, "cert_ble_rx", 4096, (void *)&cmd, 10, NULL); + xTaskCreate(cert_ble_rx, "cert_ble_rx", 4096, (void *)&cmd, CERT_TASK_PRIO, NULL); return 0; }