之前四个实践我们生成了所需要的文件并做好了SD卡,这里我们开始实际运行openwifi.
为了能更看得更明白,这里我用不带外壳的板子拍照做实例,如下。
(1),此处跳线选择ZYNQ的启动模式,如图PIN1 和PIN2 相连是SD启动模式。如果PIN2 和PIN3相连是 FLASH启动模式,如果PIN3和PIN4相连是JTAG启动模式(即在线调试模式)。
(2),插入TF卡。
(3),TYPEC接口提供板子运行的电源并实现USB转串口。
(4),是为了方便实现不断掉电源就可以实现从新启动。通电即启动,如果错误LOG信息可以点此复位键从新启动。
(5),默认openwifi的射频是这样两个。
其中图中(3)有三点说明。
A,(3)处TYPEC的供电电流比较大,因此选择USB连接线要注意短,建议不超半米,并且能过大电流,可以使用我们附件所带的连接线。如果运行不正常可以考虑电源不足,尝试换好一些的线来尝试解决。
B,(3)处也是USB转双串口,用到的转换芯片是CP2105,需要安装驱动,给出链接如下:
CP2105驱动链接:https://pan.baidu.com/s/1V825zpu2VjbaPR7uGEAKTA
提取码:46hh
驱动装好,接通USB后在电脑设备管理器会看到多了两个串口,如下:
不同SDPRI的串口号不一样,实际的串口号你要自己在设备管理器里面确定一下。
之后就可以尝试用PUTTY串口终端软件按照115200的速率设置打开这个两个串口。PUTTY的下载链接如下:
putty软件链接:
链接:https://pan.baidu.com/s/1EXVLZVrvzz6hDA07_e1QXg
提取码:qp0x
PUTTY的设置如下:
图中(1)选择串口模式,(2)输入串口号,(3)输入波特率为115200.
C,因为有两个串口,在SDRPI原理图里分别PS和PL,我们需要在PUTTY里面将两个串口都打开,确定哪个串口号是PS口的,以后就可以只打开这个串口号就好。
=========================================================================
一切就绪,开始上电看串口输出如下,全部的log信息我都贴出来:
U-Boot 2018.01-21439-gd244ce5869-dirty (Aug 24 2021 - 10:17:11 +0800)
Model: Zynq SDRPi
Board: Xilinx Zynq
Silicon: v3.1
DRAM: ECC disabled 1 GiB
MMC: sdhci@e0100000: 0 (SD)
SF: Detected w25q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
*** Warning - bad CRC, using default environment
In: serial@e0001000
Out: serial@e0001000
Err: serial@e0001000
Net: ZYNQ GEM: e000b000, phyaddr 0, interface rgmii-id
eth0: ethernet@e000b000
reading uEnv.txt
392 bytes read in 10 ms (38.1 KiB/s)
Importing environment from SD ...
Hit any key to stop autoboot: 0
Device: sdhci@e0100000
Manufacturer ID: ad
OEM: 4c53
Name: LX32G
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 28.9 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
reading uEnv.txt
392 bytes read in 10 ms (38.1 KiB/s)
Loaded environment from uEnv.txt
Importing environment from SD ...
Running uenvcmd ...
Copying Linux from SD to RAM...
reading uImage
4551104 bytes read in 270 ms (16.1 MiB/s)
reading devicetree.dtb
18811 bytes read in 22 ms (835 KiB/s)
** Unable to read file uramdisk.image.gz **
## Booting kernel from Legacy Image at 03000000 ...
Image Name: Linux-4.14.0-gb6e379910a11-dirty
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4551040 Bytes = 4.3 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
## Flattened Device Tree blob at 02a00000
Booting using the fdt blob at 0x2a00000
Loading Kernel Image ... OK
Loading Device Tree to 1fff8000, end 1ffff97a ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 4.14.0-gb6e379910a11-dirty (openwifi@Z) (gcc version 7.3.1 2018031 4 (Linaro GCC 7.3-2018.04-rc3)) #1 SMP PREEMPT Wed Sep 21 12:56:26 CST 2022
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: HexSDR sdrpi (7z020+ad9361 SDR smart platform with GPSTC XO and RF AP)
OF: fdt: earlycon: stdout-path /amba@0/uart@E0001000 not found
Memory policy: Data cache writealloc
cma: Reserved 128 MiB at 0x38000000
random: fast init done
percpu: Embedded 16 pages/cpu @ef7ca000 s33036 r8192 d24308 u65536
Built 1 zonelists, mobility grouping on. Total pages: 260608
Kernel command line: console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlycon rootf stype=ext4 rootwait cpuidle.off=1
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 895996K/1048576K available (7168K kernel code, 341K rwdata, 2376K rodata , 1024K init, 160K bss, 21508K reserved, 131072K cma-reserved, 131072K highmem)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.text : 0xc0008000 - 0xc0800000 (8160 kB)
.init : 0xc0b00000 - 0xc0c00000 (1024 kB)
.data : 0xc0c00000 - 0xc0c55620 ( 342 kB)
.bss : 0xc0c5af6c - 0xc0c832c4 ( 161 kB)
Preemptible hierarchical RCU implementation.
RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
Tasks RCU enabled.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
efuse mapped to f0802000
slcr mapped to f0804000
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
L2C-310 erratum 769419 enabled
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 ID prefetch enabled, offset 1 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 512 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
zynq_clock_init: clkc starts at f0804100
Zynq clock init
sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025 , max_idle_ns: 440795209040 ns
Switching to timer-based delay loop, resolution 3ns
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 5375 38477 ns
timer #0 at f080c000, irq=17
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 666.6 6 BogoMIPS (lpj=3333333)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x100000 - 0x100060
Hierarchical SRCU implementation.
smp: Bringing up secondary CPUs ...
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
smp: Brought up 1 node, 2 CPUs
SMP: Total of 2 processors activated (1333.33 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911 2604462750000 ns
futex hash table entries: 512 (order: 3, 32768 bytes)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xf0880000
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 25, base_baud = 6249999) is a xuartps
console [ttyPS0] enabled
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
media: Linux media interface: v0.10
Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti
PTP clock support registered
FPGA manager framework
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource arm_global_timer
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
hw perfevents: no interrupt-affinity property for /pmu@f8891000, guessing.
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
workingset: timestamp_bits=30 max_order=18 bucket_order=0
bounce: pool size: 64 pages
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
io scheduler mq-deadline registered
io scheduler kyber registered
dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
dma-pl330 f8003000.dmac: DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Even ts-16
brd: module loaded
loop: module loaded
m25p80 spi1.0: found w25q256, expected n25q256a
m25p80 spi1.0: failed to read ear reg
m25p80 spi1.0: w25q256 (32768 Kbytes)
6 ofpart partitions found on MTD device spi1.0
Creating 6 MTD partitions on "spi1.0":
0x000000000000-0x0000000e0000 : "qspi-fsbl-uboot"
0x0000000e0000-0x000000100000 : "qspi-uboot-env"
0x000000100000-0x000000600000 : "qspi-linux"
0x000000600000-0x000000620000 : "qspi-device-tree"
0x000000620000-0x000001300000 : "qspi-rootfs"
0x000001300000-0x000002000000 : "qspi-bitstream"
MACsec IEEE 802.1AE
libphy: Fixed MDIO Bus: probed
tun: Universal TUN/TAP device driver, 1.6
libphy: MACB_mii_bus: probed
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 28 (00 :0a:35:00:01:22)
Marvell 88E1510 e000b000.ethernet-ffffffff:00: attached PHY driver [Marvell 88E1 510] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:00, irq=POLL)
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver ftdi_sio
usbserial: USB Serial support registered for FTDI USB Serial Device
chipidea-usb2 e0002000.usb: e0002000.usb supply vbus not found, using dummy regu lator
ULPI transceiver vendor/product ID 0x0451/0x1507
Found TI TUSB1210 ULPI transceiver.
ULPI integrity check: passed.
ci_hdrc ci_hdrc.0: EHCI Host Controller
ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
i2c /dev entries driver
at24 0-0050: 4096 byte 24c32 EEPROM, writable, 1 bytes/write
IR NEC protocol handler initialized
IR RC5(x/sz) protocol handler initialized
IR RC6 protocol handler initialized
IR JVC protocol handler initialized
IR Sony protocol handler initialized
IR SANYO protocol handler initialized
IR Sharp protocol handler initialized
IR MCE Keyboard/mouse protocol handler initialized
IR XMP protocol handler initialized
usbcore: registered new interface driver uvcvideo
USB Video Class driver (1.1.1)
gspca_main: v2.14.0 registered
cdns-wdt f8005000.watchdog: Xilinx Watchdog Timer at f0951000 with timeout 10s
Xilinx Zynq CpuIdle Driver started
failed to register cpuidle driver
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: SDHCI controller on e0100000.mmc [e0100000.mmc] using ADMA
ledtrig-cpu: registered to indicate activity on CPUs
hidraw: raw HID events driver (C) Jiri Kosina
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
ad7291: probe of 0-0020 failed with error -5
ad7291: probe of 0-002c failed with error -5
fpga_manager fpga0: Xilinx Zynq FPGA Manager registered
Netfilter messages via NETLINK v0.30.
nfnl_acct: registering with nfnetlink.
nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
ctnetlink v0.93: registering with nfnetlink.
nf_tables: (c) 2007-2009 Patrick McHardy
nf_tables_compat: (c) 2012 Pablo Neira Ayuso
xt_time: kernel timezone is -0000
ip_tables: (C) 2000-2006 Netfilter Core Team
ipt_CLUSTERIP: ClusterIP Version 0.8 loaded successfully
arp_tables: arp_tables: (C) 2002 David S. Miller
NET: Registered protocol family 17
Registering SWP/SWPB emulation handler
hctosys: unable to open rtc device (rtc0)
mmc0: new high speed SDHC card at address b368
mmcblk0: mmc0:b368 LX32G 28.9 GiB
ALSA device list:
No soundcards found.
mmcblk0: p1 p2 p3
EXT4-fs (mmcblk0p2): recovery complete
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:2.
devtmpfs: mounted
Freeing unused kernel memory: 1024K
Mount failed for selinuxfs on /sys/fs/selinux: No such file or directory
init: hwclock main process (919) terminated with status 1
* Setting up X socket directories... [ OK ]
* STARTDISTCC is set to false in /etc/default/distcc
* /usr/bin/distccd not starting
* Starting httpd daemon webfsd [ OK ]
* Starting IIO Daemon iiod [ OK ]
Last login: Thu Jan 1 00:00:08 UTC 1970 on tty1
Welcome to Linaro 14.04 (GNU/Linux 4.14.0-gb6e379910a11-dirty armv7l)
* Documentation: https://wiki.analog.com/ https://ez.analog.com/
root@analog:~#
我们在之前教程里面生成了KO文件,这里要执行下面命令脚KO目录里面的文件拷贝到openwifi的目录,在串口终端输入命令如下:
mount /dev/mmcblk0p1 /mnt
cp /mnt/ko/* ~/openwifi/
就是加载sd卡的BOOT分区,从KO文件夹里面拷贝所有.KO文件到当前用户的openwifi目录下面。
如果使用openwifi官方的内核则忽略上述黑体部分文字。
之后我们进入openwifi目录,执行./wgd.sh脚本如下,
root@analog:~# cd ~/openwifi
root@analog:~/openwifi# ./wgd.sh
usage:
Script for load (or download+load) different driver and FPGA img without rebooting
no argument: Load .ko driver files and FPGA img (if system_top.bit.bin exist) in current dir with test_mode=0.
1st argument: If it is a NUMBER, it will be assigned to test_mode. Then load everything from current dir.
1st argument: If it is a string called "remote", it will download driver/FPGA and load everything.
- 2nd argument (if exist) is the target directory name for downloading and reloading
- 3rd argument (if exist) is the value for test_mode
1st argument: neither NUMBER nor "remote" nor a .tar.gz file, it is regarded as a directory and load everything from it.
- 2nd argument (if exist) is the value for test_mode
1st argument: a .tar.gz file, it will be unpacked then load from that unpacked directory
- 2nd argument (if exist) is the value for test_mode
TARGET_DIR ./
DOWNLOAD_FLAG 0
test_mode 0
tx_offset_tuning_enable 0
$TARGET_DIR is found!
network-manager stop/waiting
rmmod: ERROR: Module sdr is not currently loaded
rmmod: ERROR: Module ad9361_drv is not currently loaded
+ insmod .//ad9361_drv.ko
ad9361_drv is loaded!
.//system_top.bit.bin not found. Skip reloading FPGA.
xlnx,zynq-7000
fjdo349ujtrueugjhj
fjdo349ujtrueugjhj
+ ifconfig sdr0 down
sdr0: ERROR while getting interface flags: No such device
+ rmmod sdr
rmmod: ERROR: Module sdr is not currently loaded
+ rmmod openofdm_rx
rmmod: ERROR: Module openofdm_rx is not currently loaded
+ rmmod openofdm_tx
rmmod: ERROR: Module openofdm_tx is not currently loaded
+ rmmod rx_intf
rmmod: ERROR: Module rx_intf is not currently loaded
+ rmmod tx_intf
rmmod: ERROR: Module tx_intf is not currently loaded
+ rmmod xpu
rmmod: ERROR: Module xpu is not currently loaded
+ sleep 1
+ '[' -f fjdo349ujtrueugjhj ']'
+ '[' xlnx,zynq-7000 '!=' xlnx,zynq-7000 ']'
+ SPI_DEVNAME=spi0.0
+ DDS_DEVNAME=79024000.cf-ad9361-dds-core-lpc
+ ADC_DEVNAME=79020000.cf-ad9361-lpc
+ '[' '!' -d /sys/bus/spi/drivers/ad9361/spi0.0 ']'
+ cd /sys/bus/spi/drivers/ad9361/
+ echo spi0.0
+ echo spi0.0
+ '[' '!' -d /sys/bus/platform/drivers/cf_axi_adc/79020000.cf-ad9361-lpc ']'
+ cd /sys/bus/platform/drivers/cf_axi_adc/
+ echo 79020000.cf-ad9361-lpc
+ echo 79020000.cf-ad9361-lpc
+ set +x
tx_offset_tuning_enable 0
openwifi_ad9361_fir_tx_0MHz_11n.ftr tx_fir_enable 1
Found openwifi_ad9361_fir_tx_0MHz_11n.ftr
+ test -f /sys/bus/iio/devices/iio:device0/in_voltage_rf_bandwidth
+ test -f /sys/bus/iio/devices/iio:device1/in_voltage_rf_bandwidth
+ cd /sys/bus/iio/devices/iio:device1/
+ set +x
FIR Rx: 48,1 Tx: 48,1
1
1
rx0 agc fast_attack
slow_attack
fast_attack
rx1 agc fast_attack
slow_attack
fast_attack
40000000
25215513
40000000
25215414
rssi
92.75 dB
111.75 dB
rx0 gain to 70
68.000000 dB
sh: echo: I/O error
68.000000 dB
rx1 gain to 70
61.000000 dB
sh: echo: I/O error
61.000000 dB
tx0 gain -89dB
-10.000000 dB
-89.000000 dB
tx1 gain 0dB
-10.000000 dB
0.000000 dB
rmmod: ERROR: Module xilinx_dma is not currently loaded
+ insmod .//xilinx_dma.ko
xilinx_dma is loaded!
depmod: WARNING: could not open /lib/modules/4.14.0-gb6e379910a11-dirty/modules.order: No such file or directory
depmod: WARNING: could not open /lib/modules/4.14.0-gb6e379910a11-dirty/modules.builtin: No such file or directory
Module Size Used by
mac80211 471040 0
cfg80211 253952 1 mac80211
xilinx_dma 28672 0
ad9361_drv 114688 2
ipv6 352256 26
mwipcore 16384 0
mwipcore_iio_streaming 16384 1 mwipcore
mwipcore_dma_streaming 20480 1 mwipcore
mathworks_ip_common 16384 1 mwipcore
rmmod: ERROR: Module tx_intf is not currently loaded
+ insmod .//tx_intf.ko
tx_intf is loaded!
rmmod: ERROR: Module rx_intf is not currently loaded
+ insmod .//rx_intf.ko
rx_intf is loaded!
rmmod: ERROR: Module openofdm_tx is not currently loaded
+ insmod .//openofdm_tx.ko
openofdm_tx is loaded!
rmmod: ERROR: Module openofdm_rx is not currently loaded
+ insmod .//openofdm_rx.ko
openofdm_rx is loaded!
rmmod: ERROR: Module xpu is not currently loaded
+ insmod .//xpu.ko
xpu is loaded!
rmmod: ERROR: Module sdr is not currently loaded
+ insmod .//sdr.ko test_mode=0
sdr is loaded!
+ test -f /sys/kernel/debug/iio/iio:device0/direct_reg_access
+ test -f /sys/kernel/debug/iio/iio:device1/direct_reg_access
+ device_path=/sys/kernel/debug/iio/iio:device1/
+ set +x
the end
root@analog:~/openwifi#
之后执行运行另外一个脚本 ./fosdem.sh
root@analog:~/openwifi# ./fosdem.sh
hostapd: no process found
stop: Unknown instance:
stop: Unknown instance:
isc-dhcp-server start/running, process 2298
Configuration file: hostapd-openwifi.conf
sdr0: interface state UNINITIALIZED->COUNTRY_UPDATE
Using interface sdr0 with hwaddr 66:55:44:33:22:d8 and ssid "openwifi"
sdr0: interface state COUNTRY_UPDATE->ENABLED
sdr0: AP-ENABLED
root@analog:~/openwifi#
这时候openwifi的热点已经成功成功运行了。
这里手机靠天线很近,所以信号很好。
现在我们可以在手机浏览器里面输入192.168.13.1这个咱们OPENWIFI热点的IP,从而打开内置的网页。
点击播放网页的视频,听着动感的音乐,满满的成就感。
但是此时还不能上网,我们需要将SDRPI设置成桥接模式,并且在PS端的以太网接入网线,才能将SDRPi升级成一个路由器,这个实践我们下篇继续做。