DESK-MP1-L/Peripherals/DWS

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes

2023/08/01

DESK-MP1-L-1.0.0 release
2023/08/31 DESK-MP1-L-1.0.1 release


Pheripheral DWS[edit | edit source]

The DWS add-on module present on ETRA EVK it used to have the Wireless and Bluetooth connection.

The binary provided in the kit and the downloadable binary desk-image-qt5-openstlinux-weston-desk-mp1.wic.bz2, if the DWS module is present, the drivers for the wireless and Bluetooth connection will automatically start.

The Bluetooth and the wireless connection are managed with rfkill.

Device tree configuration[edit | edit source]

The device tree has three sections devoted to the wireless subsystems configuration, i.e. wifi, bluetooth, rfkill

Wifi[edit | edit source]

The wireless driver is a module built out of tree, the source is present only in the bsp, the module in question therefore cannot be built having only the kernel source code

The communication bus used is the one destined for the sdmmc3.

...
...
/{
    ...
    ...
    reg_wlan_en: wlan_en  {
        compatible = "regulator-fixed";
        regulator-name = "wlan-en-regulator";
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
        enable-active-high;
        gpio = <&gpioe 8 GPIO_ACTIVE_HIGH>;
        vin-supply = <&vin>;
        startup-delay-us = <150000>;
    };
    ...
    ...
};
...
...
&pinctrl {
    ...
    ...
    sdmmc3_pins_mx: sdmmc3_mx-0 {
        pins1 {
            pinmux = <STM32_PINMUX('D', 0, AF10)>, /* SDMMC3_CMD */
                     <STM32_PINMUX('D', 1, AF10)>, /* SDMMC3_D0 */
                     <STM32_PINMUX('D', 4, AF10)>, /* SDMMC3_D1 */
                     <STM32_PINMUX('D', 5, AF10)>, /* SDMMC3_D2 */
                     <STM32_PINMUX('D', 7, AF10)>; /* SDMMC3_D3 */
            bias-disable;
            drive-push-pull;
            slew-rate = <1>;
        };
        pins2 {
            pinmux = <STM32_PINMUX('G', 15, AF10)>; /* SDMMC3_CK */
            bias-disable;
            drive-push-pull;
            slew-rate = <3>;
            slew-rate = <1>;
        };
    };

    sdmmc3_opendrain_pins_mx: sdmmc3_opendrain_mx-0 {
        pins1 {
            pinmux = <STM32_PINMUX('D', 0, AF10)>; /* SDMMC3_CMD */
            bias-disable;
            drive-open-drain;
            slew-rate = <1>;
        };
        pins2 {
            pinmux = <STM32_PINMUX('D', 1, AF10)>, /* SDMMC3_D0 */
                     <STM32_PINMUX('D', 4, AF10)>, /* SDMMC3_D1 */
                     <STM32_PINMUX('D', 5, AF10)>, /* SDMMC3_D2 */
                     <STM32_PINMUX('D', 7, AF10)>; /* SDMMC3_D3 */
            bias-disable;
            drive-push-pull;
            slew-rate = <1>;
        };
        pins3 {
            pinmux = <STM32_PINMUX('G', 15, AF10)>; /* SDMMC3_CK */
            bias-disable;
            drive-push-pull;
            slew-rate = <1>;
        };
    };

    sdmmc3_sleep_pins_mx: sdmmc3_sleep_mx-0 {
        pins {
            pinmux = <STM32_PINMUX('D', 0, ANALOG)>, /* SDMMC3_CMD */
                     <STM32_PINMUX('D', 1, ANALOG)>, /* SDMMC3_D0 */
                     <STM32_PINMUX('D', 4, ANALOG)>, /* SDMMC3_D1 */
                     <STM32_PINMUX('D', 5, ANALOG)>, /* SDMMC3_D2 */
                     <STM32_PINMUX('D', 7, ANALOG)>, /* SDMMC3_D3 */
                     <STM32_PINMUX('G', 15, ANALOG)>; /* SDMMC3_CK */
        };
    };

    ...
    ...
};
...
...
&sdmmc3{
    pinctrl-names = "default", "opendrain", "sleep";
    pinctrl-0 = <&sdmmc3_pins_mx>;
    pinctrl-1 = <&sdmmc3_opendrain_pins_mx>;
    pinctrl-2 = <&sdmmc3_sleep_pins_mx>;
    status = "okay";

    /* USER CODE BEGIN sdmmc3 */
    broken-cd;
    non-removable;
    no-1-8-v;
    st,neg-edge;
    bus-width = <4>;
    vmmc-supply = <&vdd>;
    vmmc-supply = <&reg_wlan_en>;
    /* USER CODE END sdmmc3 */
};
...
...

Bluetooth[edit | edit source]

200px-Emblem-important.svg.png

Bluetooth hardware configuration has shared pins in conflict with the NOR memory option

The gpios used for the serial bus to use Bluetooth in the DWS are shared with the SPI bus to communicate with the NOR. If the BT interface is required the NOR memory cannot be used and vice versa

...
...
/ {
    ...
    ...
    aliases{
        ...
        ...
        serial3 = &uart7;
        ...
        ...
    };
    ...
    ...
};
...
...
&pinctrl{
        uart7_pins_mx: uart7_mx-0 {
        pins1 {
            pinmux = <STM32_PINMUX('F', 6, AF7)>, /* UART7_RX */
                     <STM32_PINMUX('F', 9, AF7)>; /* UART7_CTS */
            bias-disable;
        };
        pins2 {
            pinmux = <STM32_PINMUX('F', 7, AF7)>, /* UART7_TX */
                     <STM32_PINMUX('F', 8, AF7)>; /* UART7_RTS */
            bias-disable;
            drive-push-pull;
            slew-rate = <0>;
        };
    };

    uart7_sleep_pins_mx: uart7_sleep_mx-0 {
        pins {
            pinmux = <STM32_PINMUX('F', 6, ANALOG)>, /* UART7_RX */
                     <STM32_PINMUX('F', 7, ANALOG)>, /* UART7_TX */
                     <STM32_PINMUX('F', 8, ANALOG)>, /* UART7_RTS */
                     <STM32_PINMUX('F', 9, ANALOG)>; /* UART7_CTS */
        };
    };

};
...
...
&qspi{
    ...
    ...
    status = "disabled";
    ...
    ...
};
...
...
&uart7{
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&uart7_pins_mx>;
    pinctrl-1 = <&uart7_sleep_pins_mx>;
    status = "okay";

    /* USER CODE BEGIN uart7 */
    /delete-property/dmas;
    /delete-property/dma-names;
    uart-has-rtscts;
    /* USER CODE END uart7 */
};
...
...

rfkill[edit | edit source]

For the Bluetooth driver it is necessary to add a rfkill_gpio node in the device tree:

...
...
/{
    ...
    ...
    bt_rfkill {
            compatible = "net,rfkill-gpio";
            name = "bt_rfkill";
            type = "bluetooth";
            reset-gpios = <&gpioe 7 GPIO_ACTIVE_HIGH>;
        };
    ...
    ...
};
...
...

Accessing the peripheral[edit | edit source]

rfkill[edit | edit source]

Linux messages at boot time[edit | edit source]
[    2.527639] rfkill_gpio bt_rfkill: bt_rfkill device registered.
Usage[edit | edit source]
root@desk-mp1:~# rfkill
ID TYPE      DEVICE         SOFT      HARD
 0 bluetooth bt_rfkill unblocked unblocked
 1 wlan      phy0      unblocked unblocked

So, for example, for enabling the wlan interface:

root@desk-mp1:~# rfkill unblock wlan

Wifi[edit | edit source]

Linux messages at boot time[edit | edit source]
...
[    0.567773] wlan-en-regulator: supplied by vin
...
[   12.422451] wlan: loading out-of-tree module taints kernel.
...
[   14.266062] wlan: loading driver v4.5.25.46
[   14.291737] hifDeviceInserted: Dumping clocks (50000000,99000000)
[   14.563255] [TELIT] Using WE866C6 board data. 
[   14.642957] ol_download_firmware: chip_id:0x5020001 board_id:0x0
[   14.648126] __ol_transfer_bin_file: Failed to get bdwlan30_c6.b00:-2
[   14.688736] __ol_transfer_bin_file: Trying to load default bdwlan30_c6.bin
[   14.752763] __ol_transfer_bin_file: Loading setup file qsetup30.bin
[   14.757937] __ol_transfer_bin_file: Failed to get qsetup30.bin:-2
[   15.657329] R0: wlan: [735:E :SAP] dfs_init_radar_filters[217]: Unknown dfs domain 0 
[   15.832920] Host SW:4.5.25.46, FW:0.0.0.111, HW:QCA93x7_REV1_1
[   15.848740] ENTER sme_set_btc_coex_dutycycle = 30
[   15.848777] ENTER sme_set_btc_coex_dutycycle =30
[   15.855583] ath_hif_sdio: HIF (Atheros/multi-bss)
[   15.864661] wlan: driver loaded in 1600000

Check if the wlan module are loaded:

root@desk-mp1:~# lsmod
Module                  Size  Used by
wlan                 5111808  0
galcore               528384  5
sch_fq_codel           20480  3
ip_tables              24576  0
x_tables               24576  1 ip_tables
ipv6                  507904  58
Usage with wpa_supplicant[edit | edit source]

Wireless connection using wpa_supplicant

root@desk-mp1:~# rfkill unblock wlan
root@desk-mp1:~# killall wpa_supplicant
wpa_supplicant: no process found
root@desk-mp1:~# echo network={ > /tmp/wpa_supplicant.conf
root@desk-mp1:~# echo 'ssid="ZyXEL"' >>  /tmp/wpa_supplicant.conf
root@desk-mp1:~# echo key_mgmt=NONE >> /tmp/wpa_supplicant.conf
root@desk-mp1:~# echo } >> /tmp/wpa_supplicant.conf
root@desk-mp1:~# wpa_supplicant -i wlan0 -c /tmp/wpa_supplicant.conf -B -P /tmp/wpa_supplicant.pid
Successfully initialized wpa_supplicant
root@desk-mp1:~# dmesg | tail -n 2
[ 2229.194152] DEBUGFS PEER MAC = 0xfc:0xf5:0x28:0xcc:0x3:0x90
[ 2229.312740] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
root@desk-mp1:~# ifconfig wlan0 192.168.11.89 up
root@desk-mp1:~# ping -c 5 192.168.11.243
PING 192.168.11.243 (192.168.11.243) 56(84) bytes of data.
64 bytes from 192.168.11.243: icmp_seq=1 ttl=64 time=36.9 ms
64 bytes from 192.168.11.243: icmp_seq=2 ttl=64 time=15.6 ms
64 bytes from 192.168.11.243: icmp_seq=3 ttl=64 time=13.6 ms
64 bytes from 192.168.11.243: icmp_seq=4 ttl=64 time=11.7 ms
64 bytes from 192.168.11.243: icmp_seq=5 ttl=64 time=19.6 ms

--- 192.168.11.243 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 11.691/19.481/36.911/9.100 ms
root@desk-mp1:~#

It is possible to use also the iw application:

root@desk-mp1:~# iw
Usage:  iw [options] command
Options:
        --debug         enable netlink debugging
        --version       show version (5.16)
Commands:
        dev <devname> ap stop
        dev <devname> ap start
        ...

Bluetooth[edit | edit source]

Usage with hci[edit | edit source]

First of all it is required to open the serial interface to the BT device:

root@desk-mp1:~# stty -F /dev/ttySTM3 3000000 -echo -echoe crtscts
root@desk-mp1:~# hciattach /dev/ttySTM3 qca 3000000 -t120 flow

[...]

root@desk-mp1:~# hciconfig hci0 up
root@desk-mp1:~# hcitool dev
Devices:
        hci0    00:21:7E:33:1D:5C
root@desk-mp1:~# bluetoothctl
Agent registered
[CHG] Controller 00:21:7E:33:1D:5C Pairable: yes
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:21:7E:33:1D:5C Discovering: yes
[NEW] Device 61:39:85:BD:57:71 61-39-85-BD-57-71
[NEW] Device D4:CA:6E:C1:0E:E8 NINA-B1-C10EE8
[CHG] Device 61:39:85:BD:57:71 RSSI: -75
[CHG] Device 61:39:85:BD:57:71 ManufacturerData Key: 0x004c
[CHG] Device 61:39:85:BD:57:71 ManufacturerData Value:
  10 05 2e 18 00 b2 00                             .......
[NEW] Device 08:97:98:34:48:2C Cat S52 Fox
[DEL] Device 61:39:85:BD:57:71 61-39-85-BD-57-71
[bluetooth]# scan off
Discovery stopped
[CHG] Device 08:97:98:34:48:2C RSSI is nil
[CHG] Device D4:CA:6E:C1:0E:E8 TxPower is nil
[CHG] Device D4:CA:6E:C1:0E:E8 RSSI is nil
[CHG] Controller 00:21:7E:33:1D:5C Discovering: no
[bluetooth]# exit
root@desk-mp1:~#

Boot via NFS[edit | edit source]

If booted via NFS with the RFS present in the supplied MVM, the wireless driver module is present but not mounted automatically, to mount the driver run the command:

root@desk-mp1:~# lsmod
Module                  Size  Used by
galcore               528384  5
sch_fq_codel           20480  2
ip_tables              24576  0
x_tables               24576  1 ip_tables
ipv6                  507904  34
root@desk-mp1:~# rfkill
ID TYPE      DEVICE         SOFT      HARD
 0 bluetooth bt_rfkill unblocked unblocked
root@desk-mp1:~# insmod /lib/modules/5.15.67-desk-mp1-l-1.0.1/extra/wlan.ko
root@desk-mp1:~# dmesg | tail -n 20
[   21.280405] dwc2 49000000.usb-otg: bound driver configfs-gadget
[   36.959153] vdda: disabling
[  209.045510] wlan: loading driver v4.5.25.46
[  209.046619] hifDeviceInserted: Dumping clocks (50000000,99000000)
[  209.261565] ol_download_firmware: chip_id:0x5020001 board_id:0x0
[  209.263430] __ol_transfer_bin_file: Failed to get bdwlan30.b00:-2
[  209.263465] __ol_transfer_bin_file: Trying to load default bdwlan30.bin
[  209.269239] Board extended Data download address: 0x0
[  209.283596] __ol_transfer_bin_file: Loading setup file qsetup30.bin
[  209.285157] __ol_transfer_bin_file: Failed to get qsetup30.bin:-2
[  209.962733] R0: wlan: [898:E :SAP] dfs_init_radar_filters[217]: Unknown dfs domain 0 
[  209.979722] Target Ready! : transmit resources : 3 size:1792, MaxMsgsPerHTCBundle = 32
[  210.119632] target uses HTT version 3.60; host uses 3.28
[  210.119676] *** Warning: host/target HTT versions are different, though compatible!
[  210.132808] DEBUGFS PEER MAC = 0x2:0x21:0x7e:0x71:0x8d:0x2
[  210.200890] Host SW:4.5.25.46, FW:0.0.0.111, HW:QCA93x7_REV1_1
[  210.227208] ENTER sme_set_btc_coex_dutycycle = 30
[  210.227248] ENTER sme_set_btc_coex_dutycycle =30
[  210.227758] ath_hif_sdio: HIF (Atheros/multi-bss)
[  210.227787] wlan: driver loaded in 1180000
root@desk-mp1:~# lsmod
Module                  Size  Used by
wlan                 5111808  0
galcore               528384  5
sch_fq_codel           20480  2
ip_tables              24576  0
x_tables               24576  1 ip_tables
ipv6                  507904  34
root@desk-mp1:~# rfkill
ID TYPE      DEVICE         SOFT      HARD
 0 bluetooth bt_rfkill unblocked unblocked
 1 wlan      phy0      unblocked unblocked