Rockchip · AI & Linux Hub

Rockchip Linux Wi-Fi/BT 開発者ガイド

RockchipLinux Wi-Fi/BT 開発者ガイド — V7.0.1

中国語と英語のRockchipV7.0.1ソース(2024-04-16)に基づいて、チャプター1〜10、構成、コード、テスト図、パラメータ表のすべての技術的な材料を保持します。 第11章には、FTPの連絡先/ログイン情報のみが含まれており、除外されます。 このArmSoMリファレンスは、すべてのボード上のすべてのモジュールのサポートを確立しません。実際のSoC、SDK/BSP、カーネル、回路図、電源、モジュールファームウェアを確認してください。 コマンド、測定、ログはソース例です。コマンドやハードウェア/RFテストは実行されません。

各ソースは、番号付けを維持します。: 英語は2.2.4.1イラスト見出しを追加します。 中国語 4.8.1 の Wi-Fi/BT およびアンテナ項目は英語 4.8.2/4.8.3 になります; 中国のテスト方法 4.8.2 は英語 4.8.4 に対応します。 ソースのクロスリファレンスは、古い番号付け(例 7.1.1、7.2、および8.1)に引き続きポイントします。 セクションをタイトルで見つけます。 ソースは、Synopsys、Bcm44338a1.hcd/bcm43438a1.hcd、udhcpcd、リセットgopios、GPIOの極性コメント、IRQ CPU番号はSDK /データシートに対する検証が必要です。 コードとそのコメントは、ソース言語を保持します。すべてのイラストは元の技術的な数字です。

オリジナルの数字には、中国語と英語のラベルが混在しています。 RF とアンテナレポート画像に同行する編集可能な転写。

SoC Linux
RK356X, RK3399, RK3326, RK3288, RK3308, RV1109, RV1126, PX30 4.4 / 4.19
RK3588, RK3566, RK3568, RK3399, RV1106, RV1103 5.10

1. . プレファクチャ {#1-preface}

本ドキュメントは、ビルドルート、IPC、低電力製品、Debian 向けの SDK を含む Wi-Fi/BT の設定、デバッグ、開発、およびアプリケーションに関するガイダンスを主に提供しています。

2. . Wi-Fi/BT の設定 {#2-wi-fibt-configuration}

2.1 SDK の構成ガイド {#21-sdk-configuration-guide}

まず、チップとボードモデルをコマンドで設定します。: ./build.sh チップ 次のデコンフィグが使用されるように、デフォルト設定を変更できます。

SDK_ROOT/device/rockchip$
+++ b/rk3588/rockchip_rk3588_evb1_lp4_v10_defconfig
@@ -1,4 +1,5 @@
 RK_YOCTO_CFG="rockchip-rk3568-evb"
+RK_WIFIBT_CHIP="ALL_AP"   //Note the colon ""
 RK_KERNEL_DTS_NAME="rk3568-evb1-ddr4-v10-linux" //The specific dts file used
 RK_PARAMETER="parameter-buildroot-fit.txt"

設定する Wi-Fi モデルを構成します。 RK_WIFIBT_CHIP (“/”) を入力することで、 RK_WIFIBT_CHIP を検索します。: ALL_AP: SDK ALL_CY に含まれるすべての Synopsys (AMPAK) および Realtek モジュールをサポート: SDK に含まれるすべての Infineon および Realtek モジュールをサポート モデルを指定します。 AP6275/AP6358S/AP6212/AP6236 … RTL8723DS/RTL8822CS … CYW4354/CYW43438/CYW5557X_PCIE/CYW5557X_PCIE 対応機種は以下の通りです。

device/rockchip/common/scripts/post-wifibt.sh
156:    if [[ "$RK_WIFIBT_CHIP" = "AP6275_PCIE" ]];then
167:    if [[ "$RK_WIFIBT_CHIP" = "CYW4354" ]];then
174:    if [[ "$RK_WIFIBT_CHIP" = "CYW4373" ]];then
181:    if [[ "$RK_WIFIBT_CHIP" = "CYW43438" ]];then
188:    if [[ "$RK_WIFIBT_CHIP" = "CYW43455" ]];then
195:    if [[ "$RK_WIFIBT_CHIP" = "CYW5557X" ]];then
202:    if [[ "$RK_WIFIBT_CHIP" = "CYW5557X_PCIE" ]];then
209:    if [[ "$RK_WIFIBT_CHIP" = "CYW54591" ]];then
216:    if [[ "$RK_WIFIBT_CHIP" = "CYW54591_PCIE" ]];then
223:    if [[ "$RK_WIFIBT_CHIP" = "RTL8188FU" ]];then
228:    if [[ "$RK_WIFIBT_CHIP" = "RTL8189FS" ]];then
233:    if [[ "$RK_WIFIBT_CHIP" = "RTL8723DS" ]];then
237:    if [[ "$RK_WIFIBT_CHIP" = "RTL8821CS" ]];then
241:    if [[ "$RK_WIFIBT_CHIP" = "RTL8822CS" ]];then
245:    if [[ "$RK_WIFIBT_CHIP" = "RTL8852BS" ]];then
249:    if [[ "$RK_WIFIBT_CHIP" = "RTL8852BE" ]];then
280:    if [[ "$RK_WIFIBT_CHIP" = "ALL_CY" ]];then
299:    if [[ "$RK_WIFIBT_CHIP" = "ALL_AP" ]];then

その他のモデルがサポートされています。例えば、AICやATBMなどの国内モジュールでは、FTPサーバからのサポートを得ることができます。

2.2 DTS の構成 {#22-dts-configuration}

回路図に従ってDTSを設定してください。

2.2.1 SDIO Wi-Fi の設定 {#221-sdio-wi-fi-configuration}

主にパワーコントロールとカードが認識されると、大きく異なる2つの方法に対応します。 標準フレームワーク原則参照: シンプルなMCCパワーシーケンスプロバイダの目的は、様々なSOC設計間で共通プロパティのセットをサポートすることです。 そのため、いくつかのSOC設計の同じプロバイダを使用することを可能にします。mmc-pwrseq-simple Wi-FiのREG_ONは、mmcフレームワーク、参照コードによってサポートされています。 kernel/drivers/mmc/core/pwrseq_simple.c利点:すべてのWi-Fi電源は、mmcフレームワークの欠点によって均一に管理されます。 SDIOカードの再認識をサポートしていません

/* System-on-Chip designs may specify a specific
   * MMC power sequence. To successfully detect an
   * SDIO card, that power sequence must be maintained
   * while initializing the card.
   */
sdio_pwrseq: sdio-pwrseq {
  compatible = "mmc-pwrseq-simple";
  pinctrl-names = "default";
  pinctrl-0 = <&wifi_enable_h>;

  /* reset-gpios:
   * contains a list of GPIO specifiers. The reset GPIOs are asserted
   * at initialization and prior we start the power up procedure of the
   * card. They will be de-asserted right after the power has been
   * provided to the card.
   *
   * Alias: WIFI_REG_ON/WL_REG_ON etc (schematic diagram)
   * Notes:
   * GPIO_ACTIVE_LOW: Active HIGH
   * GPIO_ACTIVE_LOW: Active LOW
   */
  reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>;

  /*
   * Default: disabled
   */
  //clocks = <&clk_32768_ck>;  //Handle for the entry in clock-names.
  //clock-names = "ext_clock"; //32.768K: External clock provided to the card.

  /* It's reused as a tunable delay waiting for I/O signaling
   * and card power supply to be stable, regardless of whether
   * pwrseq-simple is used. Default to 10ms if no available.
   *
   * Delay in ms after powering the card and de-asserting the
   * reset-gpios (if any).
   *
   * Default: disabled
   */
  //post-power-on-delay-ms = <200>;

  /* Delay in us after asserting the reset-gpios (if any)
   * during power off of the card.
   *
   * Default: disabled
   */
  //power-off-delay-us = <200>;
};

/* Related to reset-gpio above */
&pinctrl {
  sdio-pwrseq {
    wifi_enable_h: wifi-enable-h {
      rockchip,pins =
      <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
    };
  };
};

/* SDIO
 * https://elixir.bootlin.com/linux/latest/source/
 * Documentation/devicetree/bindings/mmc/mmc-controller.yaml
 */
&sdio {
  /*
   * Description:
   * Maximum operating frequency of the bus:
   *  - for SD/SDIO cards the SDR104 mode has a max supported
   *    frequency of 150 or 200MHz,
   * So, lets keep the maximum supported value here.
   */
  max-frequency = <150000000>;

  /* Number of data lines. */
  bus-width = <4>;

  /* SD high-speed timing is supported. */
  cap-sd-highspeed;

  /* SD UHS SDR104 speed is supported. */
  sd-uhs-sdr104;

  /*
   * Controller is limited to send SD commands during initialization.
   * Controller is limited to send MMC commands during initialization.
   */
  no-sd;
  no-mmc;

  /* Non-removable slot (like SDIO Wi-Fi); assume always present. */
  non-removable;

  /* enable SDIO IRQ signaling on this interface */
  cap-sdio-irq;

  /* SDIO only. Preserves card power during a suspend/resume cycle. */
  keep-power-in-suspend;

  /* Enable pwrseq*/
  mmc-pwrseq = <&sdio_pwrseq>;

  status = "okay";
};

/* Rockchip Soc Wi-Fi node */
wireless-wlan {
  compatible = "wlan-platdata";
  rockchip,grf = <&grf>;

  /* Attention: If the Wi-Fi module requires 32.768K and is supplied
   * by the Power Management Integrated Circuit (PMIC) as indicated
   * in the schematic, open the following properties and fill in the
   * relevant attributes according to the actual PMIC model used.
   */
  clocks = <&rk809 1>;  //RK809
  clocks = <&hym8563>;  //or hym8563
  clock-names = "ext_clock";

  /* The name of the Wi-Fi, without any specific constraints,
   * serves merely as a suggestive indicator.
   */
  wifi_chip_type = "ap6255";

  /* WIFI_WAKE_HOST: The Wi-Fi chip issues an interrupt notification
   * to the System on Chip (SOC) through this pin for further operations.
   * Special attention: Please verify the connection relationship between
   * this pin and the main controller(SOC); the configuration for a direct
   * connection is GPIO_ACTIVE_HIGH. If an inverted tube is introduced
   * in between, the configuration should be set to GPIO_ACTIVE_LOW.
   */
  WIFI,host_wake_irq = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;

  status = "okay";
};

wireless-wlan {
  /omit-if-no-ref/
  wifi_wake_host: wifi-wake-host {
    /* The initial state of the interrupt pin.*/
    rockchip,pins = <0 RK_PA0 0 &pcfg_pull_none>;
  };
};

従来のフレームワーク Wi-Fi の REG_ON は、Wi-Fi ドライバーの net/rfkill/rfkill-wlan.c の複数の rmmod/insmod によって制御されます、パッチは必要です: KO モード パッチ

/* Wi-Fi */
wireless-wlan {
  compatible = "wlan-platdata";
  rockchip,grf = <&grf>;
  clocks = <&rk809 1>;  //RK809
  clocks = <&hym8563>;  //or hym8563
  clock-names = "ext_clock";
  wifi_chip_type = "ap6255";
  WIFI,host_wake_irq = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
  WIFI,poweren_gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
  status = "okay";
};

&sdio {
  max-frequency = <150000000>;
  bus-width = <4>;
    cap-sd-highspeed;
  sd-uhs-sdr104;
    no-sd;
    no-mmc;
    cap-sdio-irq;
    keep-power-in-suspend;

  /* delete-property */
  /delete-property/ non-removable;
  /delete-property/ mmc-pwrseq = <&sdio_pwrseq>;

  status = "okay";
};

wireless-wlan {
  /omit-if-no-ref/
  wifi_wake_host: wifi-wake-host {
    rockchip,pins = <0 RK_PA0 0 &pcfg_pull_none>;
  };
};

2.2.2 Bluetooth の設定 {#222-bluetooth-configuration}

UART関連の構成は、実際のUARTポートの対応するPINに指定する必要があります。 SDKで設計されているRTS/CTS PINを必ず接続してください! Bluetooth の注意を参照してください。 特別な注意: 多くの異常は、これらの2つのPINが接続されていないか、必要に応じて接続されていないことによって引き起こされます。 Bluetooth が UART4 を使用すると仮定します。

/* Note the following UART configurations: uart4_xfer/uart4_rts/uart4_ctsn
 * The names for each platform may vary, so you need to look for the
 * corresponding UART notation in the dts/dtsi of the specific chip platform,
 * such as uart4_ctsn,which may be named uart4_cts on some platforms.
 */
wireless-bluetooth {
    compatible = "bluetooth-platdata"

    /* Must be configured and ensure it is correct
     * Configure the RTS pin corresponding to the UART of the SoC here
     * The special configuration is because some Bluetooth chips need to keep
     * the CTS pin low before power-on, otherwise, they will enter test mode
     * or other abnormal working modes. Therefore, the driver will pull it low
     * before power-on,through pinctrl-1, and switch back to the RTS function
     * after power-on, through pinctrl-0;
     */
    uart_rts_gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_LOW>;
    pinctrl-names = "default", "rts_gpio";
    pinctrl-0 = <&uart4_rts>;
    pinctrl-1 = <&uart4_rts_gpio>;

    /* BT_REG_ON Bluetooth power switch */
    BT,power_gpio = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;

    /* Linux platform: The following two configurations do not need to be set */
    //BT,wake_host_irq = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; /* BT_WAKE_HOST */
    //BT,wake_gpio = <&gpio4 31 GPIO_ACTIVE_HIGH>; /* HOST_WAKE_BT */
    status = "okay";
};

/* Open the corresponding UART configuration */
&uart4 {
    pinctrl-names = "default";
    /* Configure the TX/RX/CTS PINs corresponding to the UART of the SoC here, do
not configure the RTS PIN */
    pinctrl-0 = <&uart4_xfer &uart4_ctsn>;
    status = "okay";
};

/* uart4_rts_gpio */
&pinctrl {
    wireless-bluetooth {
        uart4_rts_gpio: uart4-rts-gpio {
            rockchip,pins = <4 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
        };
    };
};

カーネル6.1ブロードコムブルートゥースのオプションアップストリーム構成

# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/net/broadcom-bluetooth.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Broadcom Bluetooth Chips

maintainers:
  - Linus Walleij <linus.walleij@linaro.org>

description:
  This binding describes Broadcom UART-attached Bluetooth chips.

properties:
  compatible:
    enum:
      - brcm,bcm20702a1
      - brcm,bcm4329-bt
      - brcm,bcm4330-bt
      - brcm,bcm4334-bt
      - brcm,bcm43430a0-bt
      - brcm,bcm43430a1-bt
      - brcm,bcm43438-bt
      - brcm,bcm4345c5
      - brcm,bcm43540-bt
      - brcm,bcm4335a0
      - brcm,bcm4349-bt
      - cypress,cyw4373a0-bt
      - infineon,cyw55572-bt

  shutdown-gpios:
    maxItems: 1
    description: GPIO specifier for the line BT_REG_ON used to
      power on the BT module

  reset-gpios:
    maxItems: 1
    description: GPIO specifier for the line BT_RST_N used to
      reset the BT module. This should be marked as
      GPIO_ACTIVE_LOW.

  device-wakeup-gpios:
    maxItems: 1
    description: GPIO specifier for the line BT_WAKE used to
      wakeup the controller. This is using the BT_GPIO_0
      pin on the chip when in use.
host-wakeup-gpios:
  maxItems: 1
  deprecated: true
  description: GPIO specifier for the line HOST_WAKE used
    to wakeup the host processor. This is using he BT_GPIO_1
    pin on the chip when in use. This is deprecated and replaced
    by interrupts and "host-wakeup" interrupt-names

clocks:
  minItems: 1
  maxItems: 2
  description: 1 or 2 clocks as defined in clock-names below,
    in that order

clock-names:
  description: Names of the 1 to 2 supplied clocks
  oneOf:
    - const: extclk
      deprecated: true
      description: Deprecated in favor of txco

    - const: txco
      description: >
        external reference clock (not a standalone crystal)

    - const: lpo
      description: >
        external low power 32.768 kHz clock

    - items:
        - const: txco
        - const: lpo

vbat-supply:
  description: phandle to regulator supply for VBAT

vddio-supply:
  description: phandle to regulator supply for VDDIO

brcm,bt-pcm-int-params:
  $ref: /schemas/types.yaml#/definitions/uint8-array
  minItems: 5
  maxItems: 5
  description: |-
    configure PCM parameters via a 5-byte array:
     sco-routing: 0 = PCM, 1 = Transport, 2 = Codec, 3 = I2S
     pcm-interface-rate: 128KBps, 256KBps, 512KBps, 1024KBps, 2048KBps
     pcm-frame-type: short, long
     pcm-sync-mode: slave, master
     pcm-clock-mode: slave, master

brcm,requires-autobaud-mode:
  type: boolean
  description:
    Set this property if autobaud mode is required. Autobaud mode is required
      if the device's initial baud rate in normal mode is not supported by the
      host or if the device requires autobaud mode startup before loading FW.

  interrupts:
    items:
      - description: Handle to the line HOST_WAKE used to wake
          up the host processor. This uses the BT_GPIO_1 pin on
          the chip when in use.

  interrupt-names:
    items:
      - const: host-wakeup

  max-speed: true
  current-speed: true

required:
  - compatible

dependencies:
  brcm,requires-autobaud-mode: [ shutdown-gpios ]

if:
  not:
    properties:
      compatible:
        contains:
          enum:
            - brcm,bcm20702a1
            - brcm,bcm4329-bt
            - brcm,bcm4330-bt
then:
  properties:
    reset-gpios: false

additionalProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/interrupt-controller/irq.h>

    uart {
        uart-has-rtscts;

        bluetooth {
            compatible = "brcm,bcm4330-bt";
            max-speed = <921600>;
            brcm,bt-pcm-int-params = [01 02 00 01 01];
            shutdown-gpios = <&gpio 30 GPIO_ACTIVE_HIGH>;
            device-wakeup-gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
            reset-gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
            interrupt-parent = <&gpio>;
            interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
        };
    };

2.2.3 IOパワードメイン構成 {#223-io-power-domain-configuration}

重要:SDKに対応したパワードメイン構成手順を参照してください。以下を参照し、SDIO3.0 のデバイスが付属していることを指摘する必要があります。

1.8v.

//Note that the names of io_domains vary for each platform, some are written as
&pmu_io_domains;
&io_domains {
//or
&pmu_io_domains {
 /* VDDIO3_VDD references the voltage of vcc_1v8, if the hardware is connected to
3.3v, then change to vcc_3v3,
  * Note: The names vcc_1v8/vcc_3v3 should be adjusted according to the actual
dts/dtsi.
  */
 vccio3-supply = <&vcc_1v8>;
};

vcc_1v8: vcc_1v8: vcc-1v8 {
 compatible = "regulator-fixed";
 regulator-name = "vcc_1v8";
 regulator-always-on;
 regulator-boot-on;
 /* vcc_1v8 supplies 1.8v */
 regulator-min-microvolt = <1800000>;
 regulator-max-microvolt = <1800000>;
 vin-supply = <&vcc_io>;
};

2.2.4 PCIE Wi-Fi の設定 {#224-pcie-wi-fi-configuration}

SDK ディレクトリーの次のドキュメントを読むことを強くお勧めします。docs\Common\PCIe\Rockchip_RK3399_Developer_Guide_PCIe_EN.pdf docs\Common\PCIe\Rockchip_RK356X_Developer_Guide_PCIe_EN.pdf docs\Common\PCIe\Rockchip_Developer_Guide_PCIe_EN.pdf 次の3つの重要なポイントは、回路図に従って発見されます。 PCIe インターフェイス付きの Wi-Fi の2つの基本タイプがあります。ボードと M2 インターフェイスに取り付けられたモジュール、 しかし、その重要なポイントは同じです: VBAT/VCC3V3: トータル電源は、通常、3.3V、それは一定の電源です。 WIFI_REG_ON: ブート中に高い保持されている SoC のリセット/有効ピン; PCIE_PERST_L/PERSTO: SoC の PCIe 部分のリセットピン、DTS で対応する PCIE ノードの下で正しく構成する必要があります。

コントローラーと PHY を回路図に従って正しく設定し、上記の 3 つのドキュメントを参照してください。 簡単な例を示します。

// PHY node, the name varies depending on the chip, some are called
&combphy2_psq, the actual name refers to the three documents above;
&pcieXXphy {
    status = "okay";
};

/* If using pcie2x1l2, sata0 and pcie2x1l2 share combphy0_ps,
/* it is necessary to ensure that it is disabled
 */
&sata0 {
    status = "disabled";
}

// Controller node, specifically which controller node to connect to
&pcixxx {
 /* This item sets the PERST# reset signal of the PCIe interface;
 /* whether it is a slot or a soldered device, please find the pin
 /* on the schematic and configure it correctly,
  * otherwise, the link establishment will not be completed.
  * Choose one of the following
  */
    ep-gpios = <&gpio3 13 GPIO_ACTIVE_HIGH>; // RK3399 platform
    reset-gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; // RK356X/3588 platform

    num-lanes = <4>;
    rockchip,skip-scan-in-resume;
    rockchip,perst-inactive-ms = <500>;  /* Refer to the Wi-Fi module manual for
the required #PERST reset time */
    vpcie3v3-supply = <&vcc3v3_pcie20_wifi>;
    status = "okay";
};

// Configure the Wi-Fi REG ON of the PCIe Wi-Fi to pull high during the boot
identification phase
vcc3v3_pcie20_wifi: vcc3v3-pcie20-wifi {
    compatible = "regulator-fixed";
    regulator-name = "vcc3v3_pcie20_wifi";
    regulator-min-microvolt = <3300000>;
    regulator-max-microvolt = <3300000>;
    enable-active-high;
    /*
    * wifi_reg_on is enabled after vbat, vddio is stable, and before reset-gpios
is
    * pulled high, so it is placed in the PCIe power node to meet the module
timing,
    * referring to wifi_poweron_gpio.
    */
    pinctrl-0 = <&wifi_poweron_gpio>
    startup-delay-us = <5000>;
    vin-supply = <&vcc12v_dcin>;
};
// Wi-Fi node configuration
wireless_wlan: wireless-wlan {
    compatible = "wlan-platdata";
    wifi_chip_type = "ap6275p";
    // Configuration: WIFI_REG_ON, for use by the Wi-Fi driver
    WIFI,poweren_gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
    // Configuration: WIFI_HOST_WAKE, if any
    WIFI,host_wake_irq = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
    status = "okay";
};

&pinctrl {
    wireless-wlan {
        wifi_poweren_gpio: wifi-poweren-gpio {
            //PCIE REG ON: 务必配置成上拉
            rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
        };
    };
};
2.2.4.1 RK3588のSchematicとPCIE20 dtsi間の対応 {#2241-correspondence-between-rk3588-schematic-and-pcie20-dtsi}
//PCIE20_0 -> pcie2x1l2
PCIE20_0_REFCLKP
PCIE20_0_REFCLKN
PCIE20_0_TXP
PCIE20_0_TXN
PCIE20_0_RXP
PCIE20_0_RXN

&combphy0_ps {
 status = "okay";
};

//pcie@fe190000
&pcie2x1l2 {
    reset-gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_HIGH>;
    status = "okay";
};

//PCIE20_1 -> pcie2x1l0
PCIE20_1_REFCLKP
PCIE20_1_REFCLKN
PCIE20_1_TXP
PCIE20_1_TXN
PCIE20_1_RXP
PCIE20_1_RXN

&combphy1_ps {
    status = "okay";
};

&pcie2x1l0 {   //pcie@fe170000
    reset-gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_HIGH>;
    status = "okay";
};

//PCIE20_2 -> pcie2x1l1
PCIE20_2_REFCLKP
PCIE20_2_REFCLKN
PCIE20_2_TXP
PCIE20_2_TXN
PCIE20_2_RXP
PCIE20_2_RXN

&combphy2_psu {
    status = "okay";
};

&pcie2x1l1 { //pcie@fe180000
    reset-gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_HIGH>;
    status = "okay";
};

2.2.5 USB Wi-Fi の設定 {#225-usb-wi-fi-configuration}

以下のUSB関連リファレンス文書を読んで強くお勧めします: docs\Common\USB\Rockchip_Developer_Guide_USB_EN.pdf. Wi-Fi ノード構成は、次の 2 つのシナリオに分けられます。

// Case one: The .config file in the kernel directory *has* the
CONFIG_RFKILL/CONFIG_RFKILL_RK configuration option enabled:
wireless_wlan: wireless-wlan {
    compatible = "wlan-platdata";
    wifi_chip_type = "rtl8188fu";
    // Configuration: WIFI_REG_ON pin;
    WIFI,poweren_gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
    // Configuration: WIFI_HOST_WAKE, if available;
    WIFI,host_wake_irq = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
    status = "okay";
};

// Case two: The .config file in the kernel directory *does not have* the
CONFIG_RFKILL/CONFIG_RFKILL_RK configuration option enabled:
// Configuration: WIFI_REG_ON pin
wifi_usb: wifi-usb {
    compatible = "regulator-fixed";
    regulator-name = "wifi_usb";
    regulator-min-microvolt = <3300000>;
    regulator-max-microvolt = <3300000>;
    regulator-boot-on;
    enable-active-high;  // Change to low if active low is required
    gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; // WIFI_REG_ON PIN, change to LOW if
active low is required
};

USB ノード構成参照は以下の通りです。

/* Enable the corresponding controller and PHY
 * The following is a reference for RV1126/RV1109, please modify according to the
actual situation for other chips;
 * Note that USB has host/device/otg modes;
 * If you are unsure how to configure, please raise an issue on Rockchip redmine:
How to configure the USBXX port of the RKxxx chip as host mode
 * (usb module as device);
 */

/* USB connected to the HOST pin of the SoC */
&u2phy_host {
    status = "okay";
};

&u2phy1 {
    status = "okay";
};

&usb_host0_ehci {
    status = "okay";
};

&usb_host0_ohci {
    status = "okay";
};

/* Another option is to connect to OTG pin of the SOC */
&u2phy1 {
    status = "okay";
};

&usbdrd {
    status = "okay";
};

&usbdrd_dw3 {
    status = "okay";
};

&u2phy_otg {
    status = "okay";
};

2.3 SDMMC (SDカード インターフェイス)はWi-Fiの破片に接続しました {#23-sdmmc-sd-card-interface-connected-to-wi-fi-chip}

時々、特別な条件のために、それはSDMMCインターフェイスにWi-Fiの破片を接続することが必要です。 次の2つの構成を見つけて&sdioを&sdmmcに変更し、未使用ノードを無効にします。 特別な注意:SDMMC_DETピンはハードウェア上で低速に引き出す必要があります。

&sdmmc {
    bus-width = <4>;
    cap-mmc-highspeed;
    cap-sd-highspeed;
    card-detect-delay = <200>;
    rockchip,default-sample-phase = <90>;
    supports-sd;
    sd-uhs-sdr12;
    sd-uhs-sdr25;
    sd-uhs-sdr104;
    vqmmc-supply = <&vccio_sd>;
-   status = "okay";
+   status = "disabled";
};

+&sdmmc {
-&sdio {
    max-frequency = <200000000>;
    bus-width = <4>;
    cap-sd-highspeed;
    cap-sdio-irq;
    keep-power-in-suspend;
    non-removable;
    rockchip,default-sample-phase = <90>;
    sd-uhs-sdr104;
    supports-sdio;
    mmc-pwrseq = <&sdio_pwrseq>; //sdio_pwrseq can only be referenced by one
node, it cannot be referenced by both sdmmc and sdio at the same time!
    status = "okay";
};

#RK3328 Platform:
&sdmmc {
     bus-width = <4>;
    cap-mmc-highspeed;
    cap-sd-highspeed;
    disable-wp;
    max-frequency = <150000000>;
    pinctrl-names = "default";
    pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>;
    vmmc-supply = <&vcc_sd>;
    supports-sd;
-   status = "okay";
+   status = "disabled";
};

+&sdmmc {
-&sdio  {
    bus-width = <4>;
    cap-sd-highspeed;
    cap-sdio-irq;
    keep-power-in-suspend;
    max-frequency = <150000000>;
    supports-sdio;
    mmc-pwrseq = <&sdio_pwrseq>;
    non-removable;
    pinctrl-names = "default";
    pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>;
    status = "okay";
};

2.4 カーネルの構成 {#24-kernel-configuration}

2.4.1 Wi-Fiカーネルの設定 {#241-wi-fi-kernel-configuration}

Wi-Fi ドライバーは、外部/rkwifibbt/drivers/ディレクトリに移動しました。 参照については、Wi-Fi/BTフレームワークおよびコンパイル手順を参照してください。 必須カーネル構成(実際の状況に応じてモジュールに変更できます):

CONFIG_RFKILL=y
CONFIG_RFKILL_RK=y

CONFIG_MMC=y
CONFIG_PWRSEQ_SIMPLE=y

CONFIG_MMC_DW=y
CONFIG_MMC_DW_PLTFM=y
CONFIG_MMC_DW_ROCKCHIP=y

CONFIG_WIRELESS=y
CONFIG_WIRELESS_EXT=y
CONFIG_WEXT_CORE=y
CONFIG_WEXT_PROC=y
CONFIG_WEXT_PRIV=y
CONFIG_CFG80211=y
CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=y
CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS=y
CONFIG_CFG80211_DEFAULT_PS=y
CONFIG_CFG80211_CRDA_SUPPORT=y
# CONFIG_CFG80211_WEXT is not set
CONFIG_MAC80211=y
CONFIG_MAC80211_HAS_RC=y
CONFIG_MAC80211_RC_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT="minstrel_ht"
CONFIG_MAC80211_STA_HASH_MAX_SIZE=0

2.4.2 Bluetoothカーネルの構成 {#242-bluetooth-kernel-configuration}

Synopsys (AMPAK) および Infineon (Azurewave/CY) モジュールは、カーネルのデフォルト CONFIG_BT_HCIUART ドライバーを使用します。Realtek は、対応するドライバソースコードディレクトリーを持つ独自の hci uart/hci_usb ドライバーを使用します。

external\rkwifibt\realtek\bluetooth_uart_driver
external\rkwifibt\realtek\bluetooth_usb_driver

ロードはコモードで、Realtek Bluetooth を使用する場合は、カーネルの CONFIG_BT_HCIUART 設定をオフにすることが重要です! #CONFIG_BT_HCIUART はカーネルの設定を設定していません。

CONFIG_BT=y
CONFIG_BT_BREDR=y
CONFIG_BT_RFCOMM=y
# CONFIG_BT_RFCOMM_TTY is not set
# CONFIG_BT_BNEP is not set
CONFIG_BT_HIDP=y
# CONFIG_BT_HS is not set
CONFIG_BT_LE=y
CONFIG_BT_DEBUGFS=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y

3. . Wi-Fi/BTフレームワークとコンパイル手順 {#3-wi-fibt-framework-and-compilation-instructions}

3.1 コンパイルファイル {#31-compilation-files}

Wi-Fi/BT に関与するファイルは、以下に記述します。

external/rkwifibt/drivers/
bcmdhd                          #Common driver of Synopsys/AMPAK modules
infineon                        #Common driver of Infineon (Cypress Azurewave)
modules
rtlxxx                          #Realtek modules are special, each model has a
separate driver
bluetooth_uart_driver           #UART interface driver of RTK's Bluetooth
bluetooth_usb_driver            #USB interface driver RTK's Bluetooth
bin/arm*/                       #Pre-installed vendor's bin tools, wl is AMPAK
module configuration tool, rtwpriv is rtk module's test tool
conf/*conf                      #Pre-configured wpa_supplicant.conf/dnsmasq.conf
for STA/AP mode
tools/brcm_tools rtk_hciattach  #Bluetooth initialization tools from various
manufacturers
debian wifibt-init.service      #Component for the Debian system
S36wifibt-init.sh script/*sh    #Wi-Fi/BT initialization scripts of Buildroot
system, including connection tests, etc.
firmware/*                      #Wi-Fi/BT firmware files for each manufacturer's
respective models

AMPAK/Infineon モデルの対応するWi-Fi/BTファームウェア名は次のとおりです。

├── AP6212A1
│   ├── bt                          #Bluetooth firmware
│   │   └── BCM43430A1.hcd
│   └── wifi                        #Wi-Fi firmware
│       ├── fw_bcm43438a0.bin
│       ├── fw_bcm43438a1.bin
│       ├── fw_bcm43438a1_mfg.bin
│       ├── nvram_ap6212a.txt
│       └── nvram_ap6212.txt
├── AP6236
│   ├── bt
│   │   └── BCM43430B0.hcd
│   └── wifi
│       ├── fw_bcm43436b0.bin
│       ├── fw_bcm43436b0_mfg.bin
│       └── nvram_ap6236.txt
├── AW-CM256
│   ├── bt
│   │   └── BCM4345C0.hcd
│   └── wifi
│       ├── fw_cyw43455.bin
│       └── nvram_azw256.txt
└── AW-NB197
    ├── bt
    │   └── BCM43430A1.hcd
    └── wifi
        ├── fw_cyw43438.bin
        └── nvram_azw372.txt

Realtek BT UART / USBドライバとファームウェア: (注意: Realtek Wi-Fiはファームウェアファイルを必要としません、Bluetoothのみ)

external/rkwifibt/drivers/bluetooth_uart_driver/    #Bluetooth UART driver
external/rkwifibt/drivers/bluetooth_usb_driver/     #Bluetooth USB driver
external/rkwifibt/tools/rtk_hciattach/              #Bluetooth initialization
program

external/rkwifibt/firmware/realtek/RTL8723DS/
rtl8723d_config                                     #Bluetooth config for 8723DS
rtl8723d_fw                                         #Bluetooth fw for 8723DS

3.2 コンパイルルール {#32-compilation-rules}

開発者は、以下のコンパイルスクリプトを注意深く読み込むことをお勧めしています! 対応するコンパイルルールファイルは2つの部分に分けられます: ドライバーコンパイル

/*
 * It includes the compilation of drivers, WiFiBT's ko, and the copying of
firmware:
 * 1. ./build.sh or ./build.sh wifibt will call the following scripts
 * 2. The scripts will compile the drivers under the
external/rkwifibt/drivers/directory
 * and copy the corresponding firmware files to the file system
 */
device/rockchip/common/scripts/mk-wifibt.sh
device/rockchip/common/scripts/post-wifibt.sh

ツールのコンパイル(brcm_patchram_plus1/rtk_hciattachを含む)

# Compilation Rules
buildroot/package/rockchip/rkwifibt/Config.in       # The rules are the same as
the regular Kconfig
buildroot/package/rockchip/rkwifibt/rkwifibt.mk     # Similar to a Makefile

# Bluetooth initialization tool compilation and copying, updated by ./build.sh or
make rkwifibt-rebuild
external/rkwifibt/meson.build

Note: 上記のmkファイルのコンパイル/コピープロセスを含む、rkwifibt-rebuildのコンパイル時に印刷されたログ出力を読み、コンパイルエラー/コピーの問題を分析し、解決するのに役立つことが重要です。

3.3 Wi-Fi/BT ファイルとその場所 {#33-wi-fibt-files-and-their-locations}

開発者はWi-Fi/BTで使われるファイルや場所に精通している必要があります。 Wi-Fi/BT 起動の問題に異常に遭遇する場合、Wi-Fi/BT ファームウェア/コンフィグファイルの存在確認や、Bluetooth モデルにマッチするかどうかの確認が必要です。 たとえば、AP6255 を SDK の Wi-Fi/BT ファームウェアの場所として取得します。

external/rkwifibt/firmware/broadcom/AP6255/
├── bt
│   └── BCM4345C0.hcd
└── wifi
    ├── fw_bcm43455c0_ag.bin
    ├── fw_bcm43455c0_ag_mfg.bin
    └── nvram_ap6255.txt

コンパイルルールに従ってコンパイルした後、対応するファイルはプロジェクトの出力ディレクトリにコピーされます。(system/vendorは同じディレクトリへのリンクです)

buildroot/output/rockchip_rk3xxxx/target/
# After burning the files to the device, the following files should be available,
otherwise, troubleshoot the configuration and compilation issues!!!
$ ls
/system(vendor)/lib/modules/bcmdhd.ko               # Driver ko (if compiled as
ko)
/system(vendor)/etc/firmware/fw_bcm43455c0_ag.bin   # Driver firmware file
location
/system(vendor)/etc/firmware/nvram_ap6255.txt       # Driver nvram file location
/system(vendor)/etc/firmware/BCM4345C0.hcd          # Bluetooth firmware file (if
Bluetooth functionality is present)

Realtekモジュール、例としてRTL8723DS / RTL8821CUを取っている。 SDKのWi-Fi / BTファームウェアの場所:

external/rkwifibt/firmware/realtek$ tree
├── RTL8723DS
│   ├── mp_rtl8723d_config  # Bluetooth test config, obtain from the manufacturer
│   ├── mp_rtl8723d_fw      # Bluetooth test firmware, obtain from the
manufacturer
│   ├── rtl8723d_config     # Bluetooth config
│   └── rtl8723d_fw         # Bluetooth firmware
├── RTL8821CU
│   ├── rtl8821cu_config    # Bluetooth config
│   └── rtl8821cu_fw        # Bluetooth firmware
├── bluetooth_uart_driver   # Bluetooth UART driver for RTL8723DS, compiled into
hci_uart.ko
├── bluetooth_usb_driver    # Bluetooth USB driver for RTL8821CU, compiled into
rtk_btusb.ko
├── rtk_hciattach           # Bluetooth initialization program rtk_hciattach,
used only for UART interface BT, USB not required

コンパイル後、対応するファイルはプロジェクト出力ディレクトリにコピーされます。

buildroot/output/rockchip_rk3xxxx/target/

# After burning the files to the device, the following files should be available,
troubleshoot the configuration and compilation issues!!!
$ ls
/system(vendor)/lib/modules/8723ds.ko   # Driver ko (if compiled as ko)
/system(vendor)/lib/modules/8821cu.ko   # Driver ko (if compiled as ko)
/usr/bin/rtk_hciattach                  # Bluetooth initialization program (UART
interface only)
/usr/lib/modules/hci_uart.ko            # UART Bluetooth ko
/usr/lib/modules/rtk_btusb.ko           # USB Bluetooth ko

# Remember that: for UART interface Bluetooth, firmware files will be copied to
the /lib/firmware/rtlbt/ directory
/lib/firmware/rtlbt/rtl8723d_config     # Bluetooth normal function fw/config
/lib/firmware/rtlbt/rtl8723d_fw

# Remember that: for USB interface Bluetooth, firmware files will be copied to
the /lib/firmware/ directory
/lib/firmware/rtl8821cu_config          # Bluetooth normal function fw/config
/lib/firmware/rtl8821cu_fw

3.4 コンパイル更新 {#34-compilation-update}

コンパイルコマンドは以下のようになります。

# Rule: Prioritize the compilation parameters specified on the command line, if
no parameters are specified, they will be obtained from BoardXXX.mk
$ ./build.sh

# or
$ ./build.sh wifibt

# Packaging
$ ./build.sh rootfs && ./build.sh firmware

Note: コンパイルプロセス全体を見るために./build.sh wifibtの出力を観察します。

3.5 Wi-Fi/BT 操作手順 {#35-wi-fibt-operation-instructions}

開発者は、トラブルシューティングの問題に重要な次の3つのスクリプトの内容に精通する必要があります! Wi-Fi/BT の起動ルールは以下の通りです。

# booting script process:
# /etc/init.d/S36wifibt-init.sh
#  -> wifibt-init.sh
#    -> wifibt-util.sh
external/rkwifibt/scripts/S36wifibt-init.sh

external/rkwifibt/scripts/
# Automatically identify the Wi-Fi/BT model based on VID/PID
wifibt-util.sh

# Load the WiFi ko based on the identified model above and initialize Bluetooth
wifibt-init.sh #start_wifibt/start_bt_brcm/start_bt_rtk_usb&uart etc.

4. . Wi-Fi/BTハードウェアおよびソフトウェア機能テスト {#4-wi-fibt-hardware-and-software-functional-testing}

4.1 ビルドルートシステム {#41-buildroot-system}

4.1.1 Wi-Fi STA テスト {#411-wi-fi-sta-testing}

ドライバーをロードします。通常、 ifconfig -a は wlan0 を表示します。 insmod bcmdhd.ko/RTL8723DS.ko は、WLAN0 の設定を有効にします。 起動 wpa_supplicant wpa_supplicant -B -i wlan0 -c /data/cfg/wpa_supplicant.conf 設定ファイル解析:

# ctrl_interface interface configuration
# If there are any modifications, the corresponding -p parameter of wpa_cli
command should be modified accordingly: wpa_cli –i wlan0 –p <ctrl_interface> xxx
$ vi /data/cfg/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant  # It is not recommended to change by
default!
ap_scan=1
update_config=1 # This configuration allows the hotspot configured by the wpa_cli
command to be saved to the conf file (wpa_cli save_config)

# AP configuration items
network={
    ssid="WiFi-AP"       # Wi-Fi name
    psk="12345678"       # Wi-Fi password
    key_mgmt=WPA-PSK     # Encryption configuration, change to key_mgmt=NONE for
no encryption
}

注意: wpa_supplicant.confファイルは、実際に使用したプラットフォームの保存場所に応じて変更する必要があります。 無効なWi-Fi ifconfig wlan0ダウンキラーwpa_supplicant

4.1.2 近傍APのスキャン {#412-scanning-for-nearby-aps}

wpa_cli コマンドは wpa_supplicant プロセスと通信するため、wpa_supplicant プロセスが実行されていることを確認してください。

wpa_cli -i wlan0 -p /var/run/wpa_supplicant scan
wpa_cli -i wlan0 -p /var/run/wpa_supplicant scan_results

Wi-Fi / BT(無線LAN)

Note: スキャンしたホットスポットの数が、周囲のルータのおよそ数に一致するかを確認し、モバイルデバイスでWi-Fiスキャンと比較します(お客様のモジュールが5G Wi-Fiをサポートしていない場合は、2.4G Wi-Fiの回数だけを比較します)。 また、テスターに最も近いルータの信号強度を検証します。 ルータがテスターに非常に近いが、信号強度は非常に弱い(典型的に、良好:-20〜-50、わずか弱く許容:-50〜-70、貧しい:-70〜-90)、無線LANモジュールがアンテナに接続されているかどうか、モジュールのRF仕様が準拠しているかどうかを確認する必要があります。 Wi-Fi/BTハードウェアRF仕様を参照。

4.1.3 ルーターに接続 {#413-connect-to-router}

設定ファイルを修正

# Add network configuration item in wpa_supplicant.conf
network={
    ssid="WiFi-AP"        # Wi-Fi Name
    psk="12345678"        # Wi-Fi Password
    key_mgmt=WPA-PSK      # Encryption configuration, change to key_mgmt=NONE for
no encryption
}

# Reload the above configuration for the wpa_supplicant process with the
following command:
wpa_cli -i wlan0 -p /var/run/wpa_supplicant reconfigure

# Initiate connection:
wpa_cli -i wlan0 -p /var/run/wpa_supplicant reconnect

# Connection Information
wpa_cli -i wlan0 -p /var/run/wpa_supplicant status
bssid=04:42:1a:b4:e7:7c
freq=5805
ssid=wwc3
id=0
mode=station
wifi_generation=6
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=SAE
pmf=2
mgmt_group_cipher=BIP
sae_group=19
sae_h2e=0
sae_pk=0
wpa_state=COMPLETED
ip_address=192.168.50.169
address=d4:9c:dd:f5:52:c4
uuid=47ed7266-da34-5c0b-884a-4fcc17648d87
ieee80211ac=1

4.2 Wi-Fi APホットスポット検証 {#42-wi-fi-ap-hotspot-verification}

SDK は、関連するプログラムを統合し、softapDemo apName (デフォルトでは暗号化なしの apName というホットスポットを起動するには)、ホットスポットモードをアクティブにすることができます。 コードとコンパイルされたファイルの場所は、次のとおりです。

/external/softapDemo/src/main.c
buildroot/package/rockchip/softap/Config.in softap.mk
make softap-dirclean
make softap

softapDemoソースコードが見つからない場合は、次のアドレスから外部ディレクトリへダウンロードできます。

https://github.com/rockchip-linux/softapServer

Realtekモジュール:Softap関数でp2p0を使用し、カーネルのドライバ構成でp2p0を生成します。 p2p0 ノードがない場合、設定は こちら をご覧ください。

+++ b/drivers/net/wireless/rockchip_wlan/rtl8xxx/Makefile
@@ -1593,7 +1593,7 @@ endif
ifeq ($(CONFIG_PLATFORM_ARM_RK3188), y)
EXTRA_CFLAGS += -DCONFIG_PLATFORM_ANDROID
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE

AMPAK/Azurewave モジュール:wlan1をsoftap関数として使用し、wlan1ノードを生成するためにiwコマンドを使用します。 iw phy0インターフェイスはwlan1型管理されたデバッグとカスタマイズ修正を追加します。

// Here you can add encryption, modify IP addresses, and DNS, etc., which can be
modified by yourself
int wlan_accesspoint_start(const char* ssid, const char* password)
{
    // Create softap hotspot configuration
    create_hostapd_file(ssid, password);
    // softap_name: wlan1/p2p0
    sprintf(cmdline, "ifconfig %s up", softap_name);
    // Set custom IP address
    sprintf(cmdline, "ifconfig %s 192.168.88.1 netmask 255.255.255.0",
softap_name);

    // Create a configuration file for the DHCP address pool
    creat_dnsmasq_file();
    int dnsmasq_pid = get_dnsmasq_pid();
    if (dnsmasq_pid != 0) {
        memset(cmdline, 0, sizeof(cmdline));
        sprintf(cmdline, "kill %d", dnsmasq_pid);
        console_run(cmdline);
    }
    memset(cmdline, 0, sizeof(cmdline));
    // Use dnsmasq as a DHCP server to assign IP addresses to devices
    sprintf(cmdline, "dnsmasq -C %s --interface=%s", DNSMASQ_CONF_DIR,
softap_name);
    console_run(cmdline);

    memset(cmdline, 0, sizeof(cmdline));
    // Start softap hotspot mode
    sprintf(cmdline, "hostapd %s &", HOSTAPD_CONF_DIR);
    console_run(cmdline);
    return 1;
}

// Create a DHCP configuration file, which must be consistent with your custom IP
address, otherwise, it will cause the mobile phone to be unable to obtain an IP
bool creat_dnsmasq_file()
{
    FILE* fp;
    fp = fopen(DNSMASQ_CONF_DIR, "wt+");
    if (fp != 0) {
        fputs("user=root\n", fp);
        fputs("listen-address=", fp);
        fputs(SOFTAP_INTERFACE_STATIC_IP, fp);
        fputs("\n", fp);
        fputs("dhcp-range=192.168.88.50,192.168.88.150\n", fp);
        fputs("server=/google/8.8.8.8\n", fp);
        fclose(fp);
        return true;
    }
    DEBUG_ERR("---open dnsmasq configuration file failed!!---");
    return false;
}

// Create an AP hotspot configuration file, which can be consulted with the Wi-Fi
manufacturer, and the parameters here are greatly related to the chip
specifications
int create_hostapd_file(const char* name, const char* password)
{
    FILE* fp;
    char cmdline[256] = {0};
    fp = fopen(HOSTAPD_CONF_DIR, "wt+");

    if (fp != 0) {
        sprintf(cmdline, "interface=%s\n", softap_name);
        fputs(cmdline, fp);
        fputs("ctrl_interface=/var/run/hostapd\n", fp);
        fputs("driver=nl80211\n", fp);
        fputs("ssid=", fp);
        fputs(name, fp);
        fputs("\n", fp);
        fputs("channel=6\n", fp);  // Channel setting
        fputs("hw_mode=g\n", fp);  // 2.4/5G configuration
        fputs("ieee80211n=1\n", fp);
        fputs("ignore_broadcast_ssid=0\n", fp);
#if 0  // If encryption is chosen, modify here
        fputs("auth_algs=1\n", fp);
        fputs("wpa=3\n", fp);
        fputs("wpa_passphrase=", fp);
        fputs(password, fp);
        fputs("\n", fp);
        fputs("wpa_key_mgmt=WPA-PSK\n", fp);
        fputs("wpa_pairwise=TKIP\n", fp);
        fputs("rsn_pairwise=CCMP", fp);
#endif
        fclose(fp);
        return 0;
    }
    return -1;
}

int main(int argc, char **argv)
    // According to the Wi-Fi model, set the corresponding hotspot interface. The
4.4 kernel can automatically obtain the Wi-Fi model through the
"/sys/class/rkwifi/chip" node,
    // but the kernel version 4.19 and later does not have this node, and the Wi-
Fi model can be determined in the following way
    // AMPAK/Azurewave: Check for the directory sys/bus/sdio/drivers/bcmsdh_sdmmc
    // Realtek: Check for the directory sys/bus/sdio/drivers/rtl8723ds
    if (!strncmp(wifi_type, "RTL", 3))
        strcpy(softap_name, "p2p0"); // Realtek uses p2p0
    else
        strcpy(softap_name, "wlan1"); // AMPAK/Azurewave uses wlan1

    ... ...
    if (!strncmp(wifi_type, "RTL", 3)) {
        // Realtek module automatically generates the p2p0 node after enabling
coexistence mode
        console_run("ifconfig p2p0 down");
        console_run("rm -rf /userdata/bin/p2p0");
        wlan_accesspoint_start(apName, NULL);
    } else {
        console_run("ifconfig wlan1 down");
        console_run("rm -rf /userdata/bin/wlan1");
        console_run("iw dev wlan1 del");
        console_run("ifconfig wlan0 up");
        // AP module needs the iw command to generate the wlan1 node for softap
use
        console_run("iw phy0 interface add wlan1 type managed");
        wlan_accesspoint_start(apName, NULL);
    }

コマンドを実行した後、携帯電話のWi-Fi設定インターフェイスで対応するAPを見ることができます。 問題がない場合:まず、上記の設定ファイルが正しく設定されていることを確認してください。 ifconfig が wlan1 または p2p0 ノードを見たかどうかを確認します。 hostapd/dnsmasq プロセスが正常に起動しているか確認してください。

4.3 BT検証テスト {#43-bt-verification-test}

まず、dts/Buildroot が正しく設定されていることを確認してください。セクション 2/3/7.2 を参照してください。 BTモジュールの2つの一般的なタイプに関する説明を説明します。 正しい設定で、システムは bt_pcba_test というスクリプト(または最新の SDK では、bt_init.sh というスクリプト)を生成します。 REALTEKモジュール

# UART Interface:
/ # cat usr/bin/bt_pcba_test (bt_init.sh)
#!/bin/sh

killall rtk_hciattach

echo 0 > /sys/class/rfkill/rfkill0/state   # Power down
echo 0 > /proc/bluetooth/sleep/btwrite
sleep 1
echo 1 > /sys/class/rfkill/rfkill0/state   # Power up
echo 1 > /proc/bluetooth/sleep/btwrite
sleep 1
insmod /usr/lib/modules/hci_uart.ko           # REALTEK module requires loading
the UART driver
rtk_hciattach -n -s 115200 /dev/ttyS4 rtk_h5 &   # The blue reference indicates
which UART port the Bluetooth is using

# Note: Kill the rtk_hciattach process before starting the test each time.

# Note: For USB interface Bluetooth, there is no sh script. Execute the following
manually:
echo 0 > /sys/class/rfkill/rfkill0/state   # Power down
echo 0 > /proc/bluetooth/sleep/btwrite
sleep 1
echo 1 > /sys/class/rfkill/rfkill0/state   # Power up
echo 1 > /proc/bluetooth/sleep/btwrite
sleep 1
insmod /usr/lib/modules/rtk_btusb.ko          # REALTEK module requires loading
the USB driver

AMPAK/Azurewaveモジュール

/ # cat usr/bin/bt_pcba_test (bt_init.sh)
#!/bin/sh

killall brcm_patchram_plus1

echo 0 > /sys/class/rfkill/rfkill0/state  # Power down
echo 0 > /proc/bluetooth/sleep/btwrite
sleep 2
echo 1 > /sys/class/rfkill/rfkill0/state  # Power up
echo 1 > /proc/bluetooth/sleep/btwrite
sleep 2

brcm_patchram_plus1 --bd_addr_rand --enable_hci --no2bytes --
use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram
/system/etc/firmware/bcm43438a1.hcd /dev/ttyS4 &

# Note: Kill the brcm_patchram_plus1 process before starting the test each time.

Bcm44338a1.hcd は、BT の対応するモデルのファームウェアファイルを表します。 /dev/ttyS4 は、UART ポートが Bluetooth を使用していることを示します。 注:rtk_hciattach、hci_uart.ko、bcm43438a1.hcdなどのファイルは、セクション2で説明されているBuildroot設定で正しいWi-Fi / BTモジュールが選択されている場合にのみ生成されます。 これらのファイルが欠落している場合は、設定(セクション3)を参照してください。 スクリプトを実行した後、次のように実行します。注記: hciconfig コマンドが利用できない場合は、ビルドルートの設定で BR2_PACKAGE_BLUEZ5_UTILS を選択し、hciconfig の hciconfig を hci0 でテストするためのコンパイルと更新を行います。通常、次のコマンドは使用可能です。

Wi-Fi / BT(無線LAN)

BTスキャン:hcitoolスキャン

Wi-Fi / BT(無線LAN)

異常な状況については、トラブルシューティングについては7.2項を参照してください。

4.4 LAN(WoL)のWi-Fiウェイク {#44-wi-fi-wake-on-lan-wol}

現在、Wi Fi はネットワークのウェイクアップ機能をサポートしています。つまり、デバイスが Access Point (AP) に接続され、IP アドレスを取得したら、デバイスがスリープ状態になった後に無線ネットワークパケット(ping)で呼び覚醒できます。 一般的なルールは、デバイスに送信されたネットワークパケットがシステムを目覚めさせることができることです。 wpa_supplicant.confファイルを修正し、次の設定を追加します。

wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
update_config=1
ap_scan=1
+wowlan_triggers=any # Add this configuration

Realtek Wi-Fi の場合、対応する Makefile の次の設定をドライバーにチェックしてください。

kernel/drivers/net/wireless/rockchip_wlan/rtl8xxx/Makefile
+CONFIG_WOWLAN = y
+CONFIG_GPIO_WAKEUP = y

DTS 構成: スキーマティックスが WIFI_WAKE_HOST (または WL_HOST_WAKE) PIN が SoC に接続されていることを確認し、次の DTS 設定が正しいことを確認します。

WIFI,host_wake_irq = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;

システムとWi-Fi睡眠をテストします。

dhd_priv setsuspendmode 1  # Only for AMPAK Azurewave modules, Realtek does not
require this command
echo mem > /sys/power/state

この場合、同じローカルエリアネットワーク内のデバイスは、このデバイスをpingすることができます。通常、システムが目覚めされていることがわかります。 システムが起きた後、通常の作業状態のWi-Fiを復元する必要があります。

dhd_priv setsuspendmode 0 # Only for AMPAK Azurewave modules, Realtek does not
require this command

トラブルシューティング: 想定通りシステムが起きていない場合は、Washion pinが正しく設定されているか、電圧レベルが正しいか、32.768kがオフになっているかを確認してください。

4.5 Wi-Fiモニターモード {#45-wi-fi-monitor-mode}

AMPAK/Azurewave Wi-Fi の使い方

# Set the monitor channel:
dhd_priv channel 6  // channel numbers

# Enable monitor mode:
dhd_priv monitor 1

# Disable monitor mode:
dhd_priv monitor 0

Realtek Wi-Fi の

# The driver Makefile needs to enable:
+ CONFIG_WIFI_MONITOR = y

# Bring up wlan0 and bring down p2p0
ifconfig wlan0 up
ifconfig p2p0 down

# Enable monitor mode
iwconfig wlan0 mode monitor
or
iw dev wlan0 set type monitor

# Switch to a specific channel
echo "<chan> 0 0" > /proc/net/<rtk_module>/wlan0/monitor // <rtk_module> is the
Realtek Wi-Fi module name, such as rtl8812au, rtl8188eu, etc.

4.6 Wi-Fi P2P 検証 {#46-wi-fi-p2p-verification}

# Create a new configuration file: p2p_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
update_config=1
device_name=p2p_device_name
device_type=10-0050F204-5
config_methods=display push_button keypad virtual_push_button physical_display
p2p_add_cli_chan=1
pmf=1
# Start: (kill the previous one first)
wpa_supplicant -B -i wlan0 -c /tmp/p2p_supplicant.conf
wpa_cli
> p2p_find
>

# At this point, open the P2P on the mobile device and you can search for the
device name specified above as device_name=p2p_device_name and click to connect

# At this point, the device side will display // Below is the test mobile device
> <3>P2P-PROV-DISC-PBC-REQ 26:31:54:8e:14:e7 p2p_dev_addr=26:31:54:8e:14:e7
pri_dev_type=10-0050F204-5 name='www' config_methods=0x188 dev_capab=0x25
group_capab=0x0

# The device side responds and sends a connection command, make sure the MAC
address matches the one above
>p2p_connect 26:31:54:8e:14:e7 pbc go_intent=1

> p2p_connect 26:31:54:8e:14:e7 pbc go_intent=1
OK
<3>P2P-FIND-STOPPED
<3>P2P-GO-NEG-SUCCESS role=client freq=5200 ht40=0 peer_dev=26:31:54:8e:14:e7
peer_iface=26:31:54:8e:94:e7 wps_method=PBC
<3>P2P-GROUP-FORMATION-SUCCESS
<3>P2P-GROUP-STARTED p2p-wlan0-2 client ssid="DIRECT-24-www" freq=5200
psk=3d67671b71f7a171118c1ace34ae5e4bcc8e17394394e258be91f55b7ab63748
go_dev_addr=26:31:54:8e:14:e7 [PERSISTENT]
> # At this point, the connection is successful
> quit

ifconfig
p2p-wlan0-2 Link encap:Ethernet  HWaddr 82:C5:F2:2E:7F:89
          inet addr:192.168.49.220  Bcast:192.168.49.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500   Metric:1
          RX packets:470 errors:0 dropped:0 overruns:0 frame:0
          TX packets:344 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:71779 (70.0 KiB)  TX bytes:33829 (33.0 KiB)
# It can be seen that the device is connected to the mobile phone, and if they
can ping each other, it indicates that it is normal.

4.7 ネットワーク カードのブリッジング機能 {#47-network-card-bridging-function}

シナリオ: Wi-Fi は、アクセス可能な AP に接続するために wlan0 を開始し、セクション 4.2 と組み合わせて、それはホットスポットとして wlan1 または p2p0 を開始します。これにより、スマートフォンがホットスポットに接続し、インターネットにアクセスすることができます。 設定は以下のようにして、カーネルには次の設定が有効になっています。

+CONFIG_NETFILTER=y
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_TABLES=y
+CONFIG_NF_TABLES_INET=y
+CONFIG_NF_CONNTRACK_IPV4=y
+CONFIG_IP_NF_IPTABLES=y
+CONFIG_IP_NF_NAT=y
+CONFIG_IP_NF_TARGET_MASQUERADE=y
+CONFIG_BRIDGE=y

次の2つのコマンドを実行し、IPアドレスが softap を起動する際に設定されているコマンドで実行します。

iptables -t nat -A POSTROUTING -s 192.168.43.0/24 -o wlan0 -j MASQUERADE
echo "1" > /proc/sys/net/ipv4/ip_forward

4.8 Wi-Fi/BTハードウェアRFの指定 {#48-wi-fibt-hardware-rf-specifications}

4.8.1 アイテムのテスト {#481-testing-items}

4.8.2 Wi-Fi/BT セクション {#482-wi-fibt-section}

のような: 送信力、EVM、水晶頻度偏差、受信機の感受性、等。 例:(b/g/n/ac)

Wi-Fi / BT(無線LAN)

802.11b/20 MHz/11 Mbps/アンテナ0

メトリック ユニット CH1 CH7 CH13 仕様
導電力 dBm 17.17 16.86 17.21 <20 dBm
スペクトラムマスクを送信します GHzの パス パス パス  
変調精度の送信 dB / % 6.65% 5.91% 4.26% <35%;ピーク検出
トランスミットの中心の頻度許容 ppmの 6.65 5.91 5.27 ±10 ppm; 10 ppm の証拠
受信機の最低の入力レベル感受性 dB -84 -83 -82 -78;2 dBの証拠金
受信機の最高入力レベル dBm       » -10 dBm

4.8.3 アンテナ セクション {#483-antenna-section}

パッシブS11とデバイス内のWi-FiアンテナのアクティブOTAテスト例:

Wi-Fi / BT(無線LAN)

Wi-Fi 2G TRP(無線LAN)

モード チャンネル 頻度(MHz) Tx平均(dBm) 感受性平均(dBm)
80211b: 11MBpsの 1 2412 11.12 -80.8
80211b: 11MBpsの 7 2442 14.39 -80.62
80211b: 11MBpsの 13 2472 13.79 -80.54
容量:80211g 54MBps 1 2412 12.4 -67.25
容量:80211g 54MBps 7 2442 15.07 -66.49
容量:80211g 54MBps 13 2472 14.45 -65.66

上記試験を正式に整理する。

4.8.4 ツールとメソッドのテスト {#484-testing-tools-and-methods}

下記のPDF/TXTドキュメントは、docs/linux/wifibtディレクトリにあります。 お客様が専門の試験装置を持っていなかったり、テストについての質問がなければ、サポートのためのモジュールの製造業者に連絡して下さい。 ICOmm-semi/altobeam/AICなどの他のプラットフォームでは、対応するモジュールメーカーやオリジナルの機器メーカーを探し、テストツールや方法を探してください。

4.8.4.1 Realtekのテスト {#4841-realtek-testing}

一般的に、COBとモジュールの2種類に分けられます。 モジュールは通常モジュールメーカーによって厳密にテストされ、デフォルトで内部のヒューズに予備燃焼された口径測定データが付属しています。 お客様が、パフォーマンスインジケータが適格であるかをテストし、検証する必要があります。 しかし、COBはWi-Fi周辺回路の設計とコンポーネントの追加を必要としますので、完全なRF校正試験のためにRealtekと連携し、校正データをチップのヒューズに統合したり、ドライバーを介してロードしたりする必要があります。 詳しくは、モジュールメーカーに直接ご相談ください。 Wi-Fi のテスト

Refer to the Quick_Start_Guide_V6.txt, pay special attention to the command
iwpriv which should be uniformly replaced with rtwpriv.

BTテストは「linux20180319.pdfのためのMPツールユーザーガイド」を参照してください(特定のテストコンテンツのモジュールメーカーやベンダーにご相談ください)。 テストでは、テスト用のモジュールメーカーが提供する専用のBluetoothファームウェアファイルが必要であることに注意することが重要です。また、指定されたディレクトリにBluetoothインジケータをテストする必要があります。

# Note: Before performing the test, please turn on the BT power
echo 0 > sys/class/rfkill/rfkill0/state
echo 0 > /proc/bluetooth/sleep/btwrite
sleep 1
echo 1 > sys/class/rfkill/rfkill0/state
echo 1 > /proc/bluetooth/sleep/btwrite
# Special attention: The rtk_hciattach process should not run, if it does, please
terminate it with killall rtk_hciattach

///////////
/ #
/ # rtlbtmp
:::::::::::::::::::::::::::::::::::::::::::::::::
:::::::: Bluetooth MP Test Tool Starting ::::::::

>
>
>enable uart:/dev/ttyS4   # Note: ttySX corresponds to the actual hardware
connected uart port
>
>> > enable[Success:0]
4.8.4.2 Synopsys/Infineon チップテスト {#4842-synopsysinfineon-chip-testing}

Wi-Fi は、まずテストファームウェアと交換する必要があります。各AP モジュールは、次のような異なるテストファームウェアに対応しています。

AP6236 -> fw_bcm43436b0_mfg.bin
AP6212A -> fw_bcm43438a1_mfg.bin

fw_bcmxxx_mfg.bin と APxxxx はモジュールモデルにマッチしなければなりません。そうしないとテストできません! そのため、まず対応するモデルのテストファームウェアがないか確認し、そうでなければモジュールメーカーから入手してください。 最新のSDKは、サポートされているモデル用のテストファームウェアを内蔵しているため、組み込みのテストスクリプトを使用して、Wi-FiをRFテストモードに投入します。

external\rkwifibt\wifi_ap6xxx_rftest.sh
#!/bin/sh
killall ipc-daemon netserver connmand wpa_supplicant

# Reset
echo 0 > /sys/class/rfkill/rfkill0/state
sleep 1
echo 1 > /sys/class/rfkill/rfkill1/state
sleep 1

# Set to update the test firmware
echo /vendor/etc/firmware/fw_bcmdhd_mfg.bin >
/sys/module/bcmdhd/parameters/firmware_path
sleep 1

# Restart wlan0
ifconfig wlan0 down
ifconfig wlan0 up
sleep 1
# Confirm whether it has entered the test mode
echo "wl ver"
wl ver

外部SDKはテストファームウェアを内蔵していないため、以下の例を参照してください。

# AP6236
# Push fw_bcm43436b0_mfg.bin to the data or other writable partition, then
execute the following commands: (Note the path below)
mount --bind /data/fw_bcm43436b0_mfg.bin /system/etc/firmware/fw_bcm43436b0.bin
ifconfig wlan0 down
ifconfig wlan0 up
wl ver

# CYW43438
echo /data/cyw43438-7.46.58.25-mfgtest.bin >
/sys/module/cywdhd/parameters/firmware_path
ifconfig wlan0 down
ifconfig wlan0 up
wl ver

正しく実行すると、wl ver を実行すると、テストモードに入力したことを示して、「WL_TEST」文字を含む文字列が印刷されます。 詳細なテストについては、以下を参照してください。

Wi-Fi RF Test Commands for Linux-v03.pdf

Bluetooth テスト 実行後 bt_init.sh スクリプト (SDK 組み込みスクリプト、セクション 3.3) を実行した後、次の操作を実行します。(注記: hciconfig コマンドが利用できない場合は、ビルドルート設定で BR2_PACKAGE_BLUEZ5_UTILS を選択してテストをコンパイルおよび更新してください)

hciconfig hci0 up
hciconfig -a

hci0 ノードが現れた場合、初期化が完了していることを示します。 現れないと、次の2つの可能性があります。

  1. Bluetooth DTS の設定は異常なもの、またはハードウェア異常なもの、または UART ポート構成が誤って、初期化が失敗する原因です。
  1. Bluetooth ファームウェアのファイル構成が誤りまたはファイルが欠落しています。上記の 2 つの問題については、BT 関連のトラブルシューティングのセクション 2/3 を参照してください。特定のテスト手順については、以下を参照してください。
BT RF Test Commands for Linux-v05.pdf #The test steps 1/2 are already executed in
the script, no need to execute them again

4.9 Wi-Fi パフォーマンステスト {#49-wi-fi-performance-testing}

iperfを使用してパフォーマンスをテストするために、注意してください。 2つのポイント影響性能 それは、Wi-Fi RFのテストを完了し、OTAテストをアンテナにし、メトリックがパフォーマンスをテストする前に正常であることを確認することが不可欠です。 そうでなければ、それは意味がありません。 重要なデータ変動が観察される場合は、オープンスペースや地下室などの干渉を最小限に抑えて、位置確認を行ってください。 試験環境 開放的な環境の干渉が高レベルなため、シールドルーム環境でテストすることを推奨し、Wi-FiがAPに正常に接続できることを確実にし、IPアドレスを取得できます。 試験ポイント スループットのサイズ、および安定性および任意の変動。 ルータチャンネルテストは、チャネル1/6/11のような低、中、高チャンネルで行われるべきです:テストコマンドは、詳細な手順iPerf - iPerf3とiPerf2ユーザードキュメントiperf2 / iperf3(es.net)注記のためにリンクされた文書を参照してください。ボードのiperfコマンドは、ビルドルートで構成する必要があります:BR2_PACKAGE_IPERF = y BR2_PACKAGE_IPERF3 = y 98 7004789 = y

5. .. Wi-Fi/BT トラブルシュート {#5-wi-fibt-troubleshooting}

重要:ログを常に確認し、ログに基づいて異常をトラブルシューティング! Wi-Fi/BT の問題は、一般的に 3 つのタイプに分類することができます: SDIO/USB/PCIE デバイスが認識されていない; SDIO カードが認識されるが、ファームウェアの読み込みに失敗しました。 パフォーマンスの問題、接続/フィードのスキャン/実行不能な接続など、;

5.1 Wi-Fi識別プロセスの簡単な説明 {#51-brief-description-of-wi-fi-identification-process}

SDIOインターフェイス: 起動中に、カーネルMCフレームワークはSDIOカードを認識し、GPIOをリセットすることによって、dtsのsdio_pwrseqノードのGPIO属性を解析し、GPIOはWL_REG_ONであり、それを高い引きます。 初期化コマンドを SDIO_CLK/CMD/DATA 経由でモジュールに送信します。 当初、SDIO_CLKはWi-Fiモジュールに400/300/200Kの低周波でコマンドを送信し、Wi-Fi SDIOに関する基本的な情報を取得するには、SDIO2.0(最大CLKは50M)または3.0(最大CLKは208M)であり、4本のワイヤや1本のワイヤなどをサポートするかどうかなど。 続いて、対応する仕様により、SDIO_CLK周波数は50M/150Mの対応高周波に増加し、基本初期化が完了します。 次のログが表示されます。

# Note that the number 0 in mmc0 is not fixed, it could also be 0/1/2; ff4a0000:
represents the address of the controller, which is also different from platforms
# Parse the mmc-pwrseq node in the dts, to obtain WL_REG_ON
dwmmc_rockchip ff4a0000.dwmmc: allocated mmc-pwrseq
# Low-frequency initialization
mmc_host mmc0: Bus speed (slot 0) = 400000Hz (... actual 400000HZ div = 0)
# High-frequency operation mode
mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (... actual 50000000HZ div = 0)
# SDIO 2.0
mmc0: new high speed SDIO card at address 0001
# SDIO 3.0
mmcx: new ultra high speed SDR104 SDIO card at address 0001

USB/PCIEインターフェイス: これらの2つのインターフェイスのための同一証明プロセスはより複雑です。 docディレクトリのUSB/PCIE関連のドキュメントを参照してください。 識別が完了したら: USB インターフェイス: 通常認識された場合、 lsusb を実行して次の情報が表示されます。

Bus 001 Device 002: ID 0bda:f179 Realtek Semiconductor Corp. RTL8188FTV
802.11b/g/n 1T1R 2.4G WLAN Adapter

または dmesg | は USB デバイスが認識されているかどうかを確認する usb を grep。 PCIEインターフェイス: 通常認識されている場合、lspciを実行すると、次の情報が表示されます。

0002:21:00.0 Network controller: Broadcom Inc. and subsidiaries Device 449d (rev
02)

注意: 上記の識別プロセスは、ブートプロセス中にすべて実行され、正しいデバイスが認識された後のみ、Wi-Fiドライバが正しくロードされます!

5.2 Wi-Fiの問題のトラブルシューティング {#52-troubleshooting-wi-fi-issues}

Wi-Fi は SDIO インターフェイスです。一般的に 2 つのケースがあります。まず、カーネルのログを次の LOG をチェックして確認します。 もしそうでなければ、SDIOカードが認識されていないことを示します。 そのような問題については、セクション 7.1.1 を参照してください。

mmc0: new high speed SDIO card at address 0001
# or
mmcx: new ultra high speed SDR104 SDIO card at address 0001

LOGでSDIOの正常認識が見られる場合、wlan0は存在せず、または起動に失敗します。

5.2.1 Wi-Fi異常:SDIOは認識しません {#521-wi-fi-abnormality-sdio-not-recognized}

まず第一に、第2章のDTS/KERNEL構成を慎重に再検討することをお勧めします! カーネルのLOGによると、シーケンスでトラブルシューティングを行うには、次の手順に従ってください。

5.2.1.1 測定電圧 {#5211-measure-voltage}

ラベルに従って対応するPINの電圧レベルとCLK周波数を計測して、正しいことを確認します(注:SDIO 3.0モードは1.8Vでなければなりません)。

Wi-Fi / BT(無線LAN)

oscilloscopeを使用してVBAT/VDDIO/WL_REG_ONのタイミングを測定し、次のタイミングの要件を満たしていることを確認してください。

5.2.1.2 タイミングシーケンス {#5212-timing-sequence}

注意: AMPAK モジュールのタイミング要件は次のとおりです。 実際に使用したモジュールのデータシートのタイミング図の要件を確認し、VDDIOのタイミングに特別な注意を払うことが重要です。

Wi-Fi / BT(無線LAN)

5.2.1.3 DTS の WL_REG_ON 構成エラー {#5213-wl_reg_on-configuration-error-in-the-dts}

Wi-Fi はピンを引っ張りません。 高圧または低速の引き抜かれたかどうかを、電圧広さ(1.8/3.3V)が条件を満たしているかどうか確認するために、オシロスコープで波形をテストすることは可能です。連続高と低プルを測定する場合、SDIO初期化は数回再試行するので、通常の状況です。 成功の識別時: WL_REG_ONは高く引っ張り、同一証明が失敗すると、それは低い引きられます;それが低いままなら、それは不正確なDTS構成を示します。 ハードウェア側では、認証が可能な場合は、WL_REG_ONを直接引き出すと、誤ったDTS WL_REG_ON設定も提案します。

mmcX: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div =
0)
mmcX: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div =
0)
mmcX: Bus speed (slot 0) = 100000Hz (slot req 100000Hz, actual 100000HZ div =
0)
5.2.1.4 DTS の WL_REG_ON 構成の間違い {#5214-wl_reg_on-configuration-error-in-the-dts}
5.2.1.5 VDDIO/SDIO/IO パワードメイン {#5215-vddiosdioio-power-domain}

PIN12に供給されるVDDIOは3.3/1.8Vであり、対応するSDIO_CMD/SDIO_DATA0~3は3.3Vか1.8Vでなければなりません。 VDDIO: 供給電圧は DTS の電力ドメイン構成に一致しません(IO の電力ドメイン構成を参照して下さい)。

5.2.1.6 SDIO_CLKのLackingの波形 {#5216-sdio_clk-lacking-waveform}

I/O 電源領域の誤った設定は、CLK の波形がない場合に生じる場合があります。プルアップ抵抗器が CLK ピンに追加され、それなしでテストされているかどうかを確認してください。 CLK 波形はトリガーモードを設定することでキャプチャする必要があります。

5.2.1.7 不十分な電源か過度の電圧の変動 {#5217-insufficient-power-supply-or-excessive-voltage-fluctuation}

VCC_WL/VBAT/VDDIO_SDIO: 不十分な電源か過渡電圧変動

# Realtek Modules
RTL871X: ### rtw_hal_ops_check - Error : Please hook HalFunc.read_chip_version
###
RTL871X: ### rtw_hal_ops_check - Error : Please hook HalFunc.init_default_value
###
5.2.1.8 32.768K {#5218-32768k}

外部クロック参照(外部LPO信号の特性)

パラメータ 仕様 単位
わずかな入力頻度 32.768 kHz
頻度正確さ ± 30 ppmの
デューティーサイクル 30 - 70 %
入力信号の広さ 400から1800 mV, p-p
信号のタイプ スクエアウェーブ -
入力インピーダンス >100k <5 Ω pF
クロックジッタ(300Hz〜15KHz以上の統合) <1 Hz
出力高圧 0.7Vio - ヴィオ V

CLK_32K_OUT: 32.768K は波形を持っていません、または波形の正確さは上記のテーブルの条件を満たしません!

# For AMPAK/Azurewave modules, the abnormal log for 32k:
[11.068180] dhdsdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[11.074372] dhd_bus_init: clock state is wrong. state = 1
[12.078468] dhdsdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[12.086051] dhd_net_bus_devreset: dhd_bus_devreset: -1
5.2.1.9 不適切な PCB のルーティングの質/キャパシタンス/インダクタンス {#5219-inappropriate-pcb-routing-qualitycapacitancesinductances}

SDIO_CLK/CMD/DATAX:異常なPCBのルーティング、不適切なキャパシタンスおよびインダクタンス、悪い接触および不良はんだ付けする初期化例外か高周波で動くことができないために導くことができます。 確認の頻度を下げることが可能(&sdio ノードの下の最大周波数を変更)。 周波数削減が可能であれば、ハードウェアエンジニアは、Wi-FiモジュールのデータシートのCLK/CMD/DATAタイミング要件の順守を確認するために、波形を測定する必要があります。 周波数を変更する方法:

&sdio {
+  max-frequency = <10000000>;   # Modify here to limit the frequency
5.2.1.10 io_domain の設定 {#52110-io_domain-configuration}

Wi-Fi とホストコントローラーの SDIO 電圧が不一致しているかを確認し、ソフトウェア io_domain の設定がハードウェアにマッチするかどうかを確認してください(セクション 2.2.3 を参照)。

// Abnormal log 1
mmc_host mmc1: Bus speed(slot0)=100000000Hz(slotreq 100000000Hz,actual
100000000HZ div=0)
dwmmc_rockchip ff0d0000.dwmmc: All phases bad!
mmc1: tuning execution failed
mmc1: error -5 whilst initialising SDIO card

// Abnormal log 2, such as logs for data communication exceptions like firmware
download failure:
sdioh_buffer_tofrom_bus: TX FAILED ede95000, addr=0x08000, pkt_len=1968, ERR=-84
_dhdsdio_download_firmware: dongle image file download failed
dhd_bus_devreset Failed to download binary to the donglesdio

// Abnormal log 3
dwmmc_rockchip 30120000.rksdmmc: Busy; trying anyway
sdioh_buffer_tofrom_bus: RX FAILED c52ce000, addr=0x0f154, pkt_len=3752, ERR=-5
dhdsdio_membytes: membytes transfer failed
bcmsdh_sdmmc: Failed to Write byte F1:@0x1000a=00, Err: -5
dhdsdio_membytes: FAILED to set window back to 0x18100000
5.2.1.11 WL_HOST_WAKE {#52111-wl_host_wake}

ウェイクアップRK HOST WL_HOST_WAKE PINピン構成エラーまたは断続的なパワーレベルまたは不良はんだジョイントを、次の異常やシステムハングアップを引き起こします。

# AMPAK Azurewave module, exception log:
dhd_bus_rxctl: resumed on timeout, INT status=0x208000C0
dhd_bus_rxctl: rxcnt_timeout=1, rxlen=0
5.2.1.12 SDIO_D1~3 Pinの貧しいはんだ付け {#52112-poor-soldering-on-sdio_d13-pin}

以下のログが表示される場合、問題は10MHzの下の最高周波数を減らす後でさえも持続します:

[ 22.484301] mmc3: queuing unknown CIS tuple 0x80 (7 bytes)
[ 22.598965] xxx 148500000Hz (slot req 150000000Hz, actual 148500000HZ div = 0)
[ 23.466816] dwmmc_rockchip fe000000.dwmmc: Unexpected xfer timeout, state 3
[ 24.370310] dwmmc_rockchip fe000000.dwmmc: All phases bad!
[ 24.370391] mmc3: tuning execution failed: -5

次に、それを1行モードでテストするように変更します。

&sdio {
+  bus-width = <1>;   /* Adjust to 1-line mode for testing */

有効であれば、SDIOD1~3ピンの1つにハードウェアの問題があることを示します。これは、悪いはんだジョイントや誤った接続などです。

5.2.1.13 欠陥モジュール/破片 {#52113-defective-modulechip}

マスターチップやWi-Fiモジュールが不良となる可能性は小さい。 複数のユニットをテストすることで検証をおすすめします。

5.2.1.14 IOMUX の多重化例外 {#52114-iomux-multiplexing-exception}
pinctrl: pin gpio3-4 already requested by ff120000.serial; cannot claim for
ff5f0000.dwmmc
pinctrl: pin-100 (ff5f0000.dwmmc) status -22
pinctrl: could not request pin 100 (gpio3-4) from group sdmmc0ext-bus4 on device
dwmmc_rockchip ff5f0000.dwmmc: Error applying setting, reverse things
5.2.1.15 追加情報 {#52115-additional-information}

上記のトラブルシューティング手順が問題を解決しない場合は、以下のファイルをRedmineシステムにアップロードしてください。dts/dtsi設定、カーネルログdmesg、PDFスキーマ図を完了します。 また、WIFI_REG_ON、Wi-Fi_CLK、Wi-Fi CMDの3つのラインの電源オン波形図を提供。

5.2.2 USB Wi-Fi のトラブルシューティング {#522-usb-wi-fi-troubleshooting}

通常、USB Wi-Fi デバイスは、以下の情報を表示します。 そうでない場合は、Wi-Fi ドライバーは読み込まれません!

# USB device detected
usb 2-1: new high-speed USB device number 2 using ehci-platform
# Manufacturer's PID/VID
usb 2-1: New USB device found, idVendor=0bda, idProduct=b82c
usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-1: Product: 802.11ac NIC

上記情報が表示されない場合は、モジュールのトラブルシューティングについては、ピンVBAT/WL_REG_ONを参照して、高値で引き込まれているかどうか、USB関連の構成が正しいか確認します。 注:RV1106/1103では、echo 1 > /sys/devices/platform/ff3e0000.usb2-phy/otg_mode の次のコマンドを手動で入力する必要があります。

5.2.3 Realtek Wi-Fi の注意事項 {#523-realtek-wi-fi-precautions}

5.2.3.1 WLAN0 は異常なスキャンを検出しましたが {#5231-wlan0-detected-but-scanning-abnormal}

FN-Link Wi-Fi モジュール: PIN25 (COBチップの第22PIN対応)は、チップの内部に多重化ピンです。 一つの機能として役立つ PCM_OUT 、接続する PCM_IN Bluetooth PCM のコール機能のための Rockchip SoC の他の機能は Wi-Fi IC としてあります LDO_SPS_SEL (SPSまたはLDOモード選択) このピンが低レベルの場合、SPSモードと高レベルでの場合にはLDOモードを示します。 そのため、このPINは高レベルまたは低レベルで、ハーフレベルが検出された場合、Wi-Fiを誤動作させる可能性があります。SDIOをスキャンしたり、APを検出できないなどです。 ハーフレベル測定の場合、ハードウェア上でプルアップ処理を適用する必要があります。 LB-LINKモジュール: PIN7 プルダウン抵抗器と接続する必要があります。

5.2.3.2 SDIO 3.0用Realtekサポート {#5232-realtek-support-for-sdio-30}

対応するRTL8821CSなどのハイエンドモジュールを使用する場合、次の異常ログで初期化が失敗する可能性がある確率があります。

mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ
div = 0)
mmc_host mmc1: Voltage change didn't complete
mmc1: error -5 whilst initialising SDIO card

下記のパッチを必ず追加してください。

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 2046eff..6626752 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -646,7 +646,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
* try to init uhs card. sdio_read_cccr will take over this task
* to make sure which speed mode should work.
*/
- if (!powered_resume && (rocr & ocr & R4_18V_PRESENT)) {
+ /*if (!powered_resume && (rocr & ocr & R4_18V_PRESENT)) {
  err = mmc_set_uhs_voltage(host, ocr_card);
  if (err == -EAGAIN) {
   mmc_sdio_resend_if_cond(host, card);
@@ -655,7 +655,10 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32
ocr,
  } else if (err) {
   ocr &= ~R4_18V_PRESENT;
  }
- }
+ }*/
+
+ ocr &= R4_18V_PRESENT;

5.2.4 Wi-Fi SDIO カード検出が、wlan0 は失敗を上回ります {#524-wi-fi-sdio-card-detected-but-wlan0-up-failure}

kmesg のログに次のログが SDIO カードが認識されていることを示しますが、 Wi-Fi は動作しません。

mmcx: new high speed SDR104 SDIO card at address 0001
# or
mmcx: new ultra high speed SDR104 SDIO card at address 0001

ファームウェアファイルが存在していないか、ファイル名がモジュールモデルに一致しない(AMPAKとAzurewaveモジュールのみ)。

[dhd] dhd_conf_set_path_params : Final
clm_path=/vendor/etc/firmware/clm_bcm43438a1.blob
[dhd] dhd_conf_set_path_params : Final conf_path=/vendor/etc/firmware/config.txt
  dhdsdio_download_code_file: Open firmware file failed
/vendor/etc/firmware/fw_bcm43438a1.bin
_dhdsdio_download_firmware: dongle image file download failed

Wi-Fiモジュールへの電源は不安定です。

[ 14.059448] RTW: ERROR sd_write8: FAIL!(-110) addr=0x10080 val=0x00
[ 14.059602] RTW: ERROR _sd_cmd52_read: FAIL!(-110) addr=0x00086
[ 14.059615] RTW: ERROR sdio_chk_hci_resume((null)) err:-110

Realtekモジュールは、APを検出できないような異常をスキャンする経験があります。

[ 43.860022] RTW: sdio_power_on_check: 0x1B8 test Pass.
[ 43.860115] RTW: _InitPowerOn_8723DS: Test Mode
[ 43.860156] RTW: _InitPowerOn_8723DS: SPS Mode

カーネルの構成の組み込みモードとKOモードの両方が選択またはMismatched設定です

Wi-Fi ドライバーは、例外を発生させ、初期にロードされます。 ログは、ドライバーが1秒以内にロードされることを示しています。その時点で、sdio/usbデバイスはまだ未処理になっています。 カーネルの設定セクションを確認してください。 システムは、同じく2つのKOをロードします, 1 bcmdhd.koと他の88xx.ko, 例外を引き起こします. 理由は、コンパイル手順のセクション3で記述されているようにします。

期間のために動くの後で5.2.5 SDIO Wi-Fi異常 {#525-sdio-wi-fi-anomaly-after-running-for-a-period}

SDIO_CLK/CMD/DATAX: 異常なPCBのルーティング、コンデンサーおよび誘導器のような問題は条件、悪い接触、または悪いはんだ付けすることに高い頻度で動く初期化異常か不安定をもたらすことができません。 確認の頻度を下げる(&sdio ノードの下の最大周波数を変更)。 周波数削減が可能であれば、Wi-FiモジュールのデータシートのCLK/CMD/DATAタイミング要件を満たすハードウェア波形をチェックする必要があります。 SDIO2.0:SDIO高速モードタイミング図(CLK <= 50M);SDIO3.0:SDRモードのSDIOバスタイミング仕様(SDR104/DDR50)(50M < CLK <=208M);

&sdio {
+  max-frequency = <10000000>;   # Modify this to limit the frequency

ケース2:Wi-FiとSoCのSDIO電圧が誤差の発生時に、ソフトウェアio_domianの設定がハードウェア(セクション2.2.3を参照)と一致しているかどうかを確認してください。

5.2.6 Wi-Fi接続性の問題:AP接続障害、安定性、スロー接続 {#526-wi-fi-connectivity-issues-ap-connection-failure-instability-slow-connection}

まず、接続プロセスを理解し、次の手順を含みます。

  1. SSID をスキャンして構成します。SSID が見つからない場合、スキャン処理は、目的の SSID が検出されるまで繰り返されます。
  1. 接続開始と4ハンドシェイクの完了。
  1. DHCP 経由で IP アドレスを取得する これらの問題は、Wi-Fiチップまたはモジュールの標準RFまたはアンテナ仕様によって一般的に引き起こされます。 検証方法は、以下の通りです。簡単なソフトウェア接続テストについては、4.1項を参照してください。 RFの指定は最初に、板のRFの指定にテスト レポートを提供します。 上記以外の方は、基本仕様のテストから始めましょう。 第二に、ケースを含む装置が完全なユニットである場合は、アンテナのOTA(Over-The-Air)仕様がテストされているかどうかを確認してください。 いない場合、テストを優先します。 完全な単位のためのWi-Fi RFの指定そしてアンテナのOTAのテスト レポートが修飾されていることを確認し、ハードウェア指定が正常であることを確認します(送信力、EVM、水晶頻度偏差、受信の感受性)。

スキャン比較 基本的なスキャン比較を実行します。: テストデバイスとスマートフォンをルータから同じ距離に配置し、スキャンしたAPの数とスマートフォン(または同様の仕様の競合者)との信号強度を比較して、ハードウェア仕様が正常かどうかを事前に決定します。 スキャン方法は、第4.1章で参照されます。 スマートフォンと比べる方法をご紹介します。 Android の携帯電話を操作し、設定に移動し、開発者のオプションに移動し、WLAN の詳細なロギングオプションを有効にします。 RSSI を含む AP の詳細情報を参照するために WLAN 設定インターフェイスに戻ります。 スマートフォンのスキャンでホットスポットや信号強度の数を比較することで、ハードウェア仕様が適格かどうかを事前に決定できます。 干渉 干渉 干渉要因を排除します。, のような 多数の 2.4/5G ワイヤレス デバイスが同時に接続して、現在の環境で重要な干渉を引き起こします. この場合、テストデバイスと比較スマートフォン(または同様の仕様の競合他社)を同じ場所に置きます。 異常な場合、干渉として判断できます。 スマートフォンが正常に動作している場合、ハードウェア仕様に異常があることを判断できます。 距離 距離要因を排除します。, 距離のために信号が弱すぎるとして (接続されたAPの信号強度は、間の -70 から -90 距離を wpa_cli スキャン/scan_r) 通信障害につながることができます。. デバイスを近づけて確認することができます。 ルーターの互換性は、異なるメーカーやモデルからルータとテストすることで、ルータの互換性の問題を排除します。 一貫性 単一ボード異常を2~3つのボードでテストを比較することで排除します。 モジュールメーカーやWi-Fiメーカーから直接支援を求めることができます。 それらはすぐに問題を修理できる空気のパケットを捕獲する専門のパケット精錬の器械を持っています。 確認のための私達のシンセンのオフィスに環境を持って下さい

5.2.7 争訟 会議の期待をしない {#527-throughput-not-meeting-expectations}

SDIOインターフェイスの場合、RKプラットフォームインターフェースは最大150Mをサポートし、プロトコルは208Mまで対応しているため、ハードウェアに固有のパフォーマンス損失がいくつかあります。次に、RFインジケータが最初にテストされ、必要に応じて、テストレポートとアンテナOTAテストレポートを提供します。その後、シールドされた部屋や環境の干渉を除外するための地下駐車場などのクリーンな環境を見つけ、クリーンな環境が正常であることを確認します。最後に、 CPU/DDR周波数固定検証を実行できます。

# DDR
cat /sys/devices/platform/dmc/devfreq/dmc/available_frequencies
echo userspace > /sys/devices/platform/dmc/devfreq/dmc/governor
echo 1560000000 > /sys/devices/platform/dmc/devfreq/dmc/min_freq
cat /sys/devices/platform/dmc/devfreq/dmc/cur_freq

# CPU
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1992000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

# Move the dw-mmc interrupt to another CPU core for verification

#References:
#For switching CPU core interrupt verification.
cat /proc/interrupts to view the corresponding interrupt number
echo 5 > /proc/irq/38/smp_affinity_list // Move the interrupt to CPU core 2 for
execution
cat /proc/interrupts // Check the count

5.2.8 IP異常 {#528-ip-anomalies}

IPアドレスの取得やIPアドレスの競合を経験できない dhcpcd または udhcpc プロセスがアクティブであるか確認してください。 dhcpcd: SDK で使われるデフォルトでは、システムから始まり、より完全な DHCP クライアントです。 udhcpcd: divingbox から DHCP クライアントを合理化しました。 注意: プロセスを同時に有効化してはならない。

5.2.9 スリープモードから異常なウェイクアップ {#529-abnormal-wake-up-from-sleep-mode}

スリープモードに入ると、Wi-Fiで頻繁に呼び出されます。 次のシナリオは除外されるべきです: デバイスがスリープモードに入った後、Wi-Fiモジュールの32.768kクロックがオフになります。 WIFI_REG_ON信号は低速で引き出されます。 WIFI_WAKE_HOST PINは、レベルジッタ(通常低レベルで、高くなるとトリガーします)でハードウェアの不安定性を持っています。 AP/CY モジュールは、Wi-Fi がスリープモードに入る前後の放送またはマルチキャストパケットをフィルタリングするために、次の特定のコマンドを実行しません。

# Execute before sleep:
dhd_priv setsuspendmode 1
# Execute after wake-up:
dhd_priv setsuspendmode 0

5.2.10 PING 遅延の到達不能または高確率 {#5210-ping-unreachable-or-high-probability-of-latency}

RF/antenna メトリックは測定されていない; Wi-Fi がスキャン操作を実行している可能性が高いため、かなりのpingレイテンシーが得られます。ルータまたは PC ファイアウォールが有効になっている場合、ping 操作のブロックにつながります。

5.2.11 顧客の注文の修正 {#5211-customer-custom-modifications}

ドライバーコードの変更を行なわれた方は、必ずご連絡ください。 当社では、無線LAN/BTドライバの設定変更により、調査時に異常な問題の報告を頻繁に受けています。

5.2.12 wlan0 通常、しかし任意のAPをスキャンできません {#5212-wlan0-normal-but-unable-to-scan-any-ap}

モジュールに対応した水晶発振器が24MのWi-Fi要求など、チップの要件に一致するかどうかを確認してくださいが、37Mは接続されています。 32.768kの精度は要件を満たしていません。

5.2.13 Icomm-semi Wi-Fi 異常に {#5213-icomm-semi-wi-fi-anomaly}

RV1109/1126プラットフォームでは、SDIOが認識できるようになったことがわかりましたが、エラーを読み取り/書き込みました。 下記の修正が試みられました。

&sdio {
 //rockchip,default-sample-phase = <90>; # Remove this configuration option
}

5.2.14 iPhoneの問題 {#5214-iphone-issues}

問題: iOS デバイスがホットスポットに接続した後、ネットワークは切断され、約 10 秒後に自動的に再接続されます。 解像度:デバイスは、一時保存されるiOSデバイス用のDHCPリースファイルを生成し、再起動時に紛失します。 dnsmasq を使用して IP アドレスを割り当てるときは、起動コマンドで次のパラメーターを指定する必要があります。: -l, –dhcp-leasefile=<path> # 電源が切断されたときにパスは永続的で失われなければなりません。

5.2.15 AMPAK/Infineon/Azurewave/Synopsys モジュールの問題 {#5215-ampakinfineonazurewavesynopsys-module-issues}

一般的な問題:WIFI_REG_ONの設定が適切でない

32.768K信号は、要求される基準を満たしていないか、提示されていないか、または満たさない。

WIFI_WAKE_HOST: ピン構成やパワーレベル設定が適切でないと、dhd_dpcスレッドによる初期化の失敗やCPU使用率が高い。 DTS設定を参照

/* Pin control configuration for WIFI_WAKE_HOST */
wireless-wlan {
    /omit-if-no-ref/
    wifi_wake_host: wifi-wake-host {
        /* Note that the Wi-Fi wake host pin is typically triggered by a high
level,
         * so it should be configured as pulled down here by default; if the
customer's
         * hardware design is inverse, it should be changed to pulled up, in any
case,
         * it should be initialized to a state opposite to the trigger level.
         */
        rockchip,pins = <0 RK_PA0 0 &pcfg_pull_down>;
    };
};

32.768K 信号は、スリープ時にオフするか、WIFI_REG_ON がオフになっているか、ファームウェア/nvram は存在せず、ファイルのダウンロードプロセスのエラーはログで明確に表示されている;AMPAK (bcmdhd.ko) / Azurewave (cywdhd.ko) モジュールドライバは変更不可で、間違ったドライバは設定されていない。

5.2.16 PCIe Wi-Fi 認識されない {#5216-pcie-wi-fi-not-recognized}

PCIE Wi-Fi の設定セクションを参照してください。, 記載されているすべての設定をチェックします。, 必ず、それらが正常であることを確認するために、関連する電源電圧を測定してください!

5.3 Bluetoothの問題 {#53-bluetooth-issues}

Bluetooth テスト項目 故障または異常BT Bluetooth rkwifibt-app-test の機能、以下にいくつかの状況があります。Realtek モジュールは、このカーネルの設定をオフにする必要があります:CONFIG_BT_HCIUART=n Bluetooth カーネルの構成セクションを参照してください。 DTS BT (BT_RST_N) 電源が誤って、Bluetooth 設定を参照してください。次のコマンドで確認することができます。

echo 0 > sys/class/rfkill/rfkill0/state # Pull down BT_REG_ON, measure the
corresponding PIN with a multimeter
echo 0 > /proc/bluetooth/sleep/btwrite

echo 1 > sys/class/rfkill/rfkill0/state # Pull up BT_REG_ON, measure the
corresponding PIN with a multimeter
echo 1 > /proc/bluetooth/sleep/btwrite

UART 設定エラーは、セクション 2.2.2/2.4.2/2.5 を参照します。Realtek モジュールには rtk_hciattach / hci_uart.ko / rtk_btusb.ko が必要です。正しくコンパイルされていないか、カーネルの設定エラーがないか確認します。セクションを参照してください。

2.5/3.3;

# Initialize Bluetooth, only for UART module use
/usr/bin/rtk_hciattach

# Check if the kernel's CONFIG_BT_HCIUART configuration has been removed, and
whether the corresponding ko file has been generated
/usr/lib/modules/hci_uart.ko

# Whether the USB interface has generated the corresponding USB driver
/usr/lib/modules/rtk_btusb.ko

Bluetooth ファームウェア/コンフィグファイルは、Bluetooth モジュール モデルに一致しない、またはセクション 3.3 を参照しません。

# AMPAK Azurewave module, for example: AP6212A: The corresponding file is
bcm43438a1.hcd
/system(vendor)/etc/firmware/BCMxxxx.hcd

# RTL SDIO interface RTL8723DS corresponding file
/lib/firmware/rtlbt/rtl8723d_fw
/lib/firmware/rtlbt/rtl8723d_config

# RTL USB interface RTL8821CU corresponding file
/lib/firmware/rtl8821cu_fw
/lib/firmware/rtl8821cu_config

BT UART RTS/CTSのハードウェア配線エラー、異常な初期化認識

# AMPAK, Azurewave module, all 4 lines must be connected to the main control
host tx  - controller rx
host rx  - controller tx
host rts - controller cts
host cts - controller rts

# Realtek module
# For COB chips that directly use Realtek Bluetooth: The hardware wiring of
the UART interface is as follows:
host tx  - controller rx
host rx  - controller tx
host rts - controller cts
host cts - ground # The main control cts should be grounded

# For the RTL8822C chip, which is special, all 4 lines must be connected to
the main control
host tx  - controller rx
host rx  - controller tx
host rts - controller cts
host cts - controller rts
# For modules, the module factory generally internally grounds the controller
rts, so there is no need for the main control to ground it, just connect it
directly to the controller
# rts; Pay special attention: Realtek has a large number of agents, and each
module may be different, so it is necessary to confirm with the module
factory, if
# the controller rts is not grounded, then the main control needs to ground
it.
host tx  - controller rx
host rx  - controller tx
host rts - controller cts
host cts - controller rts

6. .. Wi-Fi/BT の新しいモジュールのポーティングおよびドライバーの更新 {#6-wi-fibt-new-module-porting-and-driver-update}

特別な注意: 自分自身を熟知して、第3章のファイルストレージ規則とコンパイルルールを理解してください。これは、移植プロセスにとって重要です。ドライバーの更新シナリオの場合、実際の状況に基づいて次の手順の一部が省略できます。

6.1 Realtekモジュール {#61-realtek-module}

6.1.1 Wi-Fi セクション {#611-wi-fi-section}

テイクアウト RTL8821CS 例として:まず、モジュールメーカーや元の工場から対応するポーティングパッケージを入手してください。これに似ています。 20171225_RTL8821CS_WiFi_linux_v5.2.18_25830_BT_ANDROID_COEX_8821CS- B1d1d_COEX20170908 -1f1f Wi-Fi ドライバー パート、次のディレクトリに移動します。: WiFi\ RTL8821CS_WiFi_linux_v5 .2.18_25830_COEX20170908-1f1f.20171225\driver 追加対応コンパイル構成 ドライバーファイルをドライバ/net/wireless/にコピーする rockchip_wlan / , rtl8821cs に名前を変更し、対応する設定を追加する Makefile/Kconfig を変更します。 ドライバーを更新する際には、このステップは必要ありません。

drivers/net/wireless/rockchip_wlan/Makefile
+ obj-$(CONFIG_RTL8821CS) += rtl8821cs/

drivers/net/wireless/rockchip_wlan/Kconfig
+ source "drivers/net/wireless/rockchip_wlan/rtl8821cs/Kconfig"

Makefile の修正

# Change to RK platform:
CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ARM_RK3188 = y

# RK platform needs to remove the following configuration:
ifeq ($(CONFIG_PLATFORM_ARM_RK3188), y)
-EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC # Remove this configuration if it
exists
# Modify the ko name to be consistent with the BR2_PACKAGE_RKWIFIBT_WIFI_KO
configuration in the following Buildroot config.in!
MODULE_NAME := 8821cs

# If there is a need for Wi-Fi sleep to maintain connection (WOWLAN), enable the
following configurations:
CONFIG_WOWLAN = y
CONFIG_GPIO_WAKEUP = y

WOWLAN の必要性があれば、WL_HOST_WAKE ピンのための irq の獲得機能を加えて下さい

# Modify platform\platform_ops.c
+#include <linux/rfkill-wlan.h>
+extern unsigned int oob_irq;
int platform_wifi_power_on(void)
{
    int ret = 0;

+    oob_irq = rockchip_wifi_get_oob_irq();   // This corresponds to the
WIFI_WAKE_HOST PIN in the dts

    return ret;
}

習慣 MACの住所の条件

# Modify: core\rtw_ieee80211.c
+include <linux/rfkill-wlan.h> // Add header file
# Find the rtw_macaddr_cfg function
void rtw_macaddr_cfg(u8 *out, const u8 *hw_mac_addr)
-/* Use the mac address stored in the Efuse */
-if (hw_mac_addr) {
-    rtw_memcpy(mac, hw_mac_addr, ETH_ALEN);
-    goto err_chk;
-}

+ /* Use the mac address stored in the Efuse */
+ if (hw_mac_addr) {
+     _rtw_memcpy(mac, hw_mac_addr, ETH_ALEN);
+ }

+ if (!rockchip_wifi_mac_addr(mac)) {
+     printk("get mac address from flash=[%02x:%02x:%02x:%02x:%02x:%02x]\n",
mac[0], mac[1],
+         mac[2], mac[3], mac[4], mac[5]);
+     }
+ }

ドライバーのローディングの記入項目を加えて下さい

/* SDIO Interface: os_dep\linux\sdio_intf.c */
/* USB Interface: os_dep\linux\usb_intf.c */
/* PCIE Interface: os_dep\linux\pci_intf.c */

// At the end of this file, add the following code:
#include "rtw_version.h"
#include <linux/rfkill-wlan.h>
extern int get_wifi_chip_type(void);
extern int rockchip_wifi_power(int on);
extern int rockchip_wifi_set_carddetect(int val);

int rockchip_wifi_init_module_rtkwifi(void)
{
    rockchip_wifi_power(1);
    rockchip_wifi_set_carddetect(1);
    return rtw_drv_entry();
}

void rockchip_wifi_exit_module_rtkwifi(void)
{
    rtw_drv_halt();
    rockchip_wifi_set_carddetect(0);
    rockchip_wifi_power(0);
}

// For KO mode
module_init(rockchip_wifi_init_module_rtkwifi);
module_exit(rockchip_wifi_exit_module_rtkwifi);

// Comment out the following, and make sure to remove the __init __exit entries
for the two functions below
//module_init(rtw_drv_entry);
//module_exit(rtw_drv_halt);

コンパイルエラー処理が可能

rtl8xxx\os_dep\linux\rtw_android.c // Comment out the following two lines
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) ||
defined(COMPAT_KERNEL_RELEASE)
void *wifi_get_country_code(char *ccode)
{
    RTW_INFO("%s\n", __FUNCTION__);
    if (!ccode)
        return NULL;
-    if (wifi_control_data && wifi_control_data->get_country_code)
-        return wifi_control_data->get_country_code(ccode);
    return NULL;
}
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) */

6.1.2 Bluetooth BT セクション {#612-bluetooth-bt-section}

UARTインターフェイス 対応するモジュールがBluetooth対応の場合、元のメーカーのソフトウェアパッケージを次のものから入手する必要があります。

20201130_ANDROID_BT_DRIVER_RTL8822C_COEX_v1c1c.tar.xx

RTL8821CSを例に(ドライバを更新するには、対応するファイルを置き換えてください)。

# Place or update the Bluetooth firmware and configuration files in the following
directory:
ls external/rkwifibt/realtek/
# The structure is as follows:
external/rkwifibt/realtek/RTL8821CS # Create a new directory if it does not exist
├── rtl8821cs_config
└── rtl8821cs_fw

# Note: The name of the RTL8821CS directory must match the configuration in the
Buildroot rkwifibt Config.in:
# BR2_PACKAGE_RKWIFIBT_"RTL8821CS"

USBインターフェイス Bluetooth が使用されている場合、元のメーカーは、RTL8821CU を例にとって同様のポーティングパッケージを提供します。

# tree
Linux_BT_USB_v3.10_20190430_8821CU_BTCOEX_20190509-4139.tar.xx
or
20201130_ANDROID_BT_DRIVER_RTL8821CU_COEX_v1c1c.tar.xx
|-8821CU                  # Firmware file
|-bluetooth_usb_driver    # USB driver

# Copy or update to the external/rkwifibt/realtek/ directory, the result is as
follows:
# external/rkwifibt/realtek$ tree
├── RTL8821CU
│   ├── rtl8821cu_config   # Bluetooth config
│   └── rtl8821cu_fw    # Bluetooth firmware
├── bluetooth_usb_driver   # RTL8821CU Bluetooth USB driver, compiled into
rtk_btusb.ko
    ├── Makefile
    ├── rtk_bt.c
    ├── rtk_bt.h
    ├── rtk_coex.c
    ├── rtk_coex.h
    ├── rtk_misc.c
    └── rtk_misc.h

6.2 AMPAKモジュール {#62-ampak-module}

たとえば、AP6256 をモジュールメーカーから AP6256 用の Wi-Fi および BT ファームウェアパッケージをリクエスト(ドライバを更新するには、対応するファイルを交換してください)。

external\rkwifibt\firmware\broadcom//Create a folder named AP6256 in this
directory and store the files as follows:
external/rkwifibt/firmware/broadcom/AP6256$ tree
├── bt
│   └── BCM4345C5.hcd
└── wifi
    ├── fw_bcm43456c5_ag.bin
    ├── fw_bcm43456c5_ag_mfg.bin
    └── nvram_ap6256.txt
//Note the name of the AP6256 directory should match the configuration in the
following wifi Config.in: BR2_PACKAGE_RKWIFIBT_AP6256

カーネルのドライバ部分は変更する必要はありません。基本的にすべてのAPモジュールと互換性があります。 デフォルトでは、CONFIG_AP6XXX の設定を使用します。

6.3 サードパーティのWi-Fiドライバポーティングガイド {#63-third-party-wi-fi-driver-porting-guide}

SDK でサポートされていない Wi-Fi モジュールでは、次の手順はポーティングに参照できます。主に構成する DTS のセクション 2.2 を参照して下さい: WIFI_REG_ON: Wi-Fi モジュールの電源ピン; WIFI_WAKE_HOST: Wi-Fi モジュールのピンはホスト コントローラーを目覚めます(任意、一般に Broadcom/Realtek モジュールによって使用される); 上記 GPIO の設定は、カーネルの net/rfkill/rfkill-wlan.c によって解析され、Wi-Fi ドライバーに次のインターフェイスを提供します。

/* SDIO card detection function */
int rockchip_wifi_set_carddetect(int val)

/* Wi-Fi driver to obtain the GPIO pin for the wake-up interrupt of the host
controller, optional */
int rockchip_wifi_get_oob_irq(void)
/* The trigger level of the interrupt, used in conjunction with the above API */
int rockchip_wifi_get_oob_irq_flag(void)

/* Wi-Fi power on and off functions */
int rockchip_wifi_power(int on)

Wi-Fi ドライバーは、実際の状況に応じて上記のインターフェイスを呼び出すことができます。 ドライバのコンパイル: カーネルディレクトリと対応する RK コンパイラを指定する必要があります。

# The variable names below should be modified according to the actual situation:
diff --git a/Makefile b/Makefile
index 649da3c..d0b128d 100644
--- a/Makefile
+++ b/Makefile

+KDIR=/home/rk/kernel/
+ARCH=arm or arm64
+CROSS_COMPILE=SDK/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-
x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-

7. . 一般的な機能と構成 {#7-common-features-and-configuration}

導入事例

7.1 Wi-Fi/BT アダプター Debian および他のサードパーティ システムのための指示 {#71-wi-fibt-adapter-instructions-for-debian-and-other-third-party-systems}

Debian/Kylin/UOS Systems では、上位レイヤーで Wi-Fi/BT アプリケーション (NetworkManager/blumeman/gnome- bluetooth) が完成しました。 当社の作業は、システムが起動する前にインターフェイスを初期化することです。例えば、Wi-Fi: ifconfig では wlan0 インターフェイスが表示されます。Bluetooth: hciconfig では hci0 インターフェイスが表示されます。 Wi-Fi/BT の DTS/kernel 構成は、特定のシステムとは独立しており、基本 DTS とカーネルの設定については、セクション 2 から直接参照されるべきユニバーサル構成であることに注意してください。 次のセクションでは、インターフェイスの初期化について説明します。 Yocto と他の Buildroot のようなシステムの場合、wpa_supplicant/bluez プロトコルスタックを Bluetooth 機能をサポートできるようにする必要があります。

# After compilation, binaries such as bluetoothd/bluetoothctl/hciconfig will be
generated
$ bluetoothd -ndC &    # Start bluetoothd
$ bluetoothctl    # Enter interactive mode
[bluetooth]# power on
[bluetooth]# scan on
[bluetooth]# help  # View more commands

注意: 上記のアプリケーションツールとコンパイルは、対応するシステムのドキュメントと指示から参照されるべきです。

7.1.1 AMPAKモジュールの適応例 {#711-ampak-module-adaptation-example}

### Example with AP6275P, obtain the three files from the AMPAK module
manufacturer
# Bluetooth Initialization File: brcm_patchram_plus1.c, compile it with the
system's compiler into an executable file brcm_patchram_plus1 and place it into
the system
external/rkwifibt/brcm_tools/brcm_patchram_plus1.c # If there is RKSDK, it can be
obtained from this directory

# BT firmware file: Store according to the actual system requirements, no special
requirements, the following brcm_patchram_plus1 Bluetooth initialization program
will require specifying the firmware path;
BCM4362A2.hcd

# Wi-Fi firmware file: Store according to the actual system requirements
clm_bcm43752a2_pcie_ag.blob
fw_bcm43752a2_pcie_ag.bin
fw_bcm43752a2_pcie_ag_apsta.bin
nvram_AP6275P.txt

### Configuration
# Check the kernel Wi-Fi configuration and enable the following configurations:
CONFIG_WL_ROCKCHIP=y
CONFIG_WIFI_BUILD_MODULE=y
CONFIG_BCMDHD=y
CONFIG_AP6XXX=m
CONFIG_BCMDHD_PCIE=y #PCIE interface, mutually exclusive with SDIO, do not
configure if not PCIE
CONFIG_BCMDHD_SDIO=y #SDIO interface, mutually exclusive with PCIE

### Wi-Fi Interface Initialization
# After compiling with make, a ko file will be generated, store this file
according to your actual needs and load the Wi-Fi by opening this ko;
drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmdhd.ko

# Enable Wi-Fi: Load the ko first, and specify the firmware/nvram path when
insmod, change xx_path to the actual path used:
insmod /ko_path/bcmdhd.ko firmware_path=/fw_path/ nvram_path=/nvram_path/
ifconfig -a    #Normally, you can see wlan0, if not, refer to Chapter 2 and
Chapter 7 for troubleshooting

### Bluetooth Interface Initialization
# To enable Bluetooth, reset the BT power first:
echo 0 > /sys/class/rfkill/rfkill0/state   #Turn off BT power, equivalent to
rfkill block operation
echo 0 > /proc/bluetooth/sleep/btwrite
sleep 0.2
echo 1 > /sys/class/rfkill/rfkill0/state   #Turn on BT power, equivalent to
rfkill unblock operation
echo 1 > /proc/bluetooth/sleep/btwrite
sleep 0.2
# Initialize Bluetooth command, --patchram specifies the path of the Bluetooth
firmware file (modify according to the actual situation), /dev/ttyS8 is the
corresponding hardware serial port (modify according to the actual situation)
brcm_patchram_plus1 --bd_addr_rand --enable_hci --no2bytes --
use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram
/system/etc/firmware/BCM4362A2.hcd /dev/ttyS8 &
# If the system has installed the bluez protocol stack, use the hciconfig
command, you can see the hci0 node
hciconfig -a

# Disable Bluetooth
echo 0 > /sys/class/rfkill/rfkill0/state   #Turn off BT power, equivalent to
rfkill block operation
echo 0 > /proc/bluetooth/sleep/btwrite

# Be sure to kill the brcm_patchram_plus1 process, because it will be executed
again when turned on, otherwise it will conflict;
killall brcm_patchram_plus1

# The above enable/disable operations should be ported to your system according
to the actual situation;

# Note: If the application layer turns on/off Bluetooth by calling rfkill block
to turn off Bluetooth power, then when unblocking to turn on Bluetooth power
again, you must execute the brcm_patchram_plus1 Bluetooth initialization command
again, otherwise Bluetooth cannot be used; if the upper layer is only hciconfig
hci0 down/up, there is no need to call the repeated initialization;

7.1.2 Realtekモジュール適応例 {#712-realtek-module-adaptation-example}

Wi-Fi の適応指示は、RTL8822CS を例にとり、最初にモジュールメーカーから対応するモジュールのドライバパッケージを取得します。

# For Wi-Fi: RTL8822CS_WiFi_linux_v5.12.1.5-1-g0e1519e_COEX20210504-2323.20210527
# For BT: 20201202_LINUX_BT_DRIVER_RTL8822C_COEX_v1c1c

### Wi-Fi Adaptation
# Refer to Section 8.1 for porting the Wi-Fi driver to the RK platform, and refer
to Section 2 for basic dts and kernel configuration
# After compiling with make, a ko file will be generated. Place this file
according to your actual needs and load the Wi-Fi with this ko file;
drivers/net/wireless/rockchip_wlan/rkwifi/rtl8822cs/8822cs.ko

# Realtek does not require firmware/nvram files, the timing of insmod execution
should be adjusted according to the system requirements;
insmod /ko_path/88xxxx.ko
# Normally, you should see wlan0, if not, refer to Section 2 and Section 7 for
troubleshooting
ifconfig -a

### Bluetooth Adaptation
# fw/config file explanation:
# Only Bluetooth requires fw/config files (found in the driver package), and the
storage location is related to the interface
# For RTL UART interface, the corresponding file for RTL8822CS should be placed
in the following location
/lib/firmware/rtlbt/rtl8822cs_fw
/lib/firmware/rtlbt/rtl8822cs_config
# Copy the correct FW file and config file to the correct path. (Copy the
firmware/config file)
$ sudo mkdir -p /lib/firmware/rtlbt/
$ sudo cp rtkbt-firmware/lib/firmware/rtlbt/rtl8xxxx_fw /lib/firmware/rtlbt/
$ sudo cp rtkbt-firmware/lib/firmware/rtlbt/rtl8xxxx_config /lib/firmware/rtlbt/

# For RTL USB interface, the corresponding file for RTL8822CU (copy the
corresponding fw/config files to the system's corresponding location)
/lib/firmware/rtl8822cu_fw
/lib/firmware/rtl8822cu_config
# Copy the correct FW file and config file to the correct path.
$ sudo cp rtkbt-firmware/lib/firmware/rtl8xxxxx_fw /lib/firmware/
$ sudo cp rtkbt-firmware/lib/firmware/rtl8xxxxx_config /lib/firmware/

# rtk_hciattach/hci_uart/usb.ko file explanation

# hci_uart/usb.ko file explanation, Realtek does not use the built-in interface
driver of the kernel, the kernel must first remove the following two
configurations:
CONFIG_BT_HCIBTUSB
CONFIG_BT_HCIUART

### Initialization Instructions
# UART Interface:
killall rtk_hciattach # First, make sure to stop this process if it was
previously started (if applicable)
echo 0 > /sys/class/rfkill/rfkill0/state # Power off
echo 0 > /proc/bluetooth/sleep/btwrite
sleep 0.5
echo 1 > /sys/class/rfkill/rfkill0/state # Power on
echo 1 > /proc/bluetooth/sleep/btwrite
sleep 0.5
insmod /usr/lib/modules/hci_uart.ko    # Realtek module requires loading the uart
driver
rtk_hciattach -n -s 115200 /dev/ttyS4 rtk_h5 & # ttySX refers to which uart port
the Bluetooth is using

# If the system has the bluez protocol stack installed, use the hciconfig command
hciconfig -a # Normally, you should see the hci0 node, if not, refer to Section 2
and Section 7 for troubleshooting

# USB Interface:
echo 0 > /sys/class/rfkill/rfkill0/state # Power off
echo 0 > /proc/bluetooth/sleep/btwrite
sleep 0.5
echo 1 > /sys/class/rfkill/rfkill0/state # Power on
echo 1 > /proc/bluetooth/sleep/btwrite
sleep 0.5
insmod /usr/lib/modules/rtk_btusb.ko   # Realtek module requires loading the usb
driver
# If the system has the bluez protocol stack installed, use the hciconfig
command, and you should normally see hci0
hciconfig -a

Bluetooth のドライバー/rtk_hciattach 用具の編集の指示

### Realtek UART/USB Bluetooth Driver ko Driver Compilation:
$ make -C /home/rk/rk3xxx/kernel/
 CROSS_COMPILE=/home/rk/rk3xxx/prebuilts/gcc/linux-x86/aarch64/gcc-arm-10.3-
2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu- ARCH=arm64
M=/home/rk/rk3xxx/usb(uart)/bluetooth_usb(uart)_driver/
# -C specifies the kernel directory
# CROSS_COMPILE specifies the path to the cross-compiler toolchain
# ARCH specifies the system platform
# M specifies the path to the uart/usb driver
# Note that the paths must be absolute
# After a successful compilation,

# rtk_hciattach UART Initialization Program Compilation:
$ make CROSS_COMPILE=/home/rk/rk3xxx/prebuilts/gcc/linux-x86/aarch64/gcc-arm-
10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu- -C
/home/rk/rk3xxx/uart/rtk_hciattach/
# -C specifies the kernel directory
# CROSS_COMPILE specifies the path to the cross-compiler toolchain

上記の適応指示は、マニュアルコンパイルまたはプッシュ操作で完了します。 デバッグが完了したら、自動インストールの手順を簡素化するために、次の提案が行われます。成熟した商用システムの場合:たとえば、UOS /キーリン/ユニオンテックは、独自のメソッドを持っているので、システムプロバイダに相談してください。 無料のDebian:メソッドワン:インストールと使用のために上記のさまざまなファイル用のデブパッケージを作成する必要があります。 デブパッケージとインストール文書を作成するには、 参照: https://www.debian.org/doc/ 方法 2: RK プラットフォーム用の Debian パッケージングスクリプトを直接変更

#Debian version
debian/mk-rootfs-bullseye.sh
or
debian/mk-rootfs-buster.sh

#Create the relevant directories
sudo mkdir -p $TARGET_ROOTFS_DIR/system/lib/modules/
sudo mkdir -p $TARGET_ROOTFS_DIR/lib/firmware/rtl/
#Copy the relevant binaries
sudo cp /actual bin directory/rtk_hcixxx or brcmxxx
$TARGET_ROOTFS_DIR/usr/bin/
#Copy the ko file
sudo cp /actual ko directory/wifi.ko $TARGET_ROOTFS_DIR/system/lib/modules/
#Copy the firmware
sudo cp /actual firmware directory/fwXXX
$TARGET_ROOTFS_DIR/vendor/etc/firmware/

#Finally, repackage

Yocto のような Buildroot システムを使用する場合は、対応するシステムで使用されるコンパイルルールとメソッドを参照してください。

7.2 DHCPクライアント {#72-dhcp-client}

dhcpcd:SDKでデフォルトで、システムから始まり、包括的なDHCPクライアントです。 udhcpc: ストリームライン化されたDHCPクライアントを忙しいボックスから; 注意: 両方のプロセスを同時に有効化しないでください。 それらのいずれかを使用するだけです! dhcpcd クライアントを使用して IP アドレスの取得を高速化するには、次の変更を行います。

# Modify the S41dhcpcd file
index a2e87ca054..f8b924ab0f 100755
/buildroot/package/dhcpcd/S41dhcpcd
@@ -13,7 +13,7 @@ PIDFILE=/var/run/dhcpcd.pid
 case "$1" in
    start)
        echo "Starting dhcpcd..."
-        start-stop-daemon -S -x "$DAEMON" -p "$PIDFILE" -- -f "$CONFIG"
+        start-stop-daemon -S -x "$DAEMON" -p "$PIDFILE" -- -AL -f "$CONFIG"
        ;;

// Rebuild the firmware
make dhcpcd-dirclean
make dhcpcd-rebuild

7.3 Wi-Fi/BT MACアドレス {#73-wi-fibt-mac-address}

一般的に、Wi-Fi/BT MACアドレスはチップに組み込まれています。 カスタム MAC アドレスが必要な場合は、RK 固有のツールを使用して、Flash のカスタムベンダーのパーティション(ここでは説明されていないメソッドの適切なドキュメントを参照)に書き込む必要があります。 Azurewave Wi-Fi モジュールでは、Makefile を変更し、次の設定を追加します。

+ -DGET_CUSTOM_MAC_ENABLE
- -DGET_OTP_MAC_ENABLE

7.4 Wi-Fi の国コード {#74-wi-fi-country-codes}

Realtek チップセット: ドライバーの Makefile を修正し、プラットフォームのコンパイルオプションに次の行を追加します。

+++ b/drivers/net/wireless/rockchip_wlan/rtlxxx/Makefile
@@ -1270,6 +1270,7 @@ EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -
DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFO
 # default setting for Android 4.1, 4.2, 4.3, 4.4
 EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
 EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_RTW_IOCTL_SET_COUNTRY
 # default setting for Power control
 #EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
 #EXTRA_CFLAGS += -DRTW_SUPPORT_PLATFORM_SHUTDOWN

たとえば、procメソッド echo X > /proc/net/rtlxxx/wlan0/country_code を使用してください。 echo CN > /proc/net/rtlxxx/wlan0/country_code wpa_supplicant.conf で、パラメータのcounter=X を設定します。 それがソフトパックなら、hostapd.confでは、パラメータcountry_code=Xのノートを設定: 国コードXを確認するには、https://countrycode.org/,などのウェブサイトを調べることができます。これは、2つの大文字の組み合わせであるISO CODESを探します。 AMPAK/Azurewaveチップセット:dhd_priv国XX

7.5 Wi-Fi 動的ロードとKoモードのアンロード {#75-wi-fi-dynamic-loading-and-unloading-ko-mode}

KOモードでWi-Fiをコンパイルし、複数のロード/アンロード操作を実行するときは、次のパッチを適用する必要があります。カーネル4.19

--- a/arch/arm64/boot/dts/rockchip/rk3xxx.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3xxx.dts
@@ -112,6 +112,7 @@
    wireless-wlan {
        rockchip,grf = <&grf>;
        wifi_chip_type = "ap6354";
        sdio_vref = <1800>;
+        WIFI,poweren_gpio = <&gpio1 18 GPIO_ACTIVE_HIGH>; //Configure the
corresponding PIN for WIFI_REG_ON
        WIFI,host_wake_irq = <&gpio1 19 GPIO_ACTIVE_HIGH>;
        status = "okay";
    };

sdio_pwrseq: sdio-pwrseq {
+    status = "disabled"; //Disable this node
};

&sdio { //Remove the following two configurations
    disable-wp;
    keep-power-in-suspend;
    max-frequency = <150000000>;
-    mmc-pwrseq = <&sdio_pwrseq>;
-    non-removable;
    num-slots = <1>;
}

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 8730e2e..04b9cb8 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1518,6 +1518,9 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
    struct dw_mci *host = slot->host;
    int gpio_cd = mmc_gpio_get_cd(mmc);
+   if (mmc->restrict_caps & RESTRICT_CARD_TYPE_SDIO)
+        return test_bit(DW_MMC_CARD_PRESENT, &slot->flags);
+
    /* Use platform get_cd function, else try onboard card detect */
    if ((brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) ||
        (mmc->caps & MMC_CAP_NONREMOVABLE))
@@ -2755,6 +2758,9 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned
int id)
    dw_mci_get_cd(mmc);
+    if (mmc->restrict_caps & RESTRICT_CARD_TYPE_SDIO)
+        clear_bit(DW_MMC_CARD_PRESENT, &slot->flags);
+
    ret = mmc_add_host(mmc);
    if (ret)
        goto err_host_allocated;

--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -996,9 +996,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
        }

        /* No need to reinitialize powered-resumed nonremovable cards */
-        if (mmc_card_is_removable(host) || !mmc_card_keep_power(host)) {
-            err = mmc_sdio_reinit_card(host, mmc_card_keep_power(host));
-        } else if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) {
+        if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) {
            /* We may have switched to 1-bit mode during suspend */
            err = sdio_enable_4bit_bus(host->card);
        }

7.6 ネットワークのトラブルシューティング手順 {#76-network-troubleshooting-steps}

7.6.1 ネットワーク混雑/非メートル率 {#761-network-congestionunmet-rate}

1. Ethernet: Replace the Ethernet cable to confirm
2. Use tcpdump to capture packets to confirm packet loss
3. If it's UDP+RTP, you can use the RTP sequence number to confirm
4. If there is no packet loss, it may be due to the application layer not
receiving packets in time, causing packet loss. You can use netstat to check the
TCP/IP layer buffer data situation to confirm
netstat -n -t -u
5. Disable gro to confirm
ethtool -K eth0 gro off
ethtool -S eth0/wlan0
6. Increase CPU frequency to the highest to confirm
echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
7. Confirm the size of the TCP/IP cache buffer, the unit is bytes. The size of
the receive buffer area, the buffer that stores data received from the other end,
which will later be read by the application
echo "524288 1048576 2097152" > /proc/sys/net/ipv4/tcp_rmem
echo 2097152 > /proc/sys/net/core/rmem_max
echo 2097152 > /proc/sys/net/core/rmem_default
8. Use busybox ifconfig to check for packet loss statistics
9. Video playback: TCP packet loss causes stuttering, UDP packet loss causes
screen tearing
10. For Wi-Fi or Ethernet UDP packet loss rate anomalies, the following
modifications can be made for verification:
Note: The maximum cache used for data transmission for each socket (unit: bytes).
After HRTIMER is turned on, the CPU is frequently interrupted by the timer, which
is equivalent to the UDP transmission slowing down, and the buffer will not
overflow (you can see that it is interrupted by the timer 3-4 times every 1ms)
echo 12582912 > /proc/sys/net/core/wmem_max   #Change to 12M
echo 2097152 > /proc/sys/net/core/wmem_default  #Change to 2M

echo 1048576 > /proc/sys/net/core/rmem_max

11. netdev_max_backlog indicates the backlog of the network card device. Because
the network card receives data packets at a speed much faster than the kernel can
process these data packets, a backlog of the network card device occurs.
echo 65535 >  /proc/sys/net/core/netdev_max_backlog

12. Apply network parameters for high data performance.
echo 327680 > /proc/sys/net/core/rmem_default
echo 8388608 > /proc/sys/net/core/rmem_max
echo 327680 > /proc/sys/net/core/wmem_default
echo 8388608  /proc/sys/net/core/wmem_max

echo 20480 > /proc/sys/net/core/optmem_max
echo 10000 > /proc/sys/net/core/netdev_max_backlog
echo "2097152 4194304 8388608" > /proc/sys/net/ipv4/tcp_rmem
echo "262144 524288 8388608" > /proc/sys/net/ipv4/tcp_wmem
echo "44259 59012 88518" > /proc/sys/net/ipv4/tcp_mem
echo "88518 118025 177036" > /proc/sys/net/ipv4/udp_mem

7.6.2 ネットワークプロトコルスタックパケット処理時間 シンプルな検証 {#762-network-protocol-stack-packet-processing-time-simple-verification}

標準の echo ネットワーク プログラムを記述し、 tcpdump でパケットをキャプチャすることで、以下の図の 2 つのイエロー サークルでパケットを処理するプロトコル スタックにかかる時間を計算できます。

Wi-Fi / BT(無線LAN)

7.7 wpa_supplicant/hostapdの更新バージョン {#77-update-version-of-wpa_supplicanthostapd}

# The current version of the SDK is 2.6, which addresses the WPA2 key
reinstallation vulnerability
# Patch details and address:
# https://w1.fi/security/2017-1/wpa-packet-number-reuse-with-replayed-
messages.txt

# If you need to update to a newer version, follow these steps:
# Go to the official GitHub website and find the Buildroot repository, then
navigate to the following directory:
https://github.com/buildroot/buildroot/tree/master/package/
... ...
# Locate the directories for wpa_supplicant and hostapd, and download them to
your local machine:
wpa_supplicant
hostapd
... ...

# Navigate to the SDK directory:
# RK3XXX_SDK: buildroot/package/
# Replace the existing wpa_supplicant and hostapd directories with the new
versions you downloaded earlier;

# Compilation and update method:
make wpa_supplicant-dirclean && make wpa_supplicant
make hostapd-dirclean && make hostapd
./build.sh rootfs

7.8 ドライバーアプリケーション用のデバッグ構成 {#78-debugging-configuration-for-driver-applications}

7.8.1 TCPDUMPのパケットキャプチャ {#781-tcpdump-packet-capturing}

ネットワークアプリケーションの問題は、確認のためにキャプチャするパケットを必要とする場合があります。 設定を開き、コンパイルしてtcpdump実行可能を生成し、次のコマンドを使用してパケットキャプチャを行います。

Select the appropriate configuration for Buildroot BR2_PACKAGE_TCPDUMP
tcpdump -h
tcpdump -i wlan0 -w /data/xxxx.pcap

7.8.2 wpa_supplicantのデバッグ {#782-debugging-wpa_supplicant}

ログを使って wpa_supplicant で問題のデバッグが必要な場合があります。

Open the following configuration in Buildroot
Remember to save the configuration with make savedefconfig
+ BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG

# Rebuild
make wpa_supplicant-dirclean
make wpa_supplicant-rebuild

When starting wpa_supplicant, add the -s parameter so that the logs are output to
the /var/log/messages file
-s = log output to syslog instead of stdout

-d to print more logs
-d = increase debugging verbosity (-dd for even more)

Since wpa logs are extensive and the messages file is quite small, you can modify
the following configuration to increase the file size
buildroot/package/busybox/S01logging
SYSLOGD_ARGS=-n
Change to
SYSLOGD_ARGS="-n -s 8192"

Rebuild busybox
make busybox-dirclean
make busybox-rebuild

Finally, repackage
./build.sh

Start wpa_supplicant and add -s -d and other debug options
wpa_supplicant -B -i wlan0 -c /xxx/wpa_supplicant.conf -s -ddd

8. . RVシリーズ IPC SDK Wi-Fi 解説 {#8-rv-series-ipc-sdk-wi-fi-explanation}

8.1 構成指示 {#81-configuration-instructions}

システム構成 Wi-Fi 機能を有効にするには、設定 (参照: IPC SDK の構成とコンパイル方法 RV1106/1103 SDK の doc ディレクトリに記述) は、BoardConfig-EMMC-NONE-EVB1_V10-IPC.mk の設定の使用を想定して、以下のように変更する必要があります。

# project/cfg$
BoardConfig-EMMC-NONE-EVB1_V10-IPC.mk

# Kernel defconfig fragment
# rv1106-xxx.config is the default configuration for the selected configuration,
which determines the type of Wi-Fi interface. Depending on the type, add the
following configurations:
# For USB interface Wi-Fi, add the following configuration: rv1106-usbwifi.config
+export RK_KERNEL_DEFCONFIG_FRAGMENT="rv1106-xxx.config rv1106-usbwifi.config"
# For SDIO interface Wi-Fi, add the following configuration: rv1106-
sdiowifi.config
+export RK_KERNEL_DEFCONFIG_FRAGMENT="rv1106-xxx.config rv1106-sdiowifi.config"

# Enable Wi-Fi functionality, support for
SSV6X5X/RTL8189FS/RTL8188FTV/ATBM603X/ATBM6441/HI3861L
+export RK_ENABLE_WIFI_CHIP="RTL8189FS"
+export RK_ENABLE_WIFI=y

DTS ConfigurationRefer to DTS Configuration Section Note: USB モジュールは一般的に常に動力を与えられたので、電源制御の必要性はありません。対応するSDIOモジュールは通常、WL_REG_ON(名前は異なるモジュールのために異なる場合があります)を持ち、これは、dtsに応じて特定のgpioを設定する必要があります。 カーネルのコンフィグが次の2つの構成を有効にする必要があることに注意することが重要です。CONFIG_RFKILL=y CONFIG_RFKILL_RK=y コンパイル それから./build.shを使用してコンパイルします。その後、この後、このサポートしているWi-Fiが生成され、wpa_supplicant/wpa_cliプログラムと一緒にコンパイルします。 対応する実際の実行ディレクトリは、 /oem/usr/ko/wifi_xxx.ko /usr/bin/wpa_supplicant /usr/bin/wpa_cli

Wi-Fi ドライバーソースコードのディレクトリは以下の通りです。

# ls sysdrv/drv_ko/wifi/
hichannel        # Hisilicon Hi3861L, Low Power Wi-Fi
rtl8188ftv       # Realtek RTL8188FU USB
rtl8189fs        # Realtek RTL8189FS/FTV SDIO
ssv6x5x          # SSV6155P USB
atbm             # ATBM620x SDIO
atbm6441         # ATBM6441 Low Power WiFi SDIO
insmod_wifi.sh   # Driver ko loading script

現在、RTL8188FU/8189FS、Hi3861L、SSV6155P、ATBM6XX、ATBM6441などのサポートをしています。 wpa_supplicantのソースコードディレクトリ:

#wpa_supplicant
wpa_supplicant-2.6

# Default configuration file
wpa_supplicant.conf

SDK は、組み込みのネットワークスクリプトが付属しています。insmod_wifi.sh Wi Fi モデルは VID:PID に基づいて決定され、対応する Wi-Fi ドライバーと依存モジュールが自動的にロードされます。

#!/bin/sh

#hi3861L (Low Power Wi-Fi, refer to the Low Power section)
cat /sys/bus/sdio/devices/*/uevent | grep "0296:5347"
if [ $? -eq 0 ];then
   insmod $(pwd)/hichannel.ko
   sleep 0.5
   vlink_hichannel_main &
fi

#rtl8189fs
cat /sys/bus/sdio/devices/*/uevent | grep "024C:F179"
if [ $? -eq 0 ];then
   insmod $(pwd)/8189fs.ko
fi

#usb wi-Fi
echo 1 > /sys/devices/platform/ff3e0000.usb2-phy/otg_mode
sleep 0.8

#rtl18188fu
cat /sys/bus/usb/devices/*/uevent | grep "bda/f179"
if [ $? -eq 0 ];then
   insmod $(pwd)/8188fu.ko
fi
#ssv6x5x
cat /sys/bus/usb/devices/*/uevent | grep "8065/6000"
if [ $? -eq 0 ];then
   insmod $(pwd)/cfg80211.ko
   insmod $(pwd)/libarc4.ko
   insmod $(pwd)/mac80211.ko
   insmod $(pwd)/ctr.ko
   insmod $(pwd)/ccm.ko
   insmod $(pwd)/libaes.ko
   insmod $(pwd)/aes_generic.ko
   insmod $(pwd)/ssv6x5x.ko
fi

注意: icomm-semi Wi-Fi ドライバーは cfg/mac80211 関連のドライバをロードする必要があります。

8.3 アプリケーション開発 {#83-application-development}

RK(Rockchip)システムは、プロジェクト/アプリ/ wifi_app/wifi/ にあるWi-Fiアプリケーションの開発を簡素化するデフォルトのデモが付属しています。 注意: デモは、安定性を確保するためにのみ参照用です。 製品の改良や、必要に応じて関連する機能を添加または削除する必要があります。 使用法:

# First, check if the rkwifi_server is running using the 'ps' command. If it's
not running, you must start the background service first.
# rkwifi_server start &

# Start the client
# rkwifi_server -h
[Usage]:
        "rkwifi_server close"
        "rkwifi_server scan"
        "rkwifi_server connect ssid password"
        "rkwifi_server disconnect"
        "rkwifi_server getinfo"
        "rkwifi_server deepsleep [ONLY LOW POWER]"
        "rkwifi_server reconnect ssid"
        "rkwifi_server forget ssid"
        "rkwifi_server getSavedInfo"
        "rkwifi_server cancel"
        "rkwifi_server reset"
        "rkwifi_server onoff_test"
        "rkwifi_server ap_cfg"
        "rkwifi_server ap_cfg_clr"
        "rkwifi_server setpir <0/1> = disable/enable PIR"
        "rkwifi_server ota"
        "rkwifi_server start_kp <ip:port:expire>"
        "rkwifi_server stop_kp"

8.4 第三者のアプリケーションポーティング手順 {#84-third-party-application-porting-instructions}

詳細な手順については、IPC SDK の関連文書を参照してください。

8.5 新しいドライバーポーティング指示 {#85-new-driver-porting-instructions}

SDK がまだサポートされていない Wi-Fi を使用する必要がある場合は、以下の手順に従ってポートします。例として、Altobeam ATBM6301 を呼び出します。最初に、工場が SDK ディレクトリに提供する元のドライバーの atbm をコピーします。 sysdrv/drv_ko/wifi/ ディレクトリ:

ls sysdrv\drv_ko\wifi
atbm

ドライバーの Makefile を変更し、主に 3 つのシステム環境変数を変更します。

ARCH=$(ARCH)   // RV1106 is 32-bit
CROSS_COMPILE=$(CROSS_COMPILE)   // Cross-compiler toolchain
$(KERNEL_DIR) // Kernel directory

makefile 内の関連行を見つけて変更を行います。

install:
    @echo "make PLATFORM_CROSS=$(platform)"
-    $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNEL_DIR)
M=$(shell pwd) modules -j12
+    $(MAKE) all -f $(MAKEFILE_SUB) ARCH=$(ARCH)  CROSS_COMPILE=$(CROSS_COMPILE)
KDIR=$(KERNEL_DIR) SYS=$(sys) PLAT=$(platform) -j8
+  # Strip ko is to reduce ko size
+    $(CROSS_COMPILE)strip --strip-debug $(shell pwd)/driver_install/atbm603x_.ko
+   # Copy to the out directory, the system will automatically copy it to the
oem/usr/ko/ directory
+    cp $(shell pwd)/driver_install/atbm603x_.ko $(M_OUT_DIR)

注: ベンダーは、 5.10 カーネルをサポートする Wi-Fi ドライバーを提供しなければなりません! 最後に、insmod_wifi.shファイルを変更し、対応するインサムコンテンツを追加するには、内部の他のプロジェクトを参照してください。

8.6 トラブルシューティングガイド/RFテスト {#86-troubleshooting-guiderf-testing}

Wi-Fi/BT のトラブルシューティングおよび RF のメートルの前のセクションを参照してください。 RFのテストのために、注意して下さい:元のWi-Fiの製造業者かモジュールの工場がテストのタイプおよびテスト プログラムを提供するために必要です。 スタティックバイナリをテストプログラムに使用するのが最善です。そうしないと実行できない状況があります。 その場合、元のSDKクロスコンパイルツールチェーン:アームロックチップ830-linux-uclibcgnueabihf-を実装する必要があります。

試験プログラムを再コンパイルするメーカーまたはモジュール工場。

9. . RVシリーズ低電力無線LAN開発ガイド {#9-rv-series-low-power-wi-fi-development-guide}

詳細は、https://docs.qq.com/doc/p/ad70d285112c58d5aa09b 08eb2d93cf96d85c591を参照してください。

日 時 応用開発 {#10-application-development}

以下は、wpa_supplicant/bluez/bsaなどの複雑なWi-Fi/BT操作を抽象化し、ユーザーフレンドリーなアプリケーション開発インターフェースを提供するアプリケーション開発ライブラリを紹介します。 ビルドルートのネイティブシステムに合わせてカスタマイズします。 Debian/Kylin/UOS のような他のサードパーティー システムに完全な上層の Wi-Fi-BT アプリケーションがあります、従ってこのインターフェイスを使用する必要性はありません。 RKWIFIBT-APP 適用開発およびテスト ガイダンスの参照: https://docs.qq.com/doc/p/a9dd00348639929fc080d20dbbdc4feea89c4983

このトピックを詳しく見る → · 学習ガイド →