TechNexion / linux-tn-imx

i.MX Linux kernel maintained by TechNexion
Other
20 stars 26 forks source link

New installation doesn't support wifi #7

Closed AquilesCanta closed 5 months ago

AquilesCanta commented 6 months ago

I come from this gist (https://gist.github.com/liquidx/fd1002ec870a7c13f04a0b8a44744246) and managed to run yocto on my pico-pi-imx7d (former Android Things kit):

root@pico-imx7:/# uname -a
Linux pico-imx7 4.14.98-2.0.0-ga-wip+g1aad76280ecb #1 SMP PREEMPT Fri Jan 5 08:28:35 UTC 2024 armv7l armv7l armv7l GNU/Linux

My issue: I'd like to ssh via wifi but there's no wifi card detected:

root@pico-imx7:/# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1f:7b:86:5d:de  
          UP BROADCAST MULTICAST DYNAMIC  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:3122 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3122 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:194700 (190.1 KiB)  TX bytes:194700 (190.1 KiB)

I tried following the documentation from: https://developer.technexion.com/docs/, concretely the WIFI connection section. That states:

Check if the wifi module is loaded.

~# lsmod
Module               Size  Used by
wlan                 4673536  0

# But my output is:

Module                  Size  Used by
brcmfmac              212992  0
brcmutil               16384  1 brcmfmac
ov5645_camera_mipi_v2    73728  0
mx6s_capture           24576  0

So I understand that the wlan module is not loaded. But the post doesn't really provide good instructions as to what to do when the check fails.

Also running:

$ modprobe wlan -v
insmod /lib/modules/4.14.98-2.0.0-ga-wip+g1aad76280ecb/extra/wlan.ko obe wlan -v 
AR6000: Unregistered!
wlan: loading driver v4.5.24.4+gccf1bfb76
ath_hif_sdio: HIF (Atheros/multi-bss)
AR6000: Unregistering with the bus driver
modprobe: ERROR: could not insert 'wlan': No such device

I suspect it's likely I'm just missing something obvious, since I'm not super familiar with Linux sys admin.

Any pointers?

ray-chang commented 6 months ago

Hi @AquilesCanta

Thanks for your feedback~

I'm not so sure, but your hardware version could be the Broadcom version of the chip. The Broadcom version hardware has been EOL, and we no longer support it. The new version has been replaced with a Qualcomm version of the chip. https://www.technexion.com/products/system-on-modules/pico/pico-imx7/

It is recommended to use yocto 2.4 or earlier for the software that supports this Broadcom chip. But yocto 2.4 was EOL in 2018, so you may not be able to build it either. https://github.com/TechNexion/edm-yocto-bsp

Demo image for Broadcom wifi chip: https://download.technexion.com/demo_software/PICO/IMX7/pico-imx7-emmc/archived/pico-imx7_pico-pi_yocto-2.4-qt5_sdcard-preview_QCA9377_lcd-800x480_20181102.zip

BR, Ray

AquilesCanta commented 6 months ago

Ah, thanks for the prompt response, Ray. I'll play around with this new information once I have some free time, and maybe post back here with any useful findings.

AquilesCanta commented 5 months ago

Hi Ray, I get the same result with the image that I downloaded from https://download.technexion.com/demo_software/PICO/IMX7/pico-imx7-emmc/archived/pico-imx7_pico-pi_yocto-2.4-qt5_sdcard-preview_QCA9377_lcd-800x480_20181102.zip.

I extracted that, and used uuu to flash that into the pico-pi device. As in:

sudo uuu -b emmc_imx7_img.auto

Where _rootfs.sdcard is the one I extracted from the downloaded zip. That's pico-imx7_pico-pi_yocto-2.4-qt5_sdcard-preview_QCA9377_lcd-800x480_20181102/pico-imx7_pico-pi_yocto-2.4-qt5_sdcard-preview_QCA9377_lcd-800x480_20181102.img. Other files (.auto, _SPL, _UBOOT) are the ones from imx-mfg-uuu-tool, which IIRC I got from this zip: https://download.technexion.com/demo_software/PICO/IMX7/pico-imx7-emmc/DiskImage/pico-imx7_pico-pi_yocto-2.5-qt5_qca9377_lcd-800x480_20240105.zip.

Do you see anything obviously wrong with what I did? Or any clues what to try otherwise? If not, don't worry. I'm just trying to avoid some e-waste. Thanks for your assistance so far!

richard-hu commented 5 months ago

@AquilesCanta

Thanks for your feedback.

We are in CNY holiday, so can't give the instant reply. It requires to use network manager connman to enable WIFI.

Could you take a look at the document below (7. Test WIFI and Bluetooth) ? Yocto_2.4_PreBuilt_Image_User_Guide_v2.8.pdf

BR,

Richard

AquilesCanta commented 5 months ago

We are in CNY holiday, so can't give the instant reply.

No worries at all. Your answers are already much appreciated. Please enjoy!


So the output of /var/lib/connman/settings is what you'd expect:

~# cat /var/lib/connman/settings  
[global]
OfflineMode=false

[WiFi]
Enable=true
Tethering=false

[Bluetooth]
Enable=true
Tethering=false

[Wired]
Enable=true
Tethering=false

Also modprobe bcmdhd generates no output. But

# ifconfig wlan0 up
wlan0: ERROR while getting interface flags: No such device

So I presume something is off. Also, something I noticed in section 1.1:

image

Is that PICO-IMX7D only appears with (with QCA WLAN). But, according to this comment, I think we are going with the assumption that this is broadcom wifi HW. Perhaps those instructions are for QCA?

Not that it will be useful, but just ran cd /lib/modules/4.9.88-tn-imx_4.9.88_2.0.0_ga-test+gdf58440ko; find and the output is in https://cl1p.net/asdadasdadsasdad, which will be deleted in 30 days (today is 2024-02-11).

richard-hu commented 5 months ago

@AquilesCanta :

No worries at all. Your answers are already much appreciated. Please enjoy! Thanks!!! It's quite good to get together with families. :)

Thanks for the feedback~!!!

Please remove the line wifi_module = qca in uEnv.txt which is located in the 1st FAT partition.

There are two different device tree files to correspond to QCA/BRCM WIFI separately for pico-imx7d.

https://github.com/TechNexion/linux/blob/tn-imx_4.9.88_2.0.0_ga-test/arch/arm/boot/dts/imx7d-pico_pi.dts https://github.com/TechNexion/linux/blob/tn-imx_4.9.88_2.0.0_ga-test/arch/arm/boot/dts/imx7d-pico-qca_pi.dts

For BRCM wifi, it should use imx7d-pico_pi.dts instead of imx7d-pico-qca_pi.dts.

u-boot would not detect the WIFI type automatically, so it requires to specify WIFI type in uEnv.txt.

u-boot would load different dtb by the content of wifi_module configured in uEnv.txt.

diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
index 644cac4e91..172c2de1df 100644
--- a/include/configs/pico-imx7d.h
+++ b/include/configs/pico-imx7d.h
@@ -211,10 +211,10 @@
    "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
    "setfdt=" \
        "if test -n ${wifi_module} && test ${wifi_module} = qca; then " \
-           "setenv fdtfile ${som}-${form}-${wifi_module}_${baseboard}${mcu}.dtb; " \
+           "setenv fdtfile ${som}-${form}-${wifi_module}-${baseboard}${mcu}.dtb; " \
            "setenv form ${form}-${wifi_module}; " \
        "else " \
-           "setenv fdtfile ${som}-${form}_${baseboard}${mcu}.dtb;" \
+           "setenv fdtfile ${som}-${form}-${baseboard}${mcu}.dtb;" \
        "fi\0" \
    "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdtfile}\0" \
    "mmcboot=echo Booting from mmc ...; " \

You can check what is the device tree blob is loaded in kernel by the command:

dmesg | grep -i model

For BRCM, it should show: TechNexion PICO-IMX7D and PI baseboard instead of TechNexion PICO-IMX7D with QCA WLAN module and PI baseboard

BR,

Richard

AquilesCanta commented 5 months ago

Thanks. I'll only be able to test this out in a month. So I'll close this for now and update once I have news.