• 【RV1103】如何新增一个新板级配置


    追加

    整理好的SDK,下载下来,改一下WiFi名和密码再编译就能用:
    https://gitee.com/liefyuan2/luckfox-pico/tree/main-wifi/

    • 克隆源码:git clone -b main-wifi https://gitee.com/liefyuan2/luckfox-pico.git
    • 系统账号:root
    • 系统密码:luckfox
    • 为了支持这个必须做的修改:
      硬件基于luckfox pico,并在上面焊接了一颗spi nand flash[型号:winbond 25N01GVZEIG]
      飞线连接:
    luckfox pico 序号芯片引脚WiFi引脚
    6GPIO1_C5_dSDIO_D2
    7GPIO1_C4_dSDIO_D3
    12GPIO1_C0_dSDIO_D1
    14GPIO1_C1_dSDIO_D0
    15GPIO1_C2_dSDIO_CLK
    16GPIO1_C3_dSDIO_CMD
    GNDGND
    VCC (3.3V)VCC
    • 在硬件连接OK的情况下,上电自动连接WiFi。

    • ssid和passwd在SDK中的修改位置:sdk/project/app/wifi_app/wpa_supplicant.conf

    ctrl_interface=/var/run/wpa_supplicant
    ap_scan=1
    update_config=1
    
    network={
    	ssid="your-ssid"
    	psk="your ssid password"
    	key_mgmt=WPA-PSK
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 配置文件选择:./build.sh lunch 选择 2即2. BoardConfig_IPC/BoardConfig-SPI_NAND-NONE-RV1103_Luckfox_Pico_Liefyuan-IPC.mk

    在这篇【RV1103】RTL8723bs (SD卡形状模块)驱动开发博文中完成了WiFi模块在SD卡槽的使用,GPIO里面有一个MMC1接口配置成SDIO模式用飞线连接WiFi模块(RTL8723BS),自带的SD卡槽就继续插SD卡。

    SDK解压出来 2.9GB,全部编译完成 5.5GB,花费7分钟左右。

    修改后的SDK:
    链接:https://pan.baidu.com/s/1l8gCEbFynZoO3K8VNhCkCA?pwd=lief
    提取码:lief
    –来自百度网盘超级会员V5的分享

    在这里插入图片描述

    新建一个板级配置文件

    我的目标
    通过./build.sh lunch 来选择我的板子配置。

    在目录sdk/project/cfg目录下新建一个xxxx.mk文件,文件名字格式如下:

    BoardConfig-"启动介质"-"电源方案"-"硬件版本"-"应用场景".mk
    
    • 1
    ----------------------------------------------------------------
    0. BoardConfig_IPC/BoardConfig-EMMC-NONE-RV1103_Luckfox_Pico-IPC.mk
                                 boot medium(启动介质): EMMC
                              power solution(电源方案): NONE
                            hardware version(硬件版本): RV1103_Luckfox_Pico
                                  applicaton(应用场景): IPC
    ----------------------------------------------------------------
    
    ----------------------------------------------------------------
    1. BoardConfig_IPC/BoardConfig-SPI_NAND-NONE-RV1103_Luckfox_Pico_Plus-IPC.mk
                                 boot medium(启动介质): SPI_NAND
                              power solution(电源方案): NONE
                            hardware version(硬件版本): RV1103_Luckfox_Pico_Plus
                                  applicaton(应用场景): IPC
    ----------------------------------------------------------------
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • BoardConfig-EMMC-NONE-RV1103_Luckfox_Pico-IPC.mk
    • BoardConfig-SPI_NAND-NONE-RV1103_Luckfox_Pico_Plus-IPC.mk

    - 作为大区分
    _作为字符串内部的区分

    而我的目标是,在板子RV1103_Luckfox_Pico的基础上加入了,sd卡、sdio-wifi卡和spi-nand Flash,故我取了一个名字

    • BoardConfig-SPI_NAND-NONE-RV1103_Luckfox_Pico_Pro-SD_WIFI_IPC.mk

    脚本解析出来是:

    ----------------------------------------------------------------
    2. BoardConfig_IPC/BoardConfig-SPI_NAND-NONE-RV1103_Luckfox_Pico_Pro-SD_WIFI_IPC.mk
                                 boot medium(启动介质): SPI_NAND
                              power solution(电源方案): NONE
                            hardware version(硬件版本): RV1103_Luckfox_Pico_Pro
                                  applicaton(应用场景): SD_WIFI_IPC
    ----------------------------------------------------------------
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    它的主要内容

    #!/bin/bash
    
    # Target arch
    export RK_ARCH=arm
    
    # Target CHIP
    export RK_CHIP=rv1106
    
    # Target Toolchain Cross Compile
    export RK_TOOLCHAIN_CROSS=arm-rockchip830-linux-uclibcgnueabihf
    
    # Target boot medium: emmc/spi_nor/spi_nand
    export RK_BOOT_MEDIUM=spi_nand
    
    # Uboot defconfig
    export RK_UBOOT_DEFCONFIG=rv1106_defconfig
    
    # Uboot defconfig fragment
    export RK_UBOOT_DEFCONFIG_FRAGMENT=rk-sfc.config
    
    # Kernel defconfig
    export RK_KERNEL_DEFCONFIG=luckfox_sd_wifi_rv1106_linux_defconfig
    
    # Kernel dts
    export RK_KERNEL_DTS=rv1103g-luckfox-pico-pro.dts
    ...
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    plus板设备树的继承关系:

    rv1103.dtsi
    rv1103g-luckfox-pico-plus.dts
    rv1106-evb.dtsi
    rv1103-luckfox-pico-plus-ipc.dtsi
    rv1106.dtsi
    rv1106-amp.dtsi
    rv1106-amp.dtsi
    dt-bindings/input/input.h
    rv1106-pinctrl.dtsi

    我的板设备树的继承关系:

    rv1103.dtsi
    rv1103g-luckfox-pico-pro.dts
    rv1106-evb.dtsi
    rv1103-luckfox-pico-pro-ipc.dtsi
    rv1106.dtsi
    rv1106-amp.dtsi
    rv1106-amp.dtsi
    dt-bindings/input/input.h
    rv1106-pinctrl.dtsi

    rv1103g-luckfox-pico-pro.dts相对于rv1103g-luckfox-pico-plus.dts的主要修改:

    /dts-v1/;
    
    #include "rv1103.dtsi"
    #include "rv1106-evb.dtsi"
    #include "rv1103-luckfox-pico-pro-ipc.dtsi"
    
    / {
    	model = "Luckfox Pico Pro";
    	compatible = "rockchip,rv1103g-38x38-ipc-v10", "rockchip,rv1103";
    };
    /**********GPIO**********/
    &pinctrl {
    
    };
    
    &sfc {
    	status = "okay";
    
    	flash@0 {
    		compatible = "spi-nand";
    		reg = <0>;
    		spi-max-frequency = <75000000>;
    		spi-rx-bus-width = <4>;
    		spi-tx-bus-width = <1>;
    	};
    };
    
    /**********mmc interface for sd card map to sdmmc0 set for sd mode**********/
    &sdmmc {
    	max-frequency = <50000000>; // 设置 SD卡的运行频率
    	no-sdio;           // 无 SDIO
    	no-mmc;            // 无 eMMC
    	bus-width = <4>;   // 此配置标识需要使用 SD 卡的线宽。SD 卡最大支持 4 线模式
    	cap-mmc-highspeed; // 此配置为标识此卡槽支持 highspeed的SD卡。如果不配置表示不支持 highspeed 的 SD 卡。
    	cap-sd-highspeed;  // 此配置为标识此卡槽支持 highspeed的SD卡。如果不配置表示不支持 highspeed 的 SD 卡。
    	supports-sd;       // 标识此插槽为 SD 功能,为必须添加项。否则无法初始化 SD卡 外设。
    	disable-wp;        // 关闭写保护
    	pinctrl-names = "default";
    	pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_det &sdmmc0_bus4>; // rv1106-pinctrl.dtsi
    	status = "okay";
    };
    
    /***********mmc interface for wifi map to sdmmc1 set for sdio mode**********/
    &sdio {
    	max-frequency = <50000000>; // 最大运行频率不超过 150Mhz; SDIO2.0 卡最大 50M,SDIO3.0 最大支持 150M
    	bus-width = <4>;             // 4线数据模式
    	cap-sd-highspeed;            // 此配置同 SD 卡功能,作为 SDIO 外设,也有区分是否为 highspeed 的 SDIO 外设。
    	cap-sdio-irq;                // 此配置标识该 SDIO 外设(通常是 Wifi)是否支持 sdio 中断
    	keep-power-in-suspend;       // 此配置表示是否支持睡眠不断电,请默认加入该选项。Wifi 一般都有深度唤醒的要求。
    	non-removable;               // 此项表示该插槽为不可移动设备且此项为 SDIO 设备必须添加项。
    	sd-uhs-sdr50;         
    	no-1-8-v;
    	supports-sdio;         // 标识此插槽为 SDIO 功能,为必须添加项。否则无法初始化 SDIO 外设。
    	pinctrl-names = "default";
    	pinctrl-0 = <&sdmmc1m1_clk &sdmmc1m1_cmd &sdmmc1m1_bus4>; // rv1106-pinctrl.dtsi
    	status = "okay";
    };
    
    /**********ETH**********/
    &gmac {
    	status = "disabled";
    };
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62

    kernel增加wlan0

    • 加载原有的defconfig:make ARCH=arm CROSS_COMPILE=arm-rockchip830-linux-uclibcgnueabihf- luckfox_sd_wifi_rv1106_linux_defconfig
    • 进入menuconfig:make ARCH=arm menuconfig
    • 保存修改后的配置为defconfig:make ARCH=arm savedefconfig
    • 替换原有的配置:cp defconfig ./arch/arm/configs/luckfox_sd_wifi_rv1106_linux_defconfig

    在这里插入图片描述

    在这里插入图片描述
    在这里插入图片描述

    引脚分析

    在这里插入图片描述

    sdk/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-pinctrl.dtsi

    ...
    sdmmc0 {
    	/omit-if-no-ref/
    	sdmmc0_bus4: sdmmc0-bus4 {
    		rockchip,pins =
    			/* sdmmc0_d0 */
    			<3 RK_PA3 1 &pcfg_pull_up_drv_level_2>,
    			/* sdmmc0_d1 */
    			<3 RK_PA2 1 &pcfg_pull_up_drv_level_2>,
    			/* sdmmc0_d2 */
    			<3 RK_PA7 1 &pcfg_pull_up_drv_level_2>,
    			/* sdmmc0_d3 */
    			<3 RK_PA6 1 &pcfg_pull_up_drv_level_2>;
    	};
    
    	/omit-if-no-ref/
    	sdmmc0_clk: sdmmc0-clk {
    		rockchip,pins =
    			/* sdmmc0_clk */
    			<3 RK_PA4 1 &pcfg_pull_up_drv_level_2>;
    	};
    
    	/omit-if-no-ref/
    	sdmmc0_cmd: sdmmc0-cmd {
    		rockchip,pins =
    			/* sdmmc0_cmd */
    			<3 RK_PA5 1 &pcfg_pull_up_drv_level_2>;
    	};
    
    	/omit-if-no-ref/
    	sdmmc0_det: sdmmc0-det {
    		rockchip,pins =
    			/* sdmmc0_det */
    			<3 RK_PA1 1 &pcfg_pull_up>;
    	};
    };
    
    sdmmc1 {
    	...
    	/omit-if-no-ref/
    	sdmmc1m1_bus4: sdmmc1m1-bus4 {
    		rockchip,pins =
    			/* sdmmc1_d0_m1 */
    			<1 RK_PC1 5 &pcfg_pull_up_drv_level_2>,
    			/* sdmmc1_d1_m1 */
    			<1 RK_PC0 5 &pcfg_pull_up_drv_level_2>,
    			/* sdmmc1_d2_m1 */
    			<1 RK_PC5 5 &pcfg_pull_up_drv_level_2>,
    			/* sdmmc1_d3_m1 */
    			<1 RK_PC4 5 &pcfg_pull_up_drv_level_2>;
    	};
    
    	/omit-if-no-ref/
    	sdmmc1m1_clk: sdmmc1m1-clk {
    		rockchip,pins =
    			/* sdmmc1_clk_m1 */
    			<1 RK_PC2 5 &pcfg_pull_up_drv_level_2>;
    	};
    
    	/omit-if-no-ref/
    	sdmmc1m1_cmd: sdmmc1m1-cmd {
    		rockchip,pins =
    			/* sdmmc1_cmd_m1 */
    			<1 RK_PC3 5 &pcfg_pull_up_drv_level_2>;
    	};
    };
    ...
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67

    omit-if-no-ref 的意思是:如果没有引用则省略
    可以看出rv1106-pinctrl.dtsi文件里面的sdmmc0和sdmmc1节点的引脚可以对得上
    sdmmc0有热拔插引脚
    sdmmc1没有热拔插引脚

    我实现的就是使用sdmmc1m1的引脚配置,使用的sdio的接口。

    /***********mmc interface for wifi map to sdmmc1 set for sdio mode**********/
    &sdio {
    	max-frequency = <50000000>; // 最大运行频率不超过 150Mhz; SDIO2.0 卡最大 50M,SDIO3.0 最大支持 150M
    	bus-width = <4>;             // 4线数据模式
    	cap-sd-highspeed;            // 此配置同 SD 卡功能,作为 SDIO 外设,也有区分是否为 highspeed 的 SDIO 外设。
    	cap-sdio-irq;                // 此配置标识该 SDIO 外设(通常是 Wifi)是否支持 sdio 中断
    	keep-power-in-suspend;       // 此配置表示是否支持睡眠不断电,请默认加入该选项。Wifi 一般都有深度唤醒的要求。
    	non-removable;               // 此项表示该插槽为不可移动设备且此项为 SDIO 设备必须添加项。
    	sd-uhs-sdr50;         
    	no-1-8-v;
    	supports-sdio;         // 标识此插槽为 SDIO 功能,为必须添加项。否则无法初始化 SDIO 外设。
    	pinctrl-names = "default";
    	pinctrl-0 = <&sdmmc1m1_clk &sdmmc1m1_cmd &sdmmc1m1_bus4>; // rv1106-pinctrl.dtsi
    	status = "okay";
    };
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    遇到问题了

    
    # cd /oem/usr/ko/
    # ls
    aes_generic.ko                rve.ko
    gcm.ko                        insmod_ko.sh
    os04a10.ko                    sc3336.ko
    video_rkisp.ko                video_rkcif.ko
    atbm603x_.ko                  sc530ai.ko
    hichannel.ko                  ssv6x5x.ko
    insmod_wifi.sh                ghash-generic.ko
    libsha256.ko                  rga3.ko
    sha256_generic.ko             cfg80211.ko
    libarc4.ko                    rockit.ko
    atbm6041_wifi_sdio.ko         mpp_vcodec.ko
    ctr.ko                        release_version.txt
    rknpu.ko                      sc4336.ko
    8189fs.ko                     rk_dvbm.ko
    hpmcu_wrap.bin                gf128mul.ko
    8188fu.ko                     phy-rockchip-csi2-dphy.ko
    mac80211.ko                   r8723bs.ko
    ccm.ko                        phy-rockchip-csi2-dphy-hw.ko
    libaes.ko                     cmac.ko
    ipv6.ko
    # insmod libarc4.ko
    # insmod cfg80211.ko
    [   51.692727] cfg80211: Loading compiled-in X.509 certificates for regulatory database
    [   51.699323] cfg80211: Problem loading in-kernel X.509 certificate (-22)
    [  #  51.700006] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
    [   51.700042] cfg80211: failed to load regulatory.db
    
    # insmod mac80211.ko
    # insmod r8723bs.ko
    [   67.200376] r8723bs: module is from the staging directory, the quality is unknown, you have been warned.
    [   67.211449] RTL8723BS: module init start
    [   67.211478] RTL8723BS: rtl8723bs v4.3.5.5_12290.20140916_BTCOEX20140507-4E40
    [   67.211488] RTL8723BS: rtl8723bs BT-Coex version = BTCOEX20140507-4E40
    [   67.211905] pnetdev = 73c911f6
    [   67.237067] RTL8723BS: rtw_ndev_init(wlan0)
    [   67.245549] RTL8723BS: module init ret =0
    #
    # ifconfig
    lo        Link encap:Local Loopback
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    usb0      Link encap:Ethernet  HWaddr 92:83:F0:2C:77:FA
              inet addr:172.32.0.93  Bcast:172.32.255.255  Mask:255.255.0.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:210 errors:0 dropped:136 overruns:0 frame:0
              TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:22643 (22.1 KiB)  TX bytes:86 (86.0 B)
    
    # ifconfig -a
    lo        Link encap:Local Loopback
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    usb0      Link encap:Ethernet  HWaddr 92:83:F0:2C:77:FA
              inet addr:172.32.0.93  Bcast:172.32.255.255  Mask:255.255.0.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:210 errors:0 dropped:136 overruns:0 frame:0
              TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:22643 (22.1 KiB)  TX bytes:86 (86.0 B)
    
    wlan0     Link encap:Ethernet  HWaddr 84:20:96:AB:33:12
              BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    #
    #
    # ifconfig wlan0 up
    [   89.294991] rtl8723bs: acquire FW from file:rtlwifi/rtl8723bs_nic.bin
    ifconfig: SIOCSIFFLAGS: Operation not permitted
    # [   89.300854] ====>_BlockWrite 84 i:64
    [   89.300876] ====>_WriteFW 169
    [   89.301014] ====>_BlockWrite 84 i:0
    [   89.301022] ====>_WriteFW 169
    
    #
    # wpa_supplicant -B -d -i wlan0 -c /etc/wpa_supplicant.conf
    wpa_supplicant v2.6
    random: Trying to read entropy from /dev/random
    Successfully initialized wpa_supplicant
    Initializing interface 'wlan0' conf '/etc/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
    Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'
    Reading configuration file '/etc/wpa_supplicant.conf'
    ctrl_interface='/var/run/wpa_supplicant'
    ap_scan=1
    update_config=1
    Priority group 0
       id=0 ssid='MERCURY_2784'
    nl80211: Supported cipher 00-0f-ac:1
    nl80211: Supported cipher 00-0f-ac:5
    nl80211: Supported cipher 00-0f-ac:2
    nl80211: Supported cipher 00-0f-ac:4
    nl80211: Supported cipher 00-0f-ac:6
    nl80211: Using driver-based off-channel TX
    nl80211: interface wlan0 in phy phy0
    nl80211: Set mode ifindex 3 iftype 2 (STATION)
    nl80211: Subscribe to mgmt frames with non-AP handle 0x90bd0
    nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x90bd0 match=06
    nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x90bd0 match=0a07
    nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x90bd0 match=0a11
    nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x90bd0 match=1101
    nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x90bd0 match=1102
    nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x90bd0 match=0505
    nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x90bd0 match=0500
    rfkill: Cannot open RFKILL control device
    nl80211: RFKILL status not available
    [  102.318143] rtl8723bs: acquire FW from file:rtlwifi/rtl8723bs_nic.bin
    Could not set interface wlan0 flags (UP): Operation not permitted
    nl80211: Could not set interface 'wlan0' UP
    nl80211: deinit ifname=wlan0 disabled_11b_rates=0
    nl80211: Remove monitor interface: refcount=0
    netlink: Operstate: ifindex=3 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
    nl80211: Set mode ifindex 3 iftype 2 (STATION)
    nl80211: Unsubscribe mgmt frames handle 0x88818359 (mode change)
    wlan0: Failed to initialize driver interface
    Failed to add interface wlan0
    wlan0: Cancelling scan request
    wlan0: Cancelling authentication timeout
    #
    #
    # ifconfig wlan0 up
    [  218.745990] rtl8723bs: acquire FW from file:rtlwifi/rtl8723bs_nic.bin
    ifconfig: SIOCSIFFLAGS: Operation not permitted
    #
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141

    碰到鬼,硬件接触不良导致的!

    # ./wifi.sh
    [   63.911425] cfg80211: Loading compiled-in X.509 certificates for regulatory database
    [   63.913288] cfg80211: Problem loading in-kernel X.509 certificate (-22)
    [   63.916580] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
    [   63.916608] cfg80211: failed to load regulatory.db
    [   64.013333] r8723bs: module is from the staging directory, the quality is unknown, you have been warned.
    [   64.024423] RTL8723BS: module init start
    [   64.024452] RTL8723BS: rtl8723bs v4.3.5.5_12290.20140916_BTCOEX20140507-4E40
    [   64.024461] RTL8723BS: rtl8723bs BT-Coex version = BTCOEX20140507-4E40
    [   64.024825] pnetdev = 3210999c
    [   64.051486] RTL8723BS: rtw_ndev_init(wlan0)
    [   64.060565] RTL8723BS: module init ret =0
    #
    #
    #
    # ifconfig wlan0 up
    [   70.762122] rtl8723bs: acquire FW from file:rtlwifi/rtl8723bs_nic.bin
    # mkdir -p /var/run/wpa_supplicant
    #
    #
    # wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
    Successfully initialized wpa_supplicant
    rfkill: Cannot open RFKILL control device
    # [   85.901528] RTL8723BS: rtw_cmd_thread: DriverStopped(0) SurpriseRemoved(1) break at line 430
    
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    这也是硬件接触不良导致的!!!

    正常的流程

    ifconfig usb0 down
    
    cd /oem/usr/ko
    insmod libarc4.ko
    insmod cfg80211.ko
    insmod mac80211.ko
    insmod r8723bs.ko
    
    ifconfig wlan0 up
    
    wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
    
    udhcpc -i wlan0
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    视频流的地址:rtsp://192.168.1.107/live/0
    在这里插入图片描述
    在这里插入图片描述
    视频推流的时候工作电流约260mA。

    在这里插入图片描述
    如下,似乎自带了移动检测。

    
    [video.c][rkipc_ivs_get_results]:OD flag:1
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:Detect movement
    [video.c][rkipc_ivs_get_results]:OD flag:1
    [video.c][rkipc_ivs_get_results]:OD flag:1
    [video.c][rkipc_ivs_get_results]:OD flag:1
    [video.c][rkipc_ivs_get_results]:OD flag:1
    [video.c][rkipc_ivs_get_results]:OD flag:1
    [video.c][rkipc_ivs_get_results]:OD flag:1
    [video.c][rkipc_ivs_get_results]:OD flag:1
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33

    增加上电自动加载WiFi的功能

    在板子的文件系统里面:

    # cat /sys/bus/sdio/devices/*/uevent
    DRIVER=rtl8723bs
    SDIO_CLASS=07
    SDIO_ID=024C:B723
    SDIO_REVISION=0.0
    MODALIAS=sdio:c07v024CdB723
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    根据这个在开发板文件系统里面的oem/usr/ko/insmod_wifi.sh脚本里面添加

    #rtl8723bs
    cat /sys/bus/sdio/devices/*/uevent | grep "024C:B723"
    if [ $? -eq 0 ];then
    	insmod  cfg80211.ko
    	insmod  libarc4.ko
    	insmod  mac80211.ko
    	insmod  r8723bs.ko
    fi
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    正常的应该是在SDK的原文件里面添加的:sdk/sysdrv/drv_ko/wifi/insmod_wifi.sh

    #rtl8723bs
    cat /sys/bus/sdio/devices/*/uevent | grep "024C:B723"
    if [ $? -eq 0 ];then
    	insmod  cfg80211.ko
    	insmod  libarc4.ko
    	insmod  mac80211.ko
    	insmod  r8723bs.ko
    fi
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    自动连接WiFi

    需要在SDK的原文件里面添加:sdk/project/app/wifi_app/wpa_supplicant.conf自己要连接的WiFi名字和WiFi密码。

    ctrl_interface=/var/run/wpa_supplicant
    ap_scan=1
    update_config=1
    
    network={
            ssid="Your-WiFi"
            psk="123456789"
            key_mgmt=WPA-PSK
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    最终体

    在这里插入图片描述

    # top
    Mem: 31928K used, 2540K free, 144K shrd, 92K buff, 8348K cached
    CPU:  42% usr  28% sys   0% nic  28% idle   0% io   0% irq   0% sirq
    Load average: 10.72 7.90 3.71 1/102 1098
      PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
      300     1 root     S    92620 269%  50% rkipc -a /oem/usr/share/iqfiles
     1098   432 root     R     1196   3%   7% top
      200     2 root     SW       0   0%   7% [vcodec_thread_0]
      187     1 root     S    16440  48%   0% /usr/bin/adbd
      320     1 root     S     5192  15%   0% rkwifi_server start
       67     1 root     S     1604   5%   0% /sbin/udevd -d
      475     1 root     S     1272   4%   0% wpa_supplicant -B -i wlan0 -c /data/wp
      432     1 root     S     1208   4%   0% -/bin/sh
        1     0 root     S     1196   3%   0% init
      375     2 root     SW       0   0%   0% [RTW_XMIT_THREAD]
      377     2 root     SW       0   0%   0% [RTWHALXT]
       49     2 root     IW       0   0%   0% [kworker/0:2-eve]
      198     2 root     SW       0   0%   0% [irq/44-ffa50000]
      196     2 root     SW       0   0%   0% [queue_work0]
       32     2 root     IW       0   0%   0% [kworker/0:1-eve]
      451     2 root     DW       0   0%   0% [venc]
     1095     2 root     IW       0   0%   0% [kworker/0:0-eve]
      197     2 root     SW       0   0%   0% [queue_work1]
        7     2 root     SW       0   0%   0% [ksoftirqd/0]
      225     2 root     DW       0   0%   0% [vmcu]
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
  • 相关阅读:
    UE5、CesiumForUnreal实现加载GeoJson绘制单面(Polygon)功能(StaticMesh方式)
    使用QT制作QQ登录界面
    Java手写归并排序和案例拓展
    6、规划绩效域
    圆角矩形不是圆:圆角的画法和二阶连续性
    架构的未来:微前端与微服务的融合
    10分钟,我写完了8小时的CSS样式,我真棒!
    机器学习西瓜书+南瓜书吃瓜教程学习笔记第三章(二)
    STL中map容器详解,对组类型的简单剖析。
    智慧图书馆,RFID技术在图书借还,图书防盗中的应用优势
  • 原文地址:https://blog.csdn.net/qq_28877125/article/details/133634104