Add the output RX result command

This commit is contained in:
xiehang 2023-02-16 15:31:32 +08:00
parent 481c264d0d
commit c8d7c9bd71
5 changed files with 61 additions and 5 deletions

View File

@ -56,6 +56,26 @@ typedef enum {
PHY_BLE_TYPE_MAX
} esp_phy_ble_type_t;
/**
* @brief Structure holding PHY RX result
*/
typedef struct {
uint32_t phy_rx_correct_count; /*!< The number of desired packets received */
int phy_rx_rssi; /*!< Average RSSI of desired packets */
uint32_t phy_rx_total_count; /*!< The number of total packets received */
uint32_t phy_rx_result_flag; /*!< 0 means no RX info; 1 means the lastest Wi-Fi RX info; 2 means the lastest BLE RX info. */
} esp_phy_rx_result_t;
/**
* @brief Wifi power domain power on
*/
void esp_wifi_power_domain_on(void);
/**
* @brief Wifi power domain power off
*/
void esp_wifi_power_domain_off(void);
/**
* @brief Environment variable configuration
*
@ -161,6 +181,13 @@ void esp_phy_ble_rx(uint32_t chan, uint32_t syncw, esp_phy_ble_rate_t rate);
*/
void esp_phy_bt_tx_tone(uint32_t start, uint32_t chan, uint32_t power);
/**
* @brief Get some RX information
*
* @param rx_result: This struct for storing RX information;
*/
void esp_phy_get_rx_result(esp_phy_rx_result_t *rx_result);
#ifdef __cplusplus
}
#endif

View File

@ -78,7 +78,10 @@ phy> esp_rx -n 1 -r 0
I (19348) phy: wifi rx start: channel is 1, rate is 0x0
phy>
phy> cmdstop
I (24248) phy: Correct: 1112 Desired: 773 RSSI: -633 noise: -960 gain: 629 para1: 12198 para2
I (142881) phy: Total: 535 Correct: 474 RSSI: -650 noise: -960 gain: 531 para1: 5759 para2: 3
phy>
phy> get_rx_result
I (145991) cmd_phy: Total: 535, Correct: 474, RSSI: -650, 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
@ -93,7 +96,10 @@ phy> esp_ble_rx -n 1 -s 0x71764129 -r 0
I (2898) phy: RW LE V9 RX PER
phy>
phy> cmdstop
I (7678) phy: 144 0 0 5 13f 0 0 0 0 0 p 0 0 0 0 0 0
I (381241) phy: 3 0 0 0 3 0 0 0 0 0 p -263 -86 -279 a8 -100 -77
phy>
phy> get_rx_result
I (383871) cmd_phy: Total: 3, Correct: 0, RSSI: 0, flag: 2
phy>
phy> bt_tx_tone -e 1 -n 1 -p 0
I (56008) phy: BT TX TONE START!

View File

@ -12,8 +12,6 @@
#include "cmd_phy.h"
#include "esp_phy_cert_test.h"
#include "esp_private/wifi.h"
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());

View File

@ -56,6 +56,23 @@ static int esp_phy_cmdstop_func(int argc, char **argv)
return 0;
}
static int esp_phy_get_rx_result_func(int argc, char **argv)
{
esp_phy_rx_result_t rx_result;
int nerrors = arg_parse(argc, argv, (void **) &phy_args);
if (nerrors != 0) {
arg_print_errors(stderr, phy_args.end, argv[0]);
return 1;
}
esp_phy_get_rx_result(&rx_result);
ESP_LOGI(TAG, "Total: %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;
}
#if SOC_WIFI_SUPPORTED
void cert_wifi_tx(void *arg)
{
@ -393,6 +410,15 @@ void register_phy_cmd(void)
};
ESP_ERROR_CHECK( esp_console_cmd_register(&cmdstop_cmd) );
const esp_console_cmd_t get_rx_result = {
.command = "get_rx_result",
.help = "Get RX information",
.hint = NULL,
.func = &esp_phy_get_rx_result_func,
.argtable = NULL
};
ESP_ERROR_CHECK( esp_console_cmd_register(&get_rx_result) );
#if SOC_WIFI_SUPPORTED
const esp_console_cmd_t cbw40m_cmd = {
.command = "cbw40m_en",

View File

@ -1,4 +1,3 @@
CONFIG_ESP_INT_WDT=n
CONFIG_ESP_TASK_WDT_EN=n
CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION=y