Open lida2003 opened 1 year ago
two wifi cards, still nothing.
$ sudo -E DISPLAY=:0 ./gs
(I) src/PI_HAL.cpp: 125: Initializing pigpio
(I) src/PI_HAL.cpp: 283: Drivers: 4
(I) src/PI_HAL.cpp: 286: Driver 0: x11
(I) src/PI_HAL.cpp: 286: Driver 1: wayland
(I) src/PI_HAL.cpp: 286: Driver 2: RPI
(I) src/PI_HAL.cpp: 286: Driver 3: dummy
(I) src/PI_HAL.cpp: 295: Mode 0: 1280x720
(I) src/Comms.cpp: 718: Radiocap header size: 11, IEEE header size: 24
(I) src/Comms.cpp: 581: Opening interface wlan1 in monitor mode
(I) src/Comms.cpp: 282: DLT_IEEE802_11_RADIO Encap
(I) src/Comms.cpp: 581: Opening interface wlan2 in monitor mode
(I) src/Comms.cpp: 282: DLT_IEEE802_11_RADIO Encap
(I) src/Video_Decoder.cpp: 160: SDL window: 28891200
(I) src/Video_Decoder.cpp: 160: SDL window: 28891200
(I) src/Video_Decoder.cpp: 160: SDL window: 28891200
(I) src/Video_Decoder.cpp: 160: SDL window: 28891200
(I) src/main.cpp: 104: RX len: 0, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 0, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 0, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 0, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 0, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 0, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 0, RSSI: 0, Latency: 0/0/0
Really strange thing. 1) No video string 2) Camera received gs, but gs can receive streaming video intermittently 3) Just run for a little bit long time, gs received no packet any more......
$ git log -n 1
commit 56ee43ec5ea813809fc1a9da1cc644559b4ea975 (HEAD, origin/release/v4.3)
Merge: 0d48889e81 b44da528db
Author: Jiang Jiang Jian <jack@espressif.com>
Date: Tue Jan 17 19:56:03 2023 +0800
Merge branch 'bugfix/sta_add_config_for_wpa3_transition_disable_v4.3' into 'release/v4.3'
esp_wifi:Add wifi station config for enabling transition_disbale feature
See merge request espressif/esp-idf!21332
commit 9ee3c8337d3c4f7914f62527e7f7c78d7167be95 (HEAD -> release/v4.4, origin/release/v4.4)
Merge: 221df10ced a744595440
Author: Jiang Jiang Jian <jack@espressif.com>
Date: Fri Dec 23 10:39:38 2022 +0800
Merge branch 'bugfix/avoid_ftm_initiator_mode_on_softap_v4.4' into 'release/v4.4'
Avoid ftm initiator mode on softap (Backport v4.4)
See merge request espressif/esp-idf!21757
OK, might be RF signal issue.
Just focused on black screen issue. Any idea?
$ sudo -E DISPLAY=:0 ./gs
(I) src/PI_HAL.cpp: 125: Initializing pigpio
(I) src/PI_HAL.cpp: 283: Drivers: 4
(I) src/PI_HAL.cpp: 286: Driver 0: x11
(I) src/PI_HAL.cpp: 286: Driver 1: wayland
(I) src/PI_HAL.cpp: 286: Driver 2: RPI
(I) src/PI_HAL.cpp: 286: Driver 3: dummy
(I) src/PI_HAL.cpp: 295: Mode 0: 1280x720
(I) src/Comms.cpp: 718: Radiocap header size: 11, IEEE header size: 24
(I) src/Comms.cpp: 581: Opening interface wlan1 in monitor mode
(I) src/Comms.cpp: 282: DLT_IEEE802_11_RADIO Encap
(I) src/Video_Decoder.cpp: 160: SDL window: 16305032
(I) src/Video_Decoder.cpp: 160: SDL window: 16305032
(I) src/Video_Decoder.cpp: 160: SDL window: 16305032
(I) src/Video_Decoder.cpp: 160: SDL window: 16305032
(I) src/main.cpp: 104: RX len: 1470, RSSI: -50, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 7350, RSSI: -50, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 0, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 2940, RSSI: -50, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 2940, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 2940, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 1470, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 5880, RSSI: -49, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 0, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 5880, RSSI: -50, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 7350, RSSI: -50, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 2940, RSSI: -49, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 1470, RSSI: 0, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 8820, RSSI: -50, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 1470, RSSI: -50, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 214620, RSSI: -46, Latency: 87/87/87
(I) src/Video_Decoder.cpp: 333: Texture: 2
(I) src/Video_Decoder.cpp: 333: Texture: 3
(I) src/Video_Decoder.cpp: 333: Texture: 4
(E) src/Video_Decoder.cpp: 349: GL error 1280 in glBindBuffer(GL_PIXEL_UNPACK_BUFFER, output.pbo)file src/Video_Decoder.cpp line 349
(E) src/Video_Decoder.cpp: 362: GL error 1280 in glBufferData(GL_PIXEL_UNPACK_BUFFER, pbo_size, nullptr, GL_STREAM_DRAW)file src/Video_Decod er.cpp line 362
(E) src/Video_Decoder.cpp: 386: GL error 1280 in glBindTexture(GL_TEXTURE_2D, output.textures[i])file src/Video_Decoder.cpp line 386
(E) src/Video_Decoder.cpp: 389: GL error 1281 in glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, width, height, 0, GL_RED, GL_UNSIGNED_BYTE, (void*)of fset)file src/Video_Decoder.cpp line 389
(E) src/Video_Decoder.cpp: 389: GL error 1281 in glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, width, height, 0, GL_RED, GL_UNSIGNED_BYTE, (void*)of fset)file src/Video_Decoder.cpp line 389
(E) src/Video_Decoder.cpp: 389: GL error 1281 in glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, width, height, 0, GL_RED, GL_UNSIGNED_BYTE, (void*)of fset)file src/Video_Decoder.cpp line 389
(E) src/Video_Decoder.cpp: 395: GL error 1280 in glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0)file src/Video_Decoder.cpp line 395
(I) src/main.cpp: 104: RX len: 637980, RSSI: -47, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 627690, RSSI: -46, Latency: 0/0/0
(I) src/main.cpp: 104: RX len: 186690, RSSI: -49, Latency: 15/15/15
(I) src/main.cpp: 104: RX len: 8820, RSSI: -50, Latency: 49/49/49
(I) src/main.cpp: 104: RX len: 4410, RSSI: -49, Latency: 2/124/63
(I) src/main.cpp: 104: RX len: 2940, RSSI: -50, Latency: 2/2/2
(I) src/main.cpp: 104: RX len: 4410, RSSI: 0, Latency: 148/183/166
(I) src/main.cpp: 104: RX len: 10290, RSSI: -50, Latency: 10/38/24
(I) src/main.cpp: 104: RX len: 1470, RSSI: -50, Latency: 170/170/170
(I) src/main.cpp: 104: RX len: 5880, RSSI: -50, Latency: 60/188/124
Does it have something to do with OpenGL ES version?
Tried my laptop(ubuntu) , still no video.
Why there is no latency first? runing for quite a long time, the latency shows.
I struggled with these codes all day and I have some new findings: When gl_flush() in PI_HAL.cpp is turned on, it can "work normally". Then I read the code of the official demo of imgui and our code line by line. Are there any bugs nearby? (Because I noticed there are some location differences with the official demo)
BTW:In order to facilitate debugging and modification, I changed it to window mode.The program can only transmit at very low resolution and frame rate.Anyone know why?I guess there is something about the maxrate of monitor mode of my card.Now with tcpdump,i can see esp32 sending,but all the rate is 1.0Mbps.(But according to our code , the rate is 54Mbps.)I also curious about how a 1.0Mbps card could recieve the 54Mbps packet?
The good news is that there is an image with glFlush(), although not 30 FPS at 800x600.
:)
Not bad.So....Do you have a try ? is there a wrong url you upload? I think you want to upload your screenshoot instead.hiahia
And I found that the card type is soooo important. Because i setup two different cards in two computers and tcpdump them .One is RTL8812AU (TP-LINK T4U).The other is EDUP EP-N8508GS. Suprisingly I found the EDUP EP-N8508GS captured well but T4U not.(Howerer T4U and RTL8812au cards are well known by OpenHD or ZE-BroardCast players.) EDUP EP-N8508GS only has low speed sniff and injection.Maybe thats why i can only achieved very very low frame rate. It's quite strage that RTL8812AU works bad.The card only capture soooo little packages from esp32 but receive others' traffic well.I can makesure i have switched to monitoe mode and chosen the right channel. Which card do you use ?Could you share some infos?
Not bad.So....Do you have a try ? is there a wrong url you upload? I think you want to upload your screenshoot instead.hiahia
Well, That's @jeanlemotan 's test video. I have the same video quality as you do.
And I found that the card type is soooo important. Because i setup two different cards in two computers and tcpdump them .One is RTL8812AU (TP-LINK T4U).
You need to install a special driver for these RTL chipsets. For example https://github.com/morrownr/8812au or https://github.com/aircrack-ng/rtl8812au The in-kernel driver barely works.
Actually,i do have installed a special driver.And i have some progress now .However it is not for this issue.I will open another issue if we wanna to share and interact.
We need to back to the gl_flush() code and the window fresh process. Why could this magic happen?(I am a beginner to opengl and imgui.)
You need to install a special driver for these RTL chipsets
@rottaran @jeanlemotan
How about following wifi card?It has monitor mode, but I'm NOT sure if it'll casue performance issue?
08:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 03)
Actually:
daniel@daniel-ThinkPad-SL410:~/Work/inav$ lspci |grep Realtek
08:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 03)
$ lsmod |grep rtl
rtl8xxxu 151552 0
rtl8192cu 110592 0
rtl_usb 20480 1 rtl8192cu
rtl8192c_common 81920 1 rtl8192cu
rtlwifi 114688 3 rtl8192c_common,rtl_usb,rtl8192cu
mac80211 1249280 5 iwldvm,rtl_usb,rtl8192cu,rtlwifi,rtl8xxxu
btrtl 24576 1 btusb
bluetooth 688128 27 btrtl,btintel,btbcm,bnep,btusb,rfcomm
cfg80211 970752 5 iwldvm,rtlwifi,iwlwifi,mac80211,rtl8xxxu
$ dmesg |tail
[19061.302086] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[19061.302091] usb 2-2: Product: 802.11n WLAN Adapter
[19061.302096] usb 2-2: Manufacturer: Realtek
[19061.302100] usb 2-2: SerialNumber: 00e04c000001
[19061.302788] rtl8192cu: Chip version 0x10
[19061.379285] rtl8192cu: Board Type 0
[19061.379534] rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1
[19061.379579] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
[19061.379626] ieee80211 phy2: Selected rate control algorithm 'rtl_rc'
[19061.600418] rtl8192cu 2-2:1.0 wlx14cf920bea04: renamed from wlan0
Hello ! I am having the same dirty video as you.... And the controls are unusable, can you guys move the sliders ?
And the controls are unusable, can you guys move the sliders ?
NO
move
No, I can't move the slides either.
New progress. Now i get about 10fps with low but affordable (for me) video. The key is channel ,data rate and card.
First,tcpdump do shows the real data rate. That means when it shows 1.0Mbps .The packet is 1.0Mbps modulation. To get affordable video, you must increase data rate.( I increased them to 24Mbps) Must double check them.
Second,the maximum data rate do has a relationship with card type and driver. Make an experiment for example, my EDUP card can only allow 1.0Mbps monitor. So when i send 24Mbps packet , The card still shows other packets in 1.0Mbps and capture nothing of my 24Mbps packet.
Third,data rate is NOT higher is better because it maybe over the card maximum monitor rate.I make another experiment to explain this. My t4u card could receive 54Mbps esp32 packets but it drops some packets.When it comes to 24Mbps ,it works well.And i learned from a paper that monitor speed is almost all quite low . Card above 20Mbps is a quite good card for monitor.( If anyone find some cards which have a super fast injection rate (above 30Mbit data per second ) pls tell me.)
The rate adjustment API in air_firmware may have bugs. I change IDF version , write something hardcoded and successfully adjust rate( can be really seen and dump in 24Mbps).
Things get better step by step. I will post some procedures after I entirely figure out the api .:)
I am going to work on those issues today, can you share some of your progress ? (especially where you changed the data rate in the air firmware).
I am going to work on those issues today, can you share some of your progress ? (especially where you changed the data rate in the air firmware).
I will make an detail experiment about the api in two hours, double check and post the result.
The experiment comes.I use IDF-4.4.3.
use internal API:
The result:
use esp_wifi_config_80211_tx_rate() API:
The result:
(Pay attention to the raw data , we could also see the JFIF header which means jpeg.haha~)
ATTENTION! Version matters!
I checked ESP32 API doc version by version and find that we could officially adjust the rate of 802.11 injection only when using IDF-4.4.2 or newer.
IDF-4.4.2 and above says:
https://docs.espressif.com/projects/esp-idf/en/v4.4.2/esp32/api-guides/wifi.html#wi-fi-80211-packet-send
IDF-4.4.1 and below says:
https://docs.espressif.com/projects/esp-idf/en/v4.4.1/esp32/api-guides/wifi.html#wi-fi-80211-packet-send
I also find something in ESP-FAQ about the internal api:
https://docs.espressif.com/projects/espressif-esp-faq/zh_CN/latest/software-framework/wifi.html
So, Maybe ESP-FAQ is a little bit of confusing."To set and fix the Wi-Fi sending rate" may only just about "wifi"(we normally heared from) but not 802.11 raw packet. No matter what the ESP-FAQ says,just following the API doc and using the official API to adjust 802.11 rate without a problem. I will make a PR and note we should use at least IDF-4.4.2 version.
at least IDF-4.4.2 version
Hummm.... @jeanlemotan 's video use esp-idf-v4.3-beta1. It seems IDF version depends.
Anyway, it has been made a great progress :)
at least IDF-4.4.2 version
Hummm.... @jeanlemotan 's video use esp-idf-v4.3-beta1. It seems IDF version depends.
Anyway, it has been made a great progress :)
Yes.In todays' v4.3.1 doc ,rate adjustment is officially not support. I also do the experiment in IDF-4.3.2 which is close enough to jeanlemotan's version. I have two esp32-cam . One flash internal API+ IDF-4.3.2 ,the other flash esp_wifi_config_80211_tx_rate() + IDF-4.4.3. The result is the internal api cannot adjust the rate in IDF-4.3.2. It even loss a lot of packets in tcpdump. And the chip get crazy hot (sucks more than 500mA) However,when using esp_wifi_config_80211_tx_rate() + IDF-4.4.3, only sucks about 250mA and packet works well. So ,as it is not working at all for me . Just forget about the internal api , move to higher idf ,follow the API doc and use the official API to adjust 802.11 rate without a problem.
Install a lot of IDF this week 😃
whstudio123, can you try esp_wifi_config_80211_tx_rate(ESP_WIFI_IF, true, WIFI_PHY_RATE_MCS0_LGI)
? This is index 14 in the rates
array. My suspicion is, that it does not, unless you set the channel bandwidth correctly:
ESP_ERROR_CHECK(esp_wifi_set_bandwidth(ESP_WIFI_IF, WIFI_BW_HT20));
ESP_ERROR_CHECK(esp_wifi_set_channel(11, WIFI_SECOND_CHAN_NONE));
My memory might be wrong. I thought that the bitrate was adjusted automatically. But I could not find the code in main.cpp.
All right,i will try it now. I write some ideas on your "esp32_bridge_broadcast" repo.Could you plz have a look?
Just change 10 to 14 and other code are stayed the same.
interesting. It seems to work without changes then. Still don't understand why it did not work in my own software. maybe there is a hidden firmware difference between ESP32 and ESP32-S3 too
Maybe.I am using ESP32.
move
No, I can't move the slides either.
New progress.Only one line change in PI_HAL.cpp could let us use mouse:
Finally I managed to get some free time and compile the GS & Air firmware and test. I used initially the IDF 5.0, but I got some compile errors in the camera component, and after reading the migration document I decided to go back to 4.X. I think it will take some serious work to port the camera component to 5.0 since they changed the low level drivers and ATM I don't see any advantage. So back to IDF 4.4.4 The air firmware worked but only sent a few seconds of data, after which it stopped sending. It till received fine, but no video was sent. Then I remember that I spend a significant amount of time to tweak the sdkconfig to free as much memory as possible and speed up the drivers by placing callbacks in IRAM etc, so after 2h of tweaking and testing, I got the air config to send continuously. The new sdkconfig is committed now.
As for the GS, I didn't get anything rendered except for the imgui window borders. I tested in X11 and there is clearly an issue with the rendering, but I'll have to debug tomorrow more.
It should be trivial to fix though.
Finally I managed to get some free time and compile the GS & Air firmware and test. I used initially the IDF 5.0, but I got some compile errors in the camera component, and after reading the migration document I decided to go back to 4.X. I think it will take some serious work to port the camera component to 5.0 since they changed the low level drivers and ATM I don't see any advantage. So back to IDF 4.4.4 The air firmware worked but only sent a few seconds of data, after which it stopped sending. It till received fine, but no video was sent. Then I remember that I spend a significant amount of time to tweak the sdkconfig to free as much memory as possible and speed up the drivers by placing callbacks in IRAM etc, so after 2h of tweaking and testing, I got the air config to send continuously. The new sdkconfig is committed now.
As for the GS, I didn't get anything rendered except for the imgui window borders. I tested in X11 and there is clearly an issue with the rendering, but I'll have to debug tomorrow more.
It should be trivial to fix though.
Yes.DO NOT DEL the sdkconfg !!!! There are serval settings especially about IRAM and wifi stacks.
Yes.DO NOT DEL the sdkconfg !!!! There are serval settings especially about IRAM and wifi stacks.
Actually, I didn't find anything special between sdkconfig(auto generated) and git version.
If this project is truely sensitvie to some default settings, please try "sdkconfig.defaults"
My bad, I messed up the initial commit. Fixed in https://github.com/jeanlemotan/esp32-cam-fpv/commit/29fd749868ab9e18ebad0e45dd18958e9bd71e91
latest code(9610792)+ ESP_IDF 4.3 beta 1 + AI Thinker Module (2MB PSRAM)==> build OK latest code(9610792)+ RPI 3B+ minor OPENGL 2.0 and on wlan1 for TxRx ==> build OK
no video on RPI Window, all black. It seems that ESP32 didn't send any data packet out. Any idea about this?
GS log
WLAN1 channel is 11, which is the same as esp32. And tcpdump, there is data monitored.