-
Notifications
You must be signed in to change notification settings - Fork 661
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
Several problems about Openwifi porting to AD936X on PYNQ-Z1 (2rx-2tx mode, 2.4G scan, TX channel, failed timing) #123
Comments
Great news! Here are some replies/comments: openwifi: device tree modified, ad9361 part same as antsdr except 2rx-2tx is disabled -- if this is enabled, RX/TX tuning will fail on high sample rate. -- According to https://github.com/analogdevicesinc/linux/blob/b6e379910a11af77e6500ed8b0895006e471a279/drivers/iio/adc/ad9361_conv.c#L466 , the auto tuning covers 25/40/61.44M. Do you know it fails at which rate? You can remove 61.44M on purpose, if it fails. -- About vivado 2019.1, indeed it needs some work to upgrade openwifi-hw for it. So far we only tried it internally based on the ADI's kuiper release for zcu102. Not sure how much work will be needed for normal zynq7000 FPGA. Self-designed AD9363 on xc7z020 @ PYNQ-Z1, LVDS interface. PlutoSDR firmware already ported without any problem. RX and TX auto-tuning OK at 61440000 sample clock. -- But you said "RX/TX tuning will fail on high sample rate."? Now what works: ~/openwifi/fosdem.sh successfully end, showing that AP enabled. -- Can you connect to this openwifi AP from your phone/pad/computer? 2rx-2tx mode: -- I remember that it is defined in the devicetree. We use this mode on purpose no matter it is ad9361/3/4, because we don't want to change the I/Q data interleaved mode on the link which needs different FPGA side interface/ad9361-ip setting (I might be wrong). So always using 2rx-2tx mode brings us the maximum compatibility on different RF chips (9361/3/4). 2.4G scan: -- Normally when you scan Linux will tune the RF to all channels/bands supported sequentially by calling ieee80211_ops/config --> openwifi_config --> ad9361_rf_set_channel. You can see this tuning procedure/log by running dmesg after you run "iwlist sdr0 scan". TX channel: though fosdem.sh run successfully(default 5G or #107), I cannot see the hotspot on my phone. In rf_init.sh I can see TX gain is set from -89dB to -dB on the TX2 port(in_voltage1_xxx). However, I only have TX1(in_voltage0_xxx). I modified this manually but still no luck. Seems output defaults to TX1 which is not my case. Can I modify this? I don't have a spectrum meter, how can I know if there's actually something sending out of TX port? -- You don't need to modify rf_init.sh, because the sdr.c will set the TX channel attenuation under the Linux instruction (such as rfkill, ifconfig sdr0 up/down, etc.). To debug, after you run fosdem-11ag.sh (use fosdem-11ag.sh instead of fosdem.sh to have the most robust/reliable config), then check "cat /proc/interrutps" (this app note: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/ap-client-two-sdr.md). You can also check driver tx and rx messages by https://github.com/open-sdr/openwifi/blob/master/doc/README.md#debug-methods (you can set register value to 7 instead of 3 in the example to see the beacon tx in the dmesg. You can also see the rx message when you scan by iwlist or monitor a busy wifi channel. Check this monitor and packet injection app note: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/inject_80211.md ) -- Please share your discoveries (like the interrupt number screenshot) and dmesg outputs, if you want us to analyze the issue. |
Thanks for your reply. I tried these debugging methods a little bit but still no luck. About 2rx-2tx mode and tuning: If I disable this mode(remove this line from device tree), RX and TX tuning are both OK. If I enable this, RX will fail when sample rate gets higher than ~40M, and TX will always fail even at 3M sample rate. This may be related to my PCB signal integrity. I'm curious if Openwifi can still run with this line of device tree disabled. Hotspot: Though shown AP enabled, I cannot find the Openwifi hotspot on any of my devices. 2.4G scan: Here is a dmesg log when scanning. For me it looks like many weak signals are scanned but not reported. TX channel: When I run fosdem-11ag.sh, I can see interrupt number growing in /proc/interrupt. And the dmesg after running the script is here. After this dmesg, I waited for a while and no more related dmesg were printed. Scripts are all unmodified. Others: I can change LO frequency in /sys/bus/iio/devices/iio:device1/, and right after the board got powered on, I change LO to 80MHz, and can get a modulated 80MHz sine wave with >50mV peak-peak voltage on TX port via SMA cable to my 100MHz oscilloscope(in normal measure mode because my scope doesn't support 50R impedance). After Openwifi hotspot enabled, I, again, manually change LO to 80MHz, but now there's absolutely no signal on TX port anymore. So, I guess, there's no signal transmitted on TX now. Though I don't know why. |
Considering this, I'll first try installing Vivado 2018.3 and try in fresh environment if there's any tuning fail any more. |
Vivado version is important for HDL design. Even you target plutoSDR's HDL design, you need to stick to the Vivado version they suggested. We have observed that the same HDL performs different (timing) in different Vivado versions. |
The 2018.3 Vivado results the same. I found in AD936X datasheet that in LVDS mode, "The maximum DATA_CLK rate is increased to 245.76 MHz"(UG570, page 108). And I do noticed a clock speed of 4x sample rate when performing tuning. This is certainly more than my board's TX path could handle. So this is why TX tuning failed, and there's not much hope on this version of my board(though making a next one will cost little because I have abundant components now). So can Openwifi work with, like, under 61.44 MHz data rate? Seems it can be inferred in UG570 that if we stick to 1R1T config and don't use 2x oversampling, clock rate will be under control(and my board can do this, since tuning OK in 1R1T at 61.44MHz). Especially, will everything work with |
I can try. But can you check firstly that we simply remove "adi,2rx-2tx-mode-enable;"? What does this mean, and shall we add a different config instead? Like 1rx-1tx sth? Can you run plutoSDR test successfully when commenting out the "adi,2rx-2tx-mode-enable;"? What is the result? For instance, you can try to loop back the signal over the air (or coaxial cable) and see some sine wave or spectrum sent by yourself at specific carrier frequency with specific bandwidth/sampling rate setting. |
I think just simply remove "adi,2rx-2tx-mode-enable;" is enough. On pluto, when no "adi,2rx-2tx-mode-enable;" is present(the default case), RX and TX tuning will all pass, and I can see signal spectrum received over antenna is similar to BIST digital "internal loopback". And I can see modulated sine wave on scope. When "adi,2rx-2tx-mode-enable;" is added and RX & TX tuning skipped, I cannot get any feedback even in BIST digital loopback. |
In the pluto mode (with 2tx 2rx removed), what is the highest baseband sampling rate you can achieve in the successful BIST test? |
Pluto 1RX 1TX (and also Openwifi 1RX 1TX) the self-tuning covers roughly 25M to 61.44M, and my board can pass at 61.44M. I don't think there's higher sampling rate tests. |
Your 61.44M is the baseband sampling rate? or the rate of DATA_CLK? According to the figure in page 110, in 1t1r mode if the DATA_CLK is 61.44M, then the sampling rate (one sample needs 12bit I and 12bit Q) will be 61.44/2M, which is lower than the openwifi baseband sampling rate 40M. Can you achieve DATA_CLK 80M, which means 40M baseband sampling mode in 1t1r mode. If yes, then we don't need to change the openwifi baseband sampling rate 40M, and only go for 1t1r mode. |
Though I'm not very sure about the detail of tuning process, I performed a tuning at 61440000 sample frequency(maximum possible), everything passed, and I captured this on my scope: DATA_CLK is showing 120MHz(low amplitude because it's near my scope's limit). Seems in the tuning they have already taken the 2x clock frequency into account. In this case, 80M can be achieved without problem. And do you mean openwifi code need extra modification? I'll try reading/modifying related parted if needed. |
After further debugging, I'm sorry to tell that the previous assumptions are a little bit wrong. In pluto BIST loopback tests, error will occur when TX amplitude reaches the MSB part. In the picture, the red line is -37 dB scale, and the green is -35 dB scale, the difference is easy to see. I counted that there are only 64 values aka 6 bits, so my assumption is the I/Q sequence got interpreted wrong and somehow MSB is always zero. I'm still looking into these. It's quite strange given that RX and TX tuning all passed. |
I tested the 1rx-1tx mode on antsdr (by commenting out the 2rx-2tx in the devicetree). It works fine. I can connect my phone to the openwifi AP on antsdr. I confirm the new devicetree is loaded on board Linux by:
You can see all the devicetree items there. During my test there isn't adi,2rx-2tx-mode-enable. Normally there is such a item, if the 2rx-2tx is not commented out. |
From your openwifi board, you can discover other wifi AP's name/ssid, right? Can you confirm further for the rx channel by using the monitor mode? https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/inject_80211.md Simply run onboard:
If you see lots of meaningful packet (some with bad fcs others not), that means your rx channel (from antenna to openwifi baseband demodulator till driver and linux) works fine. Then the problem could be with your tx channel, since you never discover the openwifi AP on other devices. I think the lvds data and clk rate are the same for rx and tx channel, so it is strange. Because if the rx channel works fine, that means your board/hardware has the capability to handle the lvds clk and data signal. Maybe you need to check the design and hardware about what is the difference between the rx and tx on your board. You can try to insert some FPGA ila to check how does the tx and rx channel I/Q sample and FPGA internal clk (the name is the adc clk inside FPGA) look like. We add ila like in this issue: open-sdr/openwifi-hw#39 |
Seems like a amplitude overflow, but overall seems OK. You are using 31M sampling rate in the figure, what about 40M? |
You are right, my TX_FRAME was inversed. I don't know why TX tuning doesn't spot this. Now the pluto loopback test looks good(sine wave I/Q in both BIST self-loopback or antenna over the air). However I still can't see the Openwifi hotspot. I did this debugging: To see signals on my scope, after running fosdem-11ag.sh I manually changed LO frequency to 80 MHz (from 5 GHz), and get this signal. If I zoom in enough I can see the 80 MHz carrier frequency. I've never seen this before the TX_FRAME fix, so at least there's some improvement. The problem is the amplitude is so small(5mV per grid). There's an parameter called "out_voltage0_hardwaregain" in /sys/bus/iio/devices and "Attenuation(dB)" on iio oscilloscope, default value is -10dB, and when Openwifi is enabled, this is set to 0dB. On my board, -10dB results in good transmit power while 0dB transmits nearly nothing. I want to set this to -10dB, but if I As a comparison, I also set LO frequency to 80 MHz right after board power on(when the out_voltage0_hardwaregain is still -10dB), and I can get this. It's 200mV per grid! So can I keep the out_voltage0_hardwaregain negative without getting WLAN hard blocked? |
The first figure waveform looks like WiFi packet very much! To control the ad9361 tx attenuation, you can change
in sdr.h. Then recompile the driver and copy the driver onboard (https://github.com/open-sdr/openwifi#update-driver). We will have a release soon to let user change it via sdrctl command on board without recompiling the driver. For 3dB attenuation, you need value 3000 Since the chip has better performance in 2.4GHz, I suggest you test in 2.4GHz by changing on board hostapd-openwifi-11ag.conf
Then run fosdem-11ag.sh again. Hope this will help other device discover openwifi SSID. |
After the changes the signal strength increase ~10 times. But still, SSID can't be found. Now, there's still one thing uncommon: though I can monitor all channels covering 2.4G and 5G, when doing iwlist scan, only 5G spot is shown. I don't know why. Maybe debugging this is a starting point? Other debugging methods plausible that I'll try if have time: 1. solder another extension board and compare if there's any chip or hardware difference. 2. try porting iio-oscilloscope(server on board?) to Openwifi Linux firmware, so I can possibly monitor transmission quality at 2.4G directly. |
Hi,
You can check the captured I/Q by Matlab WLAN toolbox, or share the file here for us to check. |
I tried these but still no luck.
I got this on scope (setting LO to 80M).
|
In the scope picture, how long is each grid? 20us? If so, seems like your tx sampling rate is half of requirement. We need 40M, but yours seems like 20M. Because according to https://github.com/FCAE/WLAN/blob/master/doc/802.11-2012.pdf (18.3.3) , at the beginning STF is 8us then followed by 8us LTF. Yours seems like 16us (if 20us/square on the screen) Can you share me the raw iq file captured by you? Please capture the tx_intf iq by “./side_ch_ctl wh5d4” before your capture. |
Yes, the problem was with sample rate: after tweaking some HDL parameters now things worked -- the STF becomes 8us and I can connect to Openwifi AP, as well as use the board to connect to my home's wifi, ping each other, and see the welcome webserver in both case. Thanks a million for your kind and timely guide and this Openwifi project! Here's my board setup if you're curious :-) There still remain some problem, but I guess it's probably my RF frontend design. It's actually just the thing from very beginning -- I cannot scan 2.4G wifi spots. Only 5G spot is shown. If I set
And this on board:
And I can't let the board connect to other 2.4G spots as well. All my successful testing are in 5G band -- in the picture shown, the laptop get 2 slots of signal(4 slots if openwifi in 2.4G, but I can't connect). Weak but I'm still able to watch the test video with no lag. This is interesting because my balun on board officially supports only up to 3G. Maybe in 2.4G transfer/receive RF signal quality get degraded? Can't conclude now. Later, I'll convert my Altium Designer files based on this to KiCad and open-source them. About my ported code, it's a little bit messy and may not help much, so I haven't thought about how to share them yet. And if have further time I'll blog about my whole porting and debugging process, guess blogs will help more. Anyway, thanks again! |
And of course, I'm glad to do more testings/give more captured data if needed! |
Hi, This is really a great news! I foresee many many SDR hobbyists/enthusiasts can enjoy your super low cost SDR solution for PYNQ board! The 2.4GHz issue is known issue. It could be related to our CSMA/CA engine design, since the 2.4GHz uses a slightly different low MAC parameters. So far, in deed we mainly work in 5GHz. So,
For your 3GHz balun, I think it can't stop signal at 5GHz entirely. Maybe it only has several dB insertion loss at 5GHz (check your datasheet), so working in 5GHz is allowed (with slightly degraded performance). |
Could you send email to [email protected] to introduce your self?
I'm the author of Possibility about AD936X module for PYNQ-Z1-like low-cost boards #99 and my extension board is finally working. Now I'm trying to port Openwifi firmware. You already know my Telegram @regymm0 :-)
Our image is used directly or you build your own image?
My own.
What is your own modification?
Linux kernel/rootfs: no except minor(like debug serial to UART0 instead of UART1)
openwifi-hw: modified according to my own based on antsdr, TX interface is singled ended on FPGA side and converted to LVDS using driver chip, so adi-hdi axi_ad9361 OBUF is slightly modified.
timing failed.openwifi: device tree modified, ad9361 part same as antsdr except 2rx-2tx is disabled -- if this is enabled, RX/TX tuning will fail on high sample rate.
Versions: OS, Vivado, openwifi/openwifi-hw repo branch and commit revision
ArchLinux, Vivado 2019.1, openwifi/openwifi-hw master, adi-hdl is using plutosdr-fw master branch because openwifi-hw compilation crash on Vivado 2019.1. Other using default.
Board/hardware type
Self-designed AD9363 on xc7z020 @ PYNQ-Z1, LVDS interface. PlutoSDR firmware already ported without any problem. RX and TX auto-tuning OK at 61440000 sample clock.
Now what works:
~/openwifi/fosdem.sh
successfully end, showing that AP enabled. Then I runwdg.sh
andiw dev sdr0 scan
, the 5G wifi spot in my home is shown(this is the only 5G spot nearby). Though my balun is only 0-3G(hard to get a better now).Problems:
2rx-2tx mode: since if I enable this tuning will fail, I have to disable this. And there're some no-such-file error because of this, but I guess Openwifi don't need 2 RX and 2 TX anyway? Is there any other options to modify in this case?
2.4G scan: I don't know how to scan 2.4G wifi signals. No matter what I do (like following #114), only the 5G one is shown in iw scan though there're more stronger 2.4G signals nearby. I see in
rf_init.sh
there are 5G frequencies being set as LO frequency, is this related?TX channel: though
fosdem.sh
run successfully(default 5G or #107), I cannot see the hotspot on my phone. Inrf_init.sh
I can see TX gain is set from -89dB to -dB on the TX2 port(in_voltage1_xxx). However, I only have TX1(in_voltage0_xxx). I modified this manually but still no luck. Seems output defaults to TX1 which is not my case. Can I modify this? I don't have a spectrum meter, how can I know if there's actually something sending out of TX port?failed timing: I'm using antsdr's Vivado project with no modification other than the ZYNQ PS itself and output OBUFs. Yet timing failed, WNS -0.692ns TNS -97.949ns.Update: timing passed after tweaking compile strategies, other problems remain.And I'm getting
handle_probe_req: send failed
when trying to connect to my 5G spot usingwpa_supplicant -i sdr0 -c wpa-connect.conf
, which, of course failed because my TX certainly have some problem now.Here's my log when running
fosdem.sh
: https://gist.github.com/regymm/7fcdfade09dcef3710881462bd9b5e1fAny help is appreciated!
The text was updated successfully, but these errors were encountered: