Rockchip · AI & Linux Hub

Guide de développement de la puce de roche Linux Wi-Fi/BT

Guide du développeur de la puce de rock Linux Wi-Fi/BT — V7.0.1

Basé sur les sources de Rockchip V7.0.1 en chinois et anglais (2024-04-16), en conservant tous les matériaux techniques des chapitres 1 à 10, configurations, code, figures d’essai et tableaux de paramètres. Le chapitre 11 ne contient que des renseignements sur les contacts/login FTP et est exclu. Cette référence ArmSoM n’établit pas de support pour chaque module de chaque carte : vérifiez le SoC, SDK/BSP, noyau, schéma, alimentation et firmware module. Les commandes, les mesures et les journaux sont des exemples sources; aucune commande ni aucun test matériel/RF n’ont été exécutés.

Chaque source conserve sa numérotation : l’anglais ajoute le titre de l’illustration 2.2.4.1. Les éléments Wi-Fi/BT et antennes sous chinois 4.8.1 deviennent anglais 4.8.2/4.8.3; les méthodes d’essai chinoises 4.8.2 correspondent à l’anglais 4.8.4. Certaines références croisées de sources indiquent encore une numérotation plus ancienne (par exemple 7.1.1, 7.2 et 8.1); localisez la section par titre. Les orthographes sources Synopsys, Bcm44338a1.hcd/bcm43438a1.hcd, udhcpcd, réinitialiser les gopios, les commentaires de polarité GPIO et les numéros IRQ CPU nécessitent une vérification par rapport à la feuille SDK/données. Le code et ses commentaires conservent le langage source; toutes les illustrations sont des figures techniques originales.

Les chiffres originaux contiennent des étiquettes chinoises et anglaises mixtes. Les transcriptions modifiables accompagnent les images de rapports RF et antenne.

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

1. Préface {#1-preface}

Ce document fournit principalement des conseils sur la configuration, le débogage, le développement et l’application de Wi-Fi/BT, y compris les SDK pour Buildroot, IPC et les produits à faible puissance, et Debian.

2. Configuration Wi-Fi/BT {#2-wi-fibt-configuration}

2.1 Guide de configuration du SDK {#21-sdk-configuration-guide}

Tout d’abord, configurer le modèle de puce et de carte avec la commande : ./build.sh puce Vous pouvez modifier la configuration par défaut en supposant que la décongélation suivante soit utilisée :

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"

Configurer le modèle Wi-Fi en faisant menuconfig en définissant le RK_WIFIBT_CHIP (recherche RK_WIFIBT_CHIP par le tapant “/”): ALL_AP : Prise en charge de tous les modules Synopsys (AMPAK) et Realtek inclus dans le SDK ALL_CY : Prend en charge tous les modules Infineon et Realtek inclus dans le SDK Spécifier les modèles: AP6275/AP6358S/AP6212/AP6236 … … RTL8723DS/RTL8822CS … … CYW4354/CYW43438/CYW5557X_PCIE/CYW5557X_PCIE Les modèles pris en charge sont les suivants:

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

Autres modèles pris en charge : Par exemple, des modules domestiques tels que AIC et ATBM, support peuvent être obtenus à partir du serveur FTP.

2.2 Configuration DTS {#22-dts-configuration}

Assurez-vous de configurer DTS selon le schéma.·

2.2.1 Configuration Wi-Fi SDIO {#221-sdio-wi-fi-configuration}

Supporte deux méthodes, principalement différentes en matière de contrôle de puissance et quand la carte sera reconnue. Références des principes-cadres standard : Le simple fournisseur de séquence d’alimentation MMC a pour but de soutenir un ensemble de propriétés communes entre différents modèles SOC. Il nous permet ainsi d’utiliser le même fournisseur pour plusieurs designs SOC.mmc-pwrseq-simple Le REG_ON de Wi-Fi est pris en charge par le cadre mmc, code de référence: kernel/drivers/mmc/core/pwrseq_simple.c Avantage: Toutes les alimentations Wi-Fi sont gérées uniformément par le cadre mmc Inconvénient: Ne supporte pas la reconnagisation de la carte 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>;
  };
};

Cadre traditionnel Le REG_ON de Wi-Fi est contrôlé par net/rfkill/rfkill-wlan.c Plusieurs rmmod/insmod du pilote Wi-Fi sont possibles, correctifs requis: KO Mode Patch

/* 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 Configuration Bluetooth {#222-bluetooth-configuration}

Les configurations liées à l’UART doivent être définies sur les NIP correspondants du port UART utilisé. Assurez-vous de connecter les NIP RTS/CTS tels que conçus dans le SDK! Consultez les précautions Bluetooth. Attention spéciale: De nombreuses anomalies sont causées par ces deux NIP qui ne sont pas connectés ou qui ne sont pas connectés au besoin, ce qui entraîne des exceptions d’initialisation! En supposant que Bluetooth utilise UART4 ci-dessous:

/* 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>;
        };
    };
};

Configuration en amont optionnelle pour le noyau 6.1 largecom-bleutooth

# 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 Configuration du domaine de puissance IO {#223-io-power-domain-configuration}

Important : Se référer aux instructions de configuration du domaine de puissance correspondant au SDK Se reporter à ce qui suit, il convient de souligner que les appareils avec SDIO3.0 doivent être fournis avec

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 Configuration du Wi-Fi PCIE {#224-pcie-wi-fi-configuration}

Il est fortement recommandé de lire les documents suivants dans le répertoire 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 Les trois points clés suivants sont trouvés selon le schéma : Il existe deux types de base de Wi-Fi avec interface PCIe : modules attachés à la carte et interface M2, mais leurs points clés sont les mêmes : VBAT/VCC3V3 : L’alimentation totale est 3.3V, habituellement, c’est une alimentation constante ; WIFI_REG_ON : La broche réinitialisée/activable de la SoC, qui reste élevée pendant le démarrage ; PCIE_PERST_L/PERSTO : La broche réinitialisée de la partie PCIe de la SoC, qui doit être configurée correctement sous le nœud PCIE correspondant dans DTS.

Configurer correctement le contrôleur et le PHY selon le schéma, et se référer aux trois documents mentionnés ci-dessus. Voici un exemple simple:

// 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 Correspondance entre RK3588 Schematic et 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 Configuration Wi-Fi USB {#225-usb-wi-fi-configuration}

Il est fortement recommandé de lire les documents de référence suivants liés à l’USB: docs\Common\USB\Rockchip_Developer_Guide_USB_EN.pdf. La configuration du nœud Wi-Fi est divisée en deux scénarios:

// 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
};

La référence de configuration du nœud USB est la suivante:

/* 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 (interface carte SD) connecté à puce Wi-Fi {#23-sdmmc-sd-card-interface-connected-to-wi-fi-chip}

Parfois, en raison de besoins spéciaux, il est nécessaire de connecter la puce Wi-Fi à l’interface SDMMC. Trouvez les deux configurations suivantes et changez &sdio en &sdmmc et désactivez les nœuds inutilisés; Attention spéciale : La broche SDMMC_DET doit être tirée bas sur le matériel.

&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 Configuration du noyau {#24-kernel-configuration}

2.4.1 Configuration du noyau Wi-Fi {#241-wi-fi-kernel-configuration}

Les pilotes Wi-Fi ont été déplacés dans le répertoire externe/rkwifibt/drivers/. Pour référence, veuillez consulter le Cadre Wi-Fi/BT et les instructions de compilation. Configuration nécessaire du noyau (peut être modifiée en module selon votre situation actuelle):

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 Configuration du noyau Bluetooth {#242-bluetooth-kernel-configuration}

Les modules Synopsys (AMPAK) et Infineon (Azurewave/CY) utilisent le pilote CONFIG_BT_HCIUART par défaut du noyau; Realtek utilise ses propres pilotes hci uart/hci_usb, les répertoires de code source du pilote correspondant étant:

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

Chargez en mode ko, donc lors de l’utilisation de Realtek Bluetooth, il est essentiel d’éteindre la configuration CONFIG_BT_HCIUART du noyau ! #CONFIG_BT_HCIUART n’est pas défini par les paramètres de configuration Kernel

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. Cadre Wi-Fi/BT et instructions de compilation {#3-wi-fibt-framework-and-compilation-instructions}

3.1 Fichiers de compilation {#31-compilation-files}

Les fichiers impliqués dans le Wi-Fi/BT sont décrits comme suit :

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

Les noms correspondants du firmware Wi-Fi/BT pour les modèles AMPAK/Infineon sont:

├── 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 Pilotes et Firmware: (Note: Realtek Wi-Fi n’a pas besoin d’un fichier firmware, seulement Bluetooth fait)

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 Règles de compilation {#32-compilation-rules}

Il est recommandé que les développeurs lisent attentivement les scripts de compilation suivants! Les fichiers de règles de compilation correspondants sont divisés en deux parties :

/*
 * 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

Outils Compilation (y compris 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

Remarque : Il est important d’apprendre à lire la sortie de journal imprimée lors de la compilation de make rkwifibt-rebuild , qui comprend le processus de compilation/copie des fichiers mk ci-dessus, et est utile pour analyser et résoudre les erreurs de compilation/copie.

3.3 Fichiers Wi-Fi/BT et leurs emplacements {#33-wi-fibt-files-and-their-locations}

Les développeurs doivent connaître les fichiers et les emplacements utilisés par Wi-Fi/BT. Lorsque des problèmes de démarrage du Wi-Fi/BT sont apparus anormalement, il est nécessaire de confirmer l’existence des fichiers Wi-Fi/BT firmware/config et de vérifier s’ils correspondent au modèle Bluetooth. Prendre AP6255 comme exemple L’emplacement du firmware Wi-Fi/BT dans le SDK :

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

Après avoir compilé selon les règles de compilation, les fichiers correspondants sont copiés dans le répertoire de sortie du projet : (system/vendor est un lien vers le même répertoire)

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)

Modules Realtek, prenant comme exemples RTL8723DS/RTL8821CU L’emplacement du micrologiciel Wi-Fi/BT dans le SDK:

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

Après compilation, les fichiers correspondants sont copiés dans le répertoire de sortie du projet :

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 Mise à jour de compilation {#34-compilation-update}

La commande compilation est la suivante :

# 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

Remarque : Observez la sortie de ./build.sh wifibt pour voir l’ensemble du processus de compilation.

3.5 Instructions d’utilisation Wi-Fi/BT {#35-wi-fibt-operation-instructions}

Les développeurs doivent être familiers avec le contenu des trois scripts suivants, qui est crucial pour résoudre les problèmes ! Les règles pour démarrer Wi-Fi/BT sont les suivantes:

# 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 Essais fonctionnels du matériel et du logiciel {#4-wi-fibt-hardware-and-software-functional-testing}

4.1 Système de base {#41-buildroot-system}

4.1.1 Essais Wi-Fi STA {#411-wi-fi-sta-testing}

Charger le pilote, normalement, ifconfig -a affichera wlan0. insmod bcmdhd.ko/RTL8723DS.ko Activer Wi-Fi ifconfig wlan0 up Démarrer wpa_supplicant wpa_supplicant -B -i wlan0 -c /data/cfg/wpa_supplicant.conf Fichier de configuration parsing:

# 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
}

Note : Le fichier wpa_supplicant.conf doit être modifié en fonction de l’emplacement de stockage de la plateforme que vous avez utilisée. Désactiver Wi-Fi ifconfig wlan0 vers le bas killall wpa_supplicant

4.1.2 Analyse des AP à proximité {#412-scanning-for-nearby-aps}

La commande wpa_cli communique avec le processus wpa_supplicant, ce qui garantit que le processus wpa_supplicant est en cours.

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

Wi-Fi / BT

Remarque : Vérifiez si le nombre de points d’accès scannés correspond au nombre approximatif de routeurs autour de vous, et comparez-le avec le balayage Wi-Fi sur votre appareil mobile (si le module client ne supporte pas le Wi-Fi 5G, comparez seulement le nombre de Wi-Fi 2.4G). En outre, vérifier la résistance du conducteur au signal le plus près de l’éprouveur. Si le routeur est très proche du testeur mais que la résistance au signal est très faible (généralement, bon : -20 à -50, légèrement faible mais acceptable : -50 à -70, mauvais : -70 à -90), il faut vérifier si le module Wi-Fi est connecté à une antenne, si les spécifications RF du module sont conformes, etc. Voir les spécifications RF Wi-Fi/BT Hardware.

4.1.3 Connectez-vous au routeur {#413-connect-to-router}

Modifier le fichier de configuration

# 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 Vérification des points d’accès à l’espace ouvert Wi-Fi AP {#42-wi-fi-ap-hotspot-verification}

Le SDK intègre les programmes pertinents, et en exécutant softapDemo apName (pour lancer un hotspot nommé apName sans chiffrement par défaut), le mode hotspot peut être activé. L’emplacement du code et des fichiers compilés sont les suivants:

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

Si le code source softapDemo n’est pas trouvé, il peut être téléchargé depuis l’adresse suivante vers le répertoire externe :

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

Realtek Module: Utilisez p2p0 pour la fonction softap et générer p2p0 à travers la configuration du pilote du noyau. S’il n’y a pas de nœud p2p0, veuillez vérifier la configuration ici:

+++ 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

Module AMPAK/Azurewave : Utilisez wlan1 comme fonction softap et utilisez la commande iw pour générer le noeud wlan1. interface iw phy0 ajouter wlan1 gestion de type Déboguage et modification de personnalisation :

// 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);
    }

Après l’exécution de la commande, vous pouvez voir l’AP correspondante sur l’interface de réglage Wi-Fi du téléphone mobile. Dans la négative, veuillez résoudre le problème : d’abord, assurez-vous que les fichiers de configuration susmentionnés sont correctement configurés ; Confirmez si l’ifconfig a vu le noeud wlan1 ou p2p0 ; Vérifiez si les processus hostapd/dnsmasq ont démarré avec succès ;

4.3 Essai de vérification BT {#43-bt-verification-test}

Premièrement, assurez-vous que le dts/Buildraot est configuré correctement, se reporter aux sections 2/3.7.2. Cette section fournit des instructions pour deux types de modules BT couramment utilisés. Avec la configuration correcte, le système générera un script nommé bt_pcba_test (ou dans le dernier SDK, un script nommé bt_init.sh). Module 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

Module 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 représente le fichier firmware pour le modèle correspondant de BT, /dev/ttyS4 indique quel port UART le Bluetooth utilise. Note : Les fichiers tels que rtk_hciattach , hci_uart.ko , bcm43438a1.hcd ne sont générés que lorsque le bon module Wi-Fi/BT est sélectionné dans la configuration Buildroot comme décrit dans la section 2. Si ces fichiers manquent, veuillez vérifier la configuration (voir la section 3). Après l’exécution du script, exécutez comme suit : Note : Si la commande hciconfig n’est pas disponible, sélectionnez BR2_PACKAGE_BLUEZ5_UTILS dans la configuration Buildroot, compilez et mettez à jour pour tester hciconfig hci0 up hciconfig –a Normalement, les éléments suivants doivent être disponibles :

Wi-Fi / BT

BT Scan: analyse hcitool

Wi-Fi / BT

Pour les situations anormales, veuillez consulter la section 7.2 pour le dépannage.

4.4 Wi-Fi Wake on LAN (WoL) {#44-wi-fi-wake-on-lan-wol}

Actuellement, Wi Fi prend en charge la fonction de réveil réseau, ce qui signifie qu’une fois qu’un périphérique est connecté à un point d’accès (AP) et a obtenu une adresse IP, il peut être réveillé par un paquet réseau sans fil (ping) après que l’appareil a dormi. La règle générale est que tout paquet réseau envoyé au périphérique peut réveiller le système. Modifier le fichier wpa_supplicant.conf et ajouter la configuration suivante:

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

Pour Realtek Wi-Fi, veuillez vérifier les configurations suivantes du Makefile correspondant dans le pilote :

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

Configuration DTS : Assurez-vous que les schémas indiquent que le code PIN WIFI_WAKE_HOST (ou WL_HOST_WAKE) est connecté au SoC, puis vérifiez que la configuration DTS suivante est correcte :

WIFI,host_wake_irq = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;

Testez le système et le sommeil Wi-Fi:

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

A ce stade, les appareils du même réseau local peuvent pinger ce périphérique, et normalement, vous trouverez le système a été réveillé. Notez qu’après le réveil du système, il est nécessaire de restaurer Wi-Fi dans l’état normal de fonctionnement:

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

Dépannage : Si le système ne se réveille pas comme prévu, veuillez vérifier si la broche de réveil est configurée correctement et si le niveau de tension est correct, et si le 32.768k a été éteint, etc.

4.5 Mode de veille 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

Wi-Fi Realtek

# 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 Vérification de la P2P Wi-Fi {#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 Fonction de raccordement des cartes réseau {#47-network-card-bridging-function}

Scénario : Wi-Fi lance wlan0 pour se connecter à une AP accessible, et en conjonction avec la Section 4.2, il démarre wlan1 ou p2p0 comme un point d’accès, permettant à un smartphone de se connecter au point d’accès et d’accéder à Internet. La configuration est la suivante, et le noyau a les paramètres suivants activés:

+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

Exécutez les deux commandes suivantes, l’adresse IP étant celle configurée lors du démarrage du 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 Spécifications RF du matériel Wi-Fi/BT {#48-wi-fibt-hardware-rf-specifications}

4.8.1 Éléments d ‘ essai {#481-testing-items}

4.8.2 Section Wi-Fi/BT {#482-wi-fibt-section}

Tel que: Transmission de puissance, EVM, Déviation de fréquence cristalline, Sensibilité du récepteur, etc. Exemple: (b/g/n/ac)

Wi-Fi / BT

802.11b / 20 MHz / 11 Mbps / Antenne 0

métrique Unité CH1 CH7 CH13 Spécification
Pouvoirs exercés dBm 17.17 16.86 17.21 <20 dBm
Transmettre le masque de spectre GHz passe passe passe  
Transmettre la précision de modulation dB / % 6.65% 5.91% 4.26% <35%; détection de pointe
Tolérance de fréquence du centre de transmission ppm 6.65 5.91 5.27 ±10 ppm; marge de 10 ppm
Sensibilité minimale du niveau d’entrée du récepteur dB -84 -83 -82 -78; 2 dB marge
Niveau d’entrée maximal du récepteur dBm       » -10 dBm

4.8.3 Section d’antenne {#483-antenna-section}

Essai passif S11 et essai actif en direct des antennes Wi-Fi dans les appareils Exemple :

Wi-Fi / BT

Wi-Fi 2G TRP

Mode Chaîne Fréquence (MHz) Tx moyenne (dBm) Moyenne de sensibilité (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

Et organiser les tests ci-dessus en un rapport officiel.

4.8.4 Outils et méthodes d’essai {#484-testing-tools-and-methods}

Les documents PDF/TXT mentionnés ci-dessous peuvent être trouvés dans le répertoire docs/linux/wifibt. Si le client n’a pas d’équipement d’essai professionnel ou a des questions sur les essais, veuillez contacter le fabricant du module pour obtenir de l’aide. Pour d’autres plateformes telles que icomm-semi/altobeam/AIC, veuillez consulter le fabricant de modules ou le fabricant d’équipement d’origine correspondant pour les outils et méthodes d’essai.

4.8.4.1 Essais de Realtek {#4841-realtek-testing}

Généralement, il se divise en deux types: COB et modules. Les modules sont généralement strictement testés par le fabricant du module et sont livrés par défaut avec des données d’étalonnage pré-brûlées à l’efuse interne. Les clients doivent seulement tester et vérifier si les indicateurs de performance sont qualifiés. Cependant, COB exige la conception de circuits périphériques Wi-Fi et l’ajout de composants, il est donc nécessaire de coopérer avec Realtek pour un essai complet d’étalonnage RF, et d’intégrer les données étalonnées dans l’efuse de la puce ou de la charger par le pilote. Pour plus de détails, veuillez consulter directement le fabricant du module. Essais 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 Tester Consultez le guide utilisateur de l’outil -MP pour linux20180319.pdf - - (consultez le fabricant du module ou les fournisseurs pour obtenir du contenu spécifique). Il est particulièrement important de noter que le test nécessite un fichier firmware Bluetooth dédié fourni par le fabricant du module pour les essais, et il doit être placé dans le répertoire spécifié pour tester les indicateurs 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 Essai de puces Synopsys/Infineon {#4842-synopsysinfineon-chip-testing}

Tests Wi-Fi Premièrement, il est nécessaire de remplacer par le firmware de test : Chaque module AP correspond à un firmware de test différent, par exemple :

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

Les fw_bcmxxx_mfg.bin et APxxxx doivent correspondre à votre modèle de module, sinon il ne peut pas être testé ! Par conséquent, d’abord, confirmer s’il existe un firmware d’essai du modèle correspondant et, dans la négative, l’obtenir auprès du fabricant du module. Le dernier SDK a intégré le firmware de test pour les modèles pris en charge, donc utilisez le script de test intégré directement pour mettre Wi-Fi en mode de test 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

Les SDK obsolètes n’ont pas de firmware de test intégré, et veuillez vous référer à l’exemple suivant:

# 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

Si elle est faite correctement, l’exécution de wl ver va imprimer une chaîne contenant les caractères “WL_TEST”, indiquant qu’elle a entré le mode test. Pour des tests détaillés, veuillez consulter:

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

Test Bluetooth Après avoir exécuté le script bt_init.sh (scrime intégré SDK, reportez-vous à la section 3.3), exécutez ce qui suit : (Note : Si la commande hciconfig n’est pas disponible, veuillez sélectionner BR2_PACKAGE_BLUEZ5_UTILS dans la configuration Buildroot pour compiler et mettre à jour le test)

hciconfig hci0 up
hciconfig -a

Si un noeud hci0 apparaît, il indique que l’initialisation est complète. Si cela n’apparaît pas, il y a deux possibilités :

  1. La configuration Bluetooth DTS est anormale, ou il y a une anomalie matérielle, ou la configuration du port UART est incorrecte, ce qui provoque l’initialisation de la défaillance;
  1. La configuration du fichier firmware Bluetooth est incorrecte ou le fichier manquant; Pour les deux questions ci-dessus, veuillez consulter les sections 2/3 pour le dépannage lié à BT; Pour des instructions de test spécifiques, veuillez consulter:
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 Essais de performance Wi-Fi {#49-wi-fi-performance-testing}

Utiliser iperf pour tester les performances, veuillez noter : Deux points qui affectent les performances Il est essentiel de terminer les tests RF Wi-Fi et les tests OTA d’antenne pour s’assurer que les mesures sont normales avant les performances des tests; autrement, il est inutile. Si des fluctuations importantes de données sont observées, veuillez confirmer à un endroit où l’interférence est minime, comme un espace ouvert ou un sous-sol (il est préférable de tester dans une pièce blindée). Environnement d’essai En raison du niveau élevé d’interférence dans les environnements ouverts, il est recommandé de tester dans un environnement de pièce blindée, en s’assurant d’abord que le Wi-Fi peut se connecter normalement à l’AP et obtenir une adresse IP. Points d’essai La taille du débit, ainsi que sa stabilité et toutes les fluctuations. Canaux routeurs Les essais doivent être effectués sur des canaux bas, moyens et élevés, tel que les canaux 1/6/11: Commandes d’essai Veuillez vous référer au document ci-dessous lié pour les instructions détaillées iPerf - iPerf3 et la documentation utilisateur iPerf2 iperf2 / iperf3 (es.net) Note: La commande iperf pour le tableau doit être configurée dans Buildroot: BR2_PACKAGE_IPERF = y BR2_PACKAGE_IPERF3 = y

5. Wi-Fi/BT Dépannage {#5-wi-fibt-troubleshooting}

Important : Vérifiez toujours les journaux d’abord et dépannez toutes les anomalies basées sur le journal!!! Les problèmes Wi-Fi/BT peuvent généralement être classés en trois types : les périphériques SDIO/USB/PCIE non reconnus; la carte SDIO reconnue, mais le chargement du micrologiciel a échoué; les problèmes de performance, comme l’incapacité de se connecter/faible balayage/déconnections probables, etc.;

5.1 Brève description du processus d’identification Wi-Fi {#51-brief-description-of-wi-fi-identification-process}

Interface SDIO : Lors du démarrage, le framework MMC du noyau reconnaîtra la carte SDIO, d’abord en analysant l’attribut GPIO configuré par réinitialisation de l’attribut gopios du noeud sdio_pwrseq en dts, le GPIO est le WL_REG_ON, puis le tire haut. Il envoie ensuite des commandes d’initialisation au module via SDIO_CLK/CMD/DATA. Au départ, SDIO_CLK enverra des commandes au module Wi-Fi à une fréquence basse de 400/300/200K pour obtenir des informations de base sur le SDIO Wi-Fi, comme s’il s’agit de SDIO2.0 (La CLK maximale est de 50M) ou 3.0 (La CLK maximale est de 208M), et s’il prend en charge 4 fils ou 1 fil, etc. Ensuite, selon les spécifications supportées, la fréquence SDIO_CLK est augmentée à la haute fréquence correspondante de 50M/150M, et l’initialisation de base est terminée. Vous pouvez voir le journal suivant :

# 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

Interface USB/PCIE : Le processus d’identification de ces deux interfaces est plus complexe. Veuillez consulter les documents liés à USB/PCIE dans le répertoire doc. Une fois l’identification terminée : Interface USB : Si elle est reconnue normalement, l’exécution de lsusb affichera les informations suivantes :

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

Ou dmesg | grep USB pour voir si le périphérique USB a été reconnu. Interface PCIE : Si elle est reconnue normalement, l’exécution de lspci affichera les informations suivantes :

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

Remarque : Les processus d’identification ci-dessus sont tous effectués pendant le processus de démarrage, et seulement après que le bon périphérique est reconnu, le pilote Wi-Fi sera correctement chargé !

5.2 Dépannage des problèmes de Wi-Fi {#52-troubleshooting-wi-fi-issues}

Wi-Fi est une interface SDIO : Il y a généralement deux cas : Premièrement, confirmez en cochant le journal du noyau pour le LOG suivant. Si non, il indique que la carte SDIO n’a pas été reconnue. Pour de telles questions, voir la section 7.1.1.

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

Si la reconnaissance normale du SDIO est vue dans le LOG, mais wlan0 n’est pas présent ou ne parvient pas à monter.

5.2.1 Anormalité Wi-Fi : l’IDSE n’est pas reconnue {#521-wi-fi-abnormality-sdio-not-recognized}

Premièrement, il est fortement recommandé de réexaminer soigneusement la configuration DTS/KERNEL au chapitre 2!!! Suivez ces étapes pour résoudre les problèmes en séquence selon le LOG du noyau :

5.2.1.1 Mesurer la tension {#5211-measure-voltage}

Mesurer les niveaux de tension et la fréquence CLK des NIP correspondants selon les étiquettes pour s’assurer qu’ils sont corrects (Note : le mode SDIO 3.0 doit être 1.8V).

Wi-Fi / BT

Utilisez un oscilloscope pour mesurer le moment de VBAT/VDDIO/WL_REG_ON et s’assurer qu’il satisfait aux exigences suivantes :

5.2.1.2 Séquence de l’heure {#5212-timing-sequence}

Remarque : Voici les exigences relatives au calendrier des modules AMPAK. Il est important de vérifier les exigences du diagramme de chronométrage dans la fiche technique du module utilisé et d’accorder une attention particulière au chronométrage du VDDIO.

Wi-Fi / BT

5.2.1.3 Erreur de configuration WL_REG_ON dans le DTS {#5213-wl_reg_on-configuration-error-in-the-dts}

Causes le Wi-Fi permettent de ne pas tirer haut. Il est possible de tester sa forme d’onde avec un oscilloscope pour voir si elle est tirée haut ou bas, et de vérifier si l’amplitude de tension (1,8/3.3V) répond aux exigences; si des tractions continues élevées et basses sont mesurées, c’est une situation normale parce que l’initialisation SDIO réessayera plusieurs fois. Une fois l’identification réussie : WL_REG_ON sera tiré haut, et si l’identification échoue, elle sera tirée bas ; si elle reste basse, elle indique une configuration DTS incorrecte. Du côté matériel, tirer directement WL_REG_ON haut pour la vérification, si la reconnaissance est possible, il suggère également une configuration DTS WL_REG_ON incorrecte.

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 Erreur de configuration WL_REG_ON dans le DTS {#5214-wl_reg_on-configuration-error-in-the-dts}
5.2.1.5 Domaine de puissance VDDIO/SDIO/IO {#5215-vddiosdioio-power-domain}

Le VDDIO fourni à PIN12 doit être 3.3/1.8V, et le SDIO_CMD/SDIO_DATA0~3 correspondant doit également être 3.3V ou 1.8V. VDDIO: La tension d’alimentation ne correspond pas à la configuration du domaine de puissance DTS (voir la configuration du domaine de puissance IO).

5.2.1.6 SDIO_CLK absence de forme d’onde {#5216-sdio_clk-lacking-waveform}

Les réglages incorrects dans le domaine de puissance d’E/S peuvent entraîner l’absence d’une forme d’onde sur le CLK; Vérifiez si une résistance de traction a été ajoutée à la broche CLK, et testez sans cette dernière; La forme d’onde CLK doit être capturée en réglant le mode de déclenchement;

5.2.1.7 Alimentation insuffisante ou fluctuation excessive de la tension {#5217-insufficient-power-supply-or-excessive-voltage-fluctuation}

VCC_WL/VBAT/VDDIO_SDIO: Alimentation insuffisante ou fluctuation excessive de la tension

# 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}

Référence de l’horloge externe (Caractéristiques du signal externe de l’APL)

Paramètre Spécification Unités
Fréquence d’entrée nominale 32.768 kHz
Précision de la fréquence ± 30 ppm
Cycle des droits 30 - 70 %
Amplitude du signal d’entrée 400 à 1800 mV, p-p
Type de signal Onde carrée -
Impédance d’entrée >100k <5 Ω pF
Attraction d’horloge (intégrée sur 300Hz – 15KHz) <1 Hz
Puissance de sortie haute tension 0,7Vio - Vio V

CLK_32K_OUT: 32.768K n’a pas de forme d’onde, ou la précision de forme d’onde ne répond pas aux exigences du tableau ci-dessus!

# 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 Qualité/capacités/inductions de l’acheminement des BPC {#5219-inappropriate-pcb-routing-qualitycapacitancesinductances}

SDIO_CLK/CMD/DATAX : Des problèmes tels que le routage anormal des BPC, les capacités et les inductances inappropriées, le mauvais contact et la mauvaise soudure peuvent entraîner des exceptions d’initialisation ou l’incapacité de fonctionner à haute fréquence. Il est possible de réduire la fréquence de confirmation (modifier la fréquence max sous le nœud &sdio). Si une réduction de fréquence est possible, les ingénieurs du matériel devraient mesurer la forme d’onde pour confirmer la conformité aux exigences relatives au temps CLK/CMD/DATA dans la feuille de données du module Wi-Fi. Méthode de modification de la fréquence:

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

Veuillez vérifier si les tensions SDIO Wi-Fi et le contrôleur hôte sont mal appariées et vérifier que la configuration du logiciel io_domain correspond au matériel (voir section 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}

WLAN pour réveiller RK HOST WL_HOST_WAKE PIN erreur de configuration ou niveau de puissance intermittent ou faible joint de soudure, causant les anomalies suivantes ou le système suspendu:

# 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 Mauvaise soudure sur SDIO_D1 ~3 épingle {#52112-poor-soldering-on-sdio_d13-pin}

Si des journaux similaires à ceux qui suivent apparaissent, et que le problème persiste même après avoir réduit la fréquence max- à moins de 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

Puis modifiez-le pour tester en mode 1 ligne:

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

S’il est efficace, il indique qu’il y a un problème matériel avec l’une des broches SDIOD1~3, comme une mauvaise jointure de soudure ou une connexion incorrecte.

5.2.1.13 Module/puce défectueux {#52113-defective-modulechip}

Il y a peu de probabilité que la puce Master ou le module Wi-Fi soit défectueux. Il est recommandé de vérifier cette situation en testant plusieurs unités.

5.2.1.14 Exception pour le multiplexage 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 Renseignements supplémentaires {#52115-additional-information}

Si les étapes de dépannage ci-dessus ne résolvent pas le problème, téléchargez les fichiers suivants dans le système Redmine : configuration dts/dtsi, log complet du noyau dmesg, et diagrammes schématiques PDF. Fournir également les diagrammes de forme d’onde sur la puissance pour les trois lignes : WIFI_REG_ON, Wi- Fi_CLK et Wi-Fi CMD.

5.2.2 Dépannage des problèmes Wi-Fi USB {#522-usb-wi-fi-troubleshooting}

Normalement, un périphérique Wi-Fi USB affiche des informations similaires à celles qui suivent ; sinon, le pilote Wi-Fi ne se charge pas !

# 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

Si les informations ci-dessus ne sont pas présentes, reportez-vous à la section 2.2 pour dépanner le module, activez la broche VBAT/WL_REG_ON pour vérifier si elle est tirée haut et si les configurations USB sont correctes ! Note : Pour RV1106/1103, il est parfois nécessaire d’entrer manuellement la commande suivante pour la reconnaissance : echo 1 > /sys/devices/platform/ff3e0000.usb2-phy/otg_mode

5.2.3 Précautions concernant le Wi-Fi Realtek {#523-realtek-wi-fi-precautions}

5.2.3.1 WLAN0 détecté mais non scanné {#5231-wlan0-detected-but-scanning-abnormal}

Modules Wi-Fi FN-Link : PIN25 (correspondant au 22e NIP de la puce COB) est une broche multiplexée interne de la puce. Une fonction est de servir de PCM_OUT, se connectant à la PCM_IN de la fonctionnalité d’appel PCM de Rockchip SoC pour Bluetooth; l’autre fonction est comme la sélection de mode de connexion Wi-Fi IC LDO_SPS_SEL (SPS ou LDO). Lorsque cette broche est à un niveau bas, elle indique le mode SPS, et si elle est à un niveau élevé, elle indique le mode LDO. Par conséquent, ce NIP doit être soit à un niveau élevé ou faible; si un demi-niveau est détecté, il peut causer un dysfonctionnement du Wi-Fi, comme être incapable de scanner SDIO ou ne pas détecter les AP. Si un demi-niveau est mesuré, un traitement de traction doit être appliqué sur le matériel. Modules LB-LINK: PIN7 doit être connecté avec une résistance à la traction.

5.2.3.2 Soutien réel à SDIO 3.0 {#5232-realtek-support-for-sdio-30}

Lorsque vous utilisez des modules haut de gamme tels que RTL8821CS qui prennent en charge 3.0, il y a une probabilité que l’initialisation puisse échouer, avec le log anormal suivant:

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

Veuillez ajouter le patch suivant:

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 Carte SDIO Wi-Fi détectée mais mise en place {#524-wi-fi-sdio-card-detected-but-wlan0-up-failure}

La connexion suivante dans le journal des kmesg indique que la carte SDIO est reconnue, mais le Wi-Fi ne fonctionne toujours pas.

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

Le fichier firmware n’existe pas ou le nom du fichier ne correspond pas au modèle de module (seulement pour les modules AMPAK et 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

L’alimentation électrique du module Wi-Fi est instable.

[ 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

Le module Realtek connaît des anomalies de numérisation, comme ne pas être capable de détecter une 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

Les modes buildin et KO de configuration du noyau sont sélectionnés ou mal appariés

Le pilote Wi-Fi est chargé trop tôt, ce qui entraîne une exception. Le journal indique que le pilote est chargé dans un délai de 1 seconde, auquel point le dispositif sdio/usb n’a pas encore été énuméré. Vérifiez la section de configuration du noyau. Le système charge deux KO simultanément, un bcmdhd.ko et l’autre 88xx.ko, ce qui entraîne une exception. La raison en est décrite à la section 3 des instructions de compilation.

5.2.5 Anomalie Wi-Fi SDIO après une période de course {#525-sdio-wi-fi-anomaly-after-running-for-a-period}

SDIO_CLK/CMD/DATAX : Des problèmes tels que le routage anormal des BPC, les condensateurs et les inducteurs qui ne répondent pas aux exigences, le mauvais contact ou la mauvaise soudure peuvent entraîner des anomalies d’initialisation ou l’incapacité de fonctionner à haute fréquence. Il est possible de réduire la fréquence de confirmation (modifier la fréquence max sous le nœud &sdio). Si une réduction de fréquence est possible, il faut vérifier la forme d’onde matérielle pour s’assurer qu’elle satisfait aux exigences de synchronisation CLK/CMD/DATA dans la feuille de données du module Wi-Fi. SDIO2.0: diagramme de synchronisation à haute vitesse SDIO (CLK <= 50M); SDIO3.0: spécifications de synchronisation des bus SDIO en modes SDR (SDR104/DDR50) (50M < CLK <= 208M);

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

Case 2: Wi-Fi et la tension SDIO de l’inadéquation SoC, veuillez vérifier si la configuration du logiciel io_domian est compatible avec le matériel (voir section 2.2.3).

5.2.6 Questions relatives à la connectivité Wi-Fi: Défaillance de connexion AP, instabilité, connexion lente {#526-wi-fi-connectivity-issues-ap-connection-failure-instability-slow-connection}

Premièrement, comprendre le processus de connexion, qui comprend les étapes suivantes:

  1. Scanner et configurer SSID; si le SSID n’est pas trouvé, le processus de numérisation se répétera jusqu’à ce que le SSID souhaité soit détecté.
  1. Ouverture de la connexion et achèvement de la poignée de 4 mains.
  1. Obtenir une adresse IP par l’intermédiaire du DHCP. Ces problèmes sont généralement causés par les spécifications RF ou antenne de la puce ou du module Wi-Fi. La méthode de vérification est la suivante : Se reporter à la section 4.1 pour un simple test de connexion logicielle ! Spécifications RF Premièrement, fournir un rapport d’essai sur les spécifications RF de la carte. Si vous n’en avez pas, commencez par tester les spécifications de base. Deuxièmement, si l’appareil est une unité complète incluant le cas, veuillez vérifier si les spécifications OTA (Over-The-Air) pour l’antenne ont été testées. Sinon, prioriser les tester. Assurez-vous que les spécifications RF Wi-Fi et les rapports de test OTA de l’antenne pour l’unité complète sont qualifiés, confirmant que les spécifications matérielles sont normales (puissance de transmission, EVM, déviation de fréquence cristalline, réception de sensibilité).

Comparaison de numérisation Effectuez une comparaison de numérisation de base : placez le dispositif de test et un smartphone à la même distance du routeur et comparez le nombre de PA numérisés et leur force de signal avec un smartphone (ou un concurrent similaire) pour déterminer de façon préliminaire si les spécifications matérielles sont normales. La méthode de numérisation est référencée au chapitre 4.1. Ici, nous vous expliquons comment comparer avec un smartphone. Prenez un téléphone Android, allez dans Paramètres, puis Options de développeur, et activez l’option de journalisation détaillée WLAN. Retournez à l’interface des paramètres du WLAN pour voir les informations détaillées des AP, y compris RSSI. En comparant le nombre de points chauds et la force du signal avec le scan du smartphone, vous pouvez déterminer de façon préliminaire si les spécifications matérielles sont qualifiées. Interférence Éliminer les facteurs d’interférence, comme un grand nombre de dispositifs sans fil 2.4/5G se connectant simultanément dans l’environnement actuel, causant des interférences importantes. Dans ce cas, placer le dispositif de test et un smartphone de comparaison (ou un concurrent de spécification similaire) au même endroit. Si les deux sont anormales, on peut juger qu’il y a interférence. Si le smartphone fonctionne normalement, il peut être déterminé qu’il y a une anomalie dans les spécifications matérielles. Distance Éliminer les facteurs de distance, car un signal trop faible en raison de la distance (la force de signal de l’AP connectée est comprise entre -70 et -90 comme le montre wpa_cli scan/scan_r) peut entraîner une défaillance de la communication. Vous pouvez rapprocher les appareils pour confirmer. Compatibilité du routeur Éliminez les problèmes de compatibilité du routeur en testant avec les routeurs de différents fabricants et modèles. Cohérence Éliminer les anomalies d’un seul panneau en comparant les tests avec deux à trois panneaux. Demander de l’aide aux fabricants de modules Vous pouvez directement demander de l’aide aux fabricants de modules ou au fabricant de Wi-Fi. Ils ont des instruments de sniffage de paquets professionnels pour capturer les paquets dans l’air, qui peuvent rapidement résoudre le problème. Apportez l’environnement à notre bureau de Shenzhen pour confirmation

5.2.7 Attentes des participants à la procédure de suivi {#527-throughput-not-meeting-expectations}

Si c’est une interface SDIO, l’interface de la plate-forme RK ne prend en charge que 150M et le protocole prend en charge jusqu’à 208M, donc il y aura une perte de performance inhérente au matériel; Ensuite, les indicateurs RF devraient être testés d’abord, et si nécessaire, fournir le rapport de test et le rapport de test de l’antenne OTA; Ensuite, trouver une salle blindée ou un environnement propre comme un stationnement souterrain pour les essais afin d’éliminer les interférences environnementales et de s’assurer qu’un environnement propre est normal; Enfin, La vérification de la fixation des fréquences du CPU/DDR peut être effectuée;

# 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 Anomalies de la PI {#528-ip-anomalies}

Impossible d’obtenir une adresse IP ou de connaître des conflits d’adresses IP. Veuillez confirmer si le processus dhcpcd ou udhcpc est actif. dhcpcd: Par défaut utilisé par le SDK, il commence avec le système et est un client DHCP plus complet. udhcpcd: Un client DHCP simplifié à partir de la boîte à tâches. Remarque : Ne pas activer les deux processus simultanément, n’utilisez qu’un seul d’entre eux !

5.2.9 Réveille-toi anormalement en mode sommeil {#529-abnormal-wake-up-from-sleep-mode}

Après avoir pénétré dans le mode sommeil, l’appareil est souvent réveillé par Wi-Fi. Les scénarios suivants doivent être exclus : L’horloge de 32.768k du module Wi-Fi est désactivée après que l’appareil soit en mode veille ; Le signal WIFI_REG_ON est tiré bas ; Le PIN WIFI_WAKE_HOST est instable matériellement, avec un niveau jitter (normalement à un niveau bas, et il déclenche quand il va haut) ; Le module AP/CY n’exécute pas les commandes spécifiques suivantes pour filtrer les paquets diffusés ou multicast avant et après l’entrée du Wi-Fi en mode veille :

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

5.2.10 PING Inaccessibilité ou probabilité élevée de latence {#5210-ping-unreachable-or-high-probability-of-latency}

Les mesures RF/antenne n’ont pas été mesurées; Il est fort probable que le Wi-Fi effectue une opération de numérisation, ce qui entraîne une latence importante du ping; Le routeur ou le pare-feu PC peut être activé, ce qui entraîne un blocage des opérations de ping;

5.2.11 Modifications personnalisées du client {#5211-customer-custom-modifications}

Si vous avez apporté des modifications au code de conduite, veuillez nous en informer. Nous recevons souvent des rapports sur des problèmes inhabituels qui, après enquête, sont trouvés causés par les clients modifiant les configurations de pilotes Wi-Fi/BT.

5.2.12 wlan0 Normal, mais impossible à scanner n’importe quelle AP {#5212-wlan0-normal-but-unable-to-scan-any-ap}

Vérifier si l’oscillateur de cristal correspondant au module correspond aux exigences de la puce, comme une exigence Wi-Fi de 24M mais un 37M est connecté; La précision de 32.768k ne répond pas aux exigences;

5.2.13 Anomalie de l’icomm-semi Wi-Fi {#5213-icomm-semi-wi-fi-anomaly}

Sur la plateforme RV1109/1126, on a constaté que le SDIO pouvait être reconnu, mais il y avait des erreurs de lecture/écriture. La modification suivante a été tentée :

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

5.2.14 Questions relatives à iPhone {#5214-iphone-issues}

Question : Après une connexion iOS à un point d’accès, le réseau se déconnectera puis se reconnectera automatiquement après environ 10 secondes. Résolution : L’appareil générera un fichier de location DHCP pour l’appareil iOS, qui sera stocké dans un emplacement temporaire et sera perdu lors du redémarrage. Lorsque dnsmasq est utilisé pour attribuer des adresses IP, le paramètre suivant doit être spécifié dans la commande de démarrage : -l, –dhcp-leasefile=<path> # Le chemin doit être persistant et ne pas être perdu lorsque la puissance est coupée.

5.2.15 Questions liées au module AMPAK/Infineon/Azurewave/Synopsys {#5215-ampakinfineonazurewavesynopsys-module-issues}

Questions communes: configuration incorrecte de WIFI_REG_ON;

32.768K le signal n’est pas présent ou ne satisfait pas aux normes requises;

WIFI_WAKE_HOST: Configuration incorrecte de la broche ou configuration du niveau de puissance, entraînant une défaillance d’initialisation ou une utilisation élevée du processeur par le fil dhd_dpc; référence à la configuration 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>;
    };
};

Le signal 32.768K est désactivé pendant le sommeil, ou WIFI_REG_ON est désactivé; Firmware/nvram n’existe pas, et les erreurs dans le processus de téléchargement de fichier sont clairement visibles dans les journaux; les pilotes de module AMPAK (bcmdhd.ko) / Azurewave (cywdhd.ko) ne sont pas interchangeables, ne configurez pas le mauvais pilote.

5.2.16 Wi-Fi PCIe non reconnu {#5216-pcie-wi-fi-not-recognized}

Veuillez consulter la section Configuration Wi-Fi de PCIE, vérifier toutes les configurations mentionnées et assurez-vous de mesurer les tensions d’alimentation pertinentes pour s’assurer qu’elles sont normales!

5.3 Problèmes de Bluetooth {#53-bluetooth-issues}

Défaillance des éléments de test Bluetooth ou défaut de fonctionnement de la fonction Bluetooth BT de rkwifibt-app-test, Il y a plusieurs situations ci-dessous, veuillez résoudre soigneusement les étapes suivantes: Le module Realtek doit désactiver cette configuration du noyau: CONFIG_BT_HCIUART=n Se référer à la section Configuration du noyau Bluetooth; DTS BT (BT_RST_N) power activate PIN configuration is incorrect, se référer à Configuration Bluetooth; Vous pouvez confirmer avec les commandes suivantes:

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

Erreur de configuration UART, se référer aux sections 2.2.2/2.4.2/2.5; Le module Realtek nécessite rtk_hciattach / hci_uart.ko / rtk_btusb.ko, confirmer qu’il n’a pas été correctement compilé ou qu’il y a une erreur de configuration du noyau, se référer aux sections

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

Le fichier Firmware/config Bluetooth n’existe pas ou ne correspond pas au modèle de module Bluetooth, se reporter à la section 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

Erreur de câblage matériel de BT UART RTS/CTS, conduisant à une reconnaissance d’initialisation anormale

# 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 Nouveau module Portage et mise à jour du pilote {#6-wi-fibt-new-module-porting-and-driver-update}

Attention spéciale: Assurez-vous de vous familiariser et comprendre les règles de stockage des fichiers et les règles de compilation au chapitre 3; cela est crucial pour le processus de portage; Pour le scénario de mise à jour du pilote, certaines des étapes suivantes peuvent être omises en fonction des circonstances réelles;

6.1 Module Realtek {#61-realtek-module}

6.1.1 Section Wi-Fi {#611-wi-fi-section}

Prenons l’exemple de RTL8821CS : Premièrement, obtenez le paquet de portage correspondant du fabricant du module ou de l’usine d’origine, comme suit : 20171225_RTL8821CS_WiFi_linux_v5.2.18_25830_BT_ANDROID_UART_COEX_8821CS- B1d1d_COEX20170908-1f1f Partie pilote Wi-Fi, naviguer dans le répertoire suivant : WiFi\RTL8821CS_WiFi_linux_v5.2.18_25830_COEX20170908-1f1f.20171225\driver Ajouter Configuration de compilation correspondante Copiez les fichiers du pilote vers drivers/net/wireless/rockchip_wlan/ , renommez-les vers rtl8821cs et modifiez Makefile/Kconfig pour ajouter les configurations correspondantes. Cette étape n’est pas nécessaire lors de la mise à jour du pilote.

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

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

Modifier le fichier 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

S’il y a un besoin de WOWLAN, alors ajoutez la fonction d’acquisition irq pour la pin WL_HOST_WAKE

# 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;
}

Exigences d’adresse MAC personnalisée

# 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]);
+     }
+ }

Ajouter le pilote Chargement de l’entrée

/* 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);

Traitement des erreurs de compilation possibles

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 Section Bluetooth BT {#612-bluetooth-bt-section}

Interface UART Si le module correspondant supporte Bluetooth, il est nécessaire d’obtenir un progiciel similaire à ce qui suit du fabricant d’origine :

20201130_ANDROID_BT_DRIVER_RTL8822C_COEX_v1c1c.tar.xx

Prendre le RTL8821CS comme exemple (pour mettre à jour les pilotes, remplacer simplement les fichiers correspondants):

# 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"

Interface USB Si une interface USB Bluetooth est utilisée, le fabricant d’origine fournira un paquet de portage similaire, en prenant RTL8821CU comme exemple:

# 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 Module AMPAK {#62-ampak-module}

Prenez AP6256 comme exemple, demandez le paquet Wi-Fi et le firmware BT pour AP6256 du fabricant du module (pour mettre à jour le pilote, remplacez simplement les fichiers correspondants).

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

La partie pilote du noyau n’a pas besoin d’être modifiée et est essentiellement compatible avec tous les modules AP. Par défaut, utilisez la configuration CONFIG_AP6XXX.

6.3 Guide de portage du pilote Wi-Fi tiers {#63-third-party-wi-fi-driver-porting-guide}

Pour les modules Wi-Fi non pris en charge par le SDK, les instructions suivantes peuvent être utilisées pour le portage : Se référer à la section 2.2 pour la configuration DTS, qui configure principalement : WIFI_REG_ON : La broche de puissance du module Wi-Fi ; WIFI_WAKE_HOST : La broche du module Wi-Fi pour réveiller le contrôleur hôte (optionnel, généralement utilisée par les modules Broadcom/Realtek); Les configurations GPIO ci-dessus seront analysées par le noyau net/rfkill/rfkill-wlan.c et fourniront les interfaces suivantes au pilote 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)

Le pilote Wi-Fi peut appeler les interfaces ci-dessus en fonction de la situation réelle; Driver Compilation: Il est nécessaire de spécifier le répertoire du noyau et le compilateur RK correspondant:

# 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. Caractéristiques communes et configuration {#7-common-features-and-configuration}

Instructions

7.1 Instructions pour l’adaptateur Wi-Fi/BT pour Debian et autres systèmes tiers {#71-wi-fibt-adapter-instructions-for-debian-and-other-third-party-systems}

Systèmes Debian/Kylin/UOS Ces systèmes ont des applications Wi-Fi/BT complètes (NetworkManager/blumeman/gnome- bluetooth) à la couche supérieure. Notre travail consiste simplement à initialiser les interfaces avant le démarrage du système ; par exemple, pour Wi-Fi : ifconfig devrait afficher l’interface wlan0 ; pour Bluetooth : hciconfig doit afficher l’interface hci0. Notez que la configuration DTS/kernel pour Wi-Fi/BT est indépendante du système spécifique et est une configuration universelle, qui devrait être directement référencée à partir de la Section 2 pour la configuration DTS et noyau de base. Les sections suivantes expliqueront l’initialisation de l’interface : Pour les Yocto et autres systèmes similaires à Buildroot, il est nécessaire de permettre à la pile de protocole wpa_supplicant/bluz de prendre en charge la fonctionnalité 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

Note: Les outils d’application et la compilation mentionnés ci-dessus doivent être référencés à partir de la documentation et des instructions du système correspondant.

7.1.1 Exemple d’adaptation du module 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 Exemple d’adaptation du module Realtek {#712-realtek-module-adaptation-example}

Instructions d’adaptation Wi-Fi Prenez le RTL8822CS comme exemple, obtenez d’abord le paquet pilote du module correspondant auprès du fabricant du module.

# 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

Instructions de compilation d’outils Bluetooth Driver/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

Les instructions d’adaptation mentionnées ci-dessus sont complétées par des opérations manuelles de compilation ou de poussée. Une fois le débogage terminé, pour simplifier les étapes de l’installation automatique, les suggestions suivantes sont faites : Si c’est un système commercial mature : Par exemple, UOS/Kylin/UnionTech, ils ont leurs propres méthodes, veuillez consulter le fournisseur du système ; Si vous utilisez une Debian gratuite : Méthode One : Il est nécessaire de créer un paquet de déb pour les différents fichiers mentionnés ci-dessus pour l’installation et l’utilisation ; pour créer des paquets de déb et la documentation d’installation, se référer à : Méthode 2 https://www.debian.org/doc/ : Modifier directement le script d’emballage Debian pour la plate-forme RK

#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

Si vous utilisez un système de type Yocto Buildroot, référez-vous aux règles et méthodes de compilation utilisées par le système correspondant.

7.2 Client DHCP {#72-dhcp-client}

dhcpcd: Par défaut par le SDK, il commence avec le système et est un client DHCP complet; udhcpc: Un client DHCP simplifié de la boîte à tâches; Remarque: Ne pas activer les deux processus en même temps, n’utilisez qu’un seul d’entre eux! Pour accélérer l’acquisition de l’adresse IP en utilisant le client dhcpcd, apportez les modifications suivantes :

# 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 Adresse Wi-Fi/BT MAC {#73-wi-fibt-mac-address}

En général, l’adresse Wi-Fi/BT MAC est intégrée à la puce. Si une adresse MAC personnalisée est requise, un outil spécifique à RK doit être utilisé pour l’écrire sur la partition de fournisseur personnalisée du Flash (voir la documentation appropriée pour la méthode, qui n’est pas décrite ici). Pour les modules Wi-Fi Azurewave, modifiez le Makefile et ajoutez la configuration suivante:

+ -DGET_CUSTOM_MAC_ENABLE
- -DGET_OTP_MAC_ENABLE

7.4 Codes des pays Wi-Fi {#74-wi-fi-country-codes}

Realtek Chipset: Modifier le pilote Makefile, ajouter la ligne suivante aux options de compilation de la plate-forme

+++ 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

Utilisez la méthode proc echo X > /proc/net/rtlxxx/wlan0/country_code , par exemple: echo CN > /proc/net/rtlxxx/wlan0/country_code Dans wpa_supplicant.conf , configurez le paramètre country=X . Si c’est un softap, alors dans hostapd.conf , configurer le paramètre country_code=X Note : Pour confirmer le code de pays X , vous pouvez rechercher par l’intermédiaire de sites Web, tels que https://countrycode.org/, chercher le CODES ISO qui sont une combinaison de deux lettres majuscules ; AMPAK/Azurewave Chipset: dhd_priv country XX

7.5 Mode de chargement et de déchargement dynamique Wi-Fi KO {#75-wi-fi-dynamic-loading-and-unloading-ko-mode}

Lors de la compilation du Wi-Fi en mode KO et de l’exécution de plusieurs opérations de chargement/déchargement, il est nécessaire d’appliquer le patch suivant: Kernel 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 Étapes de dépannage du réseau {#76-network-troubleshooting-steps}

7.6.1 Congestion du réseau/taux non atteint {#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 Délai de traitement des paquets de paquets de protocole réseau Vérification simple {#762-network-protocol-stack-packet-processing-time-simple-verification}

Écrire un programme standard de réseau d’échos, et en capturant les paquets avec tcpdump, vous pouvez calculer le temps que la pile de protocole prend pour traiter les paquets aux deux cercles jaunes dans la figure ci-dessous.

Wi-Fi / BT

7.7 Mise à jour de la version 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 Configuration de débogage pour les applications de pilote {#78-debugging-configuration-for-driver-applications}

7.8.1 Capture des paquets TCPDUMP {#781-tcpdump-packet-capturing}

Les problèmes d’application réseau nécessitent parfois la saisie de paquets pour confirmation. Ouvrez la configuration, compilez pour générer l’exécutable tcpdump et utilisez les commandes suivantes pour capturer les paquets :

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

7.8.2 Débogage wpa_supplicant {#782-debugging-wpa_supplicant}

Parfois, il est nécessaire de déboguer les problèmes avec wpa_supplicant en utilisant ses logs.

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. Série RV IPC SDK Wi-Fi Explication {#8-rv-series-ipc-sdk-wi-fi-explanation}

8.1 Instructions de configuration {#81-configuration-instructions}

Configuration du système Pour activer la fonctionnalité Wi-Fi, la configuration (voir la méthode de configuration et de compilation du SDK de la CIB décrite dans le répertoire doc du SDK RV1106/1103) doit être modifiée comme suit, en supposant l’utilisation de la configuration 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

Configuration DTSRefer to DTS Configuration Section Note : Les modules USB sont généralement toujours alimentés, donc il n’est pas nécessaire de contrôler la puissance ; les modules SDIO correspondants auront généralement un WL_REG_ON (le nom peut varier pour différents modules), ce qui nécessite la configuration d’un gpio spécifique selon les dts. Il est particulièrement important de noter que la configuration du noyau doit être activée par les deux configurations suivantes : CONFIG_RFKILL=y CONFIG_RFKILL_RK=y Compilation Ensuite, compilez en utilisant ./build.sh, après quoi un wi-Fi de support ko sera généré, avec le programme wpa_supplicant/wpa_cli; les répertoires d’exécution correspondants sont: /oem/usr/ko/wifi_xxx.ko /usr/bin/wpa_supplicant /usr/bin/wpa_cli

Le répertoire de code source du pilote Wi-Fi est le suivant:

# 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

Actuellement, il prend en charge RTL8188FU/8189FS, Hi3861L, SSV6155P, ATBM6XX, ATBM6441, etc.; Le répertoire de codes sources pour wpa_supplicant:

#wpa_supplicant
wpa_supplicant-2.6

# Default configuration file
wpa_supplicant.conf

Le SDK est livré avec un script de réseau intégré: insmod_wifi.sh Le modèle Wi Fi est déterminé sur la base de VID:PID, et le pilote Wi-Fi correspondant et ses modules dépendants sont chargés automatiquement:

#!/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

Note: Le pilote icomm-semi Wi-Fi doit charger les pilotes liés au cfg/mac80211.

8.3 Développement des applications {#83-application-development}

Le système RK (Rockchip) est livré avec une démo par défaut qui simplifie le développement des applications Wi-Fi, situé à l’adresse project/app/wifi_app/wifi/ . Note : La démo est uniquement utilisée pour assurer la stabilité. Pour la production, vous devrez affiner et ajouter ou supprimer les fonctionnalités connexes si nécessaire. Utilisation :

# 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 Instructions de portage pour les demandes de tiers {#84-third-party-application-porting-instructions}

Pour des instructions détaillées, se reporter aux documents pertinents du SDK de la CIB.

8.5 Instructions pour le portage des nouveaux pilotes {#85-new-driver-porting-instructions}

Si vous avez besoin d’utiliser un Wi-Fi non encore supporté par le SDK, suivez les étapes ci-dessous pour le porter: Prenez altobeam ATBM6301 comme exemple: Tout d’abord, copiez l’atbm du pilote original fourni par l’usine au répertoire SDK: sysdrv/drv_ko/wifi/ directory:

ls sysdrv\drv_ko\wifi
atbm

Modifier ensuite le Makefile du pilote, en changeant principalement trois variables d’environnement système :

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

Trouvez les lignes pertinentes dans le fichier make et apportez les modifications suivantes:

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)

Remarque : Le Vendeur doit fournir des pilotes Wi-Fi qui prennent en charge le noyau 5.10 ! Enfin, modifiez le fichier insmod_wifi.sh, référez-vous aux autres projets à l’intérieur pour ajouter le contenu insmod correspondant.

8.6 Guide de dépannage/essais de la FR {#86-troubleshooting-guiderf-testing}

Se reporter aux sections précédentes sur le Wi-Fi/BT Dépannage et les mesures RF. Pour les essais RF, veuillez noter : Il est nécessaire que le fabricant de Wi-Fi original ou l’usine de modules fournisse le type d’essais et le programme d’essais. Il est préférable d’utiliser le binaire statique pour tester les programmes, sinon, il peut y avoir une situation où il ne peut pas être exécuté. Dans ce cas, il est nécessaire de fournir la chaîne d’outils SDK cross-compilation: bras-rockchip830-linux-uclibcgnueabihf- pour l’original

fabricant ou usine de modules pour recompiler le programme d’essai.

9. Guide de développement Wi-Fi de faible puissance de la série RV {#9-rv-series-low-power-wi-fi-development-guide}

Pour une documentation détaillée, veuillez vous référer à:https://docs.qq.com/doc/p/ad70d285112c58d5aa09b 08eb2d93cf96d85c591

10. Développement des applications {#10-application-development}

Voici une bibliothèque de développement d’applications qui résume les opérations complexes sous-jacentes Wi-Fi/BT, telles que wpa_supplicant/bluz/bsa, etc., et fournit une interface de développement d’applications conviviale. Il est adapté au système natif de Buildroot. D’autres systèmes tiers comme Debian/Kylin/UOS ont des applications Wi-Fi-BT de couche supérieure, donc il n’est pas nécessaire d’utiliser cette interface. RKWIFIBT-APP Développement d’applications et guide d’essai Référence: https://docs.qq.com/doc/p/a9dd00348639929fc080d20dbbdc4feea89c4983

Explorer ce sujet → · Parcours →