W (30761) wifi:unknown csi bug!
Posted: Sun Mar 21, 2021 3:28 am
Hello,espressif.
here I meet some problem while using WIFI CSI.
here is my idf version:idf-v4.0.2
I run one task in my code:ping_task which send ping message to the ap per second,thus the esp32 will get csi infomation.
this is the main code:
and the wifi_csi_init code:
csi callback function.the callback function print the amplitude and phase data when csi data are recieved.
finally,the ping task code is below:the task will send ping message to gateway every second inorder to get csi infomation
I don't known why this ''W (30761) wifi:unknown csi bug!'' are printed.Can anyone help me with the problem?
Tanks for your reading!
here I meet some problem while using WIFI CSI.
here is my idf version:idf-v4.0.2
I run one task in my code:ping_task which send ping message to the ap per second,thus the esp32 will get csi infomation.
this is the main code:
Code: Select all
void app_main()
{
nvs_init();
station_init();
csi_event = xEventGroupCreate();
csi_init("STA");
xEventGroupSetBits(csi_event, DATA_PC_TX);
xEventGroupWaitBits(s_wifi_event_group, WIFI_CONNECTED_BIT, pdFAIL, pdFAIL, portMAX_DELAY);
xTaskCreate(ping_task, "ping", 4096, NULL, 5, NULL);
}
Code: Select all
void csi_init(char *type)
{
project_type = type;
ESP_ERROR_CHECK(esp_wifi_set_csi(true));
wifi_csi_config_t configuration_csi;
configuration_csi.lltf_en = 1;
configuration_csi.htltf_en = 1;
configuration_csi.stbc_htltf2_en = 1;
configuration_csi.ltf_merge_en = 1;
configuration_csi.channel_filter_en = 0;
configuration_csi.manu_scale = 0;
ESP_ERROR_CHECK(esp_wifi_set_csi_config(&configuration_csi));
ESP_ERROR_CHECK(esp_wifi_set_csi_rx_cb(&_wifi_csi_cb, NULL));
}
Code: Select all
void _wifi_csi_cb(void *ctx, wifi_csi_info_t *data)
{
int8_t *my_ptr = data->buf;
int i = 0;
int bit = xEventGroupGetBits(csi_event);
if (bit & DATA_PC_TX)
{
int i = 0;
for ( i = 0; i < 64; i++)
{
outprintf("%.4f,", sqrt(pow(my_ptr[i * 2], 2) + pow(my_ptr[(i * 2) + 1], 2)));
}
for (i = 0; i < 63;i++)
{
outprintf("%.4f,", atan2(my_ptr[i*2], my_ptr[(i*2)+1]));
}
outprintf("%.4f\n", atan2(my_ptr[i*2], my_ptr[(i*2)+1]));
}
}
Code: Select all
static void ping_task(void *arg)
{
uint32_t timeout = 1000;
uint32_t total_count = 100;
uint32_t current_count = 0;
in_addr_t gw_ip = inet_addr("192.168.3.4"); //ping网关
int s, ret;
LWIP_UNUSED_ARG(arg);
//创建ipv4,原生协议接口,使用ICMP协议
if ((s = socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP)) < 0)
{
printf("create socket fail\n");
}
ret = setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
if (ret == 0)
{
printf("set socket timeout success\n");
}
int tos = 1;
tos <<= 5;
ret = setsockopt(s, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
if (ret == 0)
{
printf("set socket tos success\n");
}
while (1)
{
if (current_count++ >= total_count)
{
ping_flag = false;
}
if(ping_flag)
{
if (ping_send(s, gw_ip) == ERR_OK)
{
//printf("ping send ok \n");
//gettimeofday(&ping_time, NULL);
//ping_recv(s);
}
else
{
printf("ping send fail \n");
}
}
vTaskDelay(1000 / portTICK_RATE_MS);
}
}
Tanks for your reading!