Primerypile
Posts: 4
Joined: Fri Jun 29, 2018 10:54 am

Integrating BCM43438-based SDIO WiFi Module on CM3

Fri Jun 29, 2018 11:26 am

Hi all

I'm trying to integrate a SparkLan SWDB-104 WiFi module on a compute module 3. This module uses a broadcom chipset (BCM43438). To my knowledge this is the same chipset which was also used on the RPI3.

The module is connected on the secondary SDIO port on the compute module. In order to activate the SDIO interface, I loaded the 'sdio' device tree overlay. Afterwards, 'raspi-gpio get' shows that the pins 22-27 are configured accordingly:
...
GPIO 20: level=0 fsel=0 func=INPUT
GPIO 21: level=0 fsel=0 func=INPUT
GPIO 22: level=1 fsel=7 alt=3 func=SD1_CLK
GPIO 23: level=1 fsel=7 alt=3 func=SD1_CMD
GPIO 24: level=1 fsel=7 alt=3 func=SD1_DAT0
GPIO 25: level=1 fsel=7 alt=3 func=SD1_DAT1
GPIO 26: level=1 fsel=7 alt=3 func=SD1_DAT2
GPIO 27: level=1 fsel=7 alt=3 func=SD1_DAT3

BANK1 (GPIO 28 to 45):
...
The stock kernel does already include drivers for the BCM43438 chipset. After a short search, I found that it‘s (probably) the 'brcmfmac' driver. After loading the driver with modprobe and checking with lsmod, I get:

Code: Select all

Module                  Size  Used by
bnep                   20480  2
brcmfmac              307200  0
brcmutil               16384  1 brcmfmac
bluetooth             368640  7 bnep
ecdh_generic           28672  1 bluetooth
fuse                  106496  3
cfg80211              573440  1 brcmfmac
rfkill                 28672  4 bluetooth,cfg80211
joydev                 20480  0
evdev                  24576  6
snd_bcm2835            32768  1
snd_pcm                98304  1 snd_bcm2835
snd_timer              32768  1 snd_pcm
snd                    69632  5 snd_timer,snd_bcm2835,snd_pcm
i2c_bcm2835            16384  0
uio_pdrv_genirq        16384  0
uio                    20480  1 uio_pdrv_genirq
fixed                  16384  0
i2c_dev                16384  0
ip_tables              24576  0
x_tables               32768  1 ip_tables
ipv6                  434176  42
The broadcom driver was loaded and also dragged in some dependecies, such as brcmutil and cfg80211.
Looking at the dmesg‘ output I see:
[ 125.365582] mmc-bcm2835 3f300000.sdio: /aliases ID not available
[ 125.365713] mmc-bcm2835 3f300000.sdio: mmc_debug:0 mmc_debug2:0
[ 125.365718] mmc-bcm2835 3f300000.sdio: DMA channel allocated
[ 125.435755] mmc2: queuing unknown CIS tuple 0x80 (2 bytes)
[ 125.437287] mmc2: queuing unknown CIS tuple 0x80 (3 bytes)
[ 125.438816] mmc2: queuing unknown CIS tuple 0x80 (3 bytes)
[ 125.441789] mmc2: queuing unknown CIS tuple 0x80 (7 bytes)
[ 125.539281] mmc2: new high speed SDIO card at address 0001
[ 125.597409] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[ 125.611178] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43430-sdio.bin for chip 0x00a9a6(43430) rev 0x000001
[ 125.611346] usbcore: registered new interface driver brcmfmac
[ 129.941845] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[ 131.011873] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
It appears to me like the module was detected correctly (brcmfmac43430), but then there are two timeouts reported. I don‘t know wether these timeouts are critical errors. But I don‘t get any wlan interface on Linux. So WiFi is currently unusable on my board.

‚rfkill list‘ shows nothing. ‚lshw -short‘ reports:

Code: Select all

/W path  Device  Class      Description
========================================
                  system     Raspberry Pi Compute Module 3 Rev 1.0
/0                bus        Motherboard
/0/0              processor  cpu
/0/1              processor  cpu
/0/2              processor  cpu
/0/3              processor  cpu
/0/4              memory     875MiB System memory
/1        usb1    bus        DWC OTG Controller
/1/1              bus        SMC9512/9514 USB Hub
/1/1/1            generic    SMSC9512/9514 Fast Ethernet Adapter
/1/1/2            input      HP USB Slim Keyboard - Skylab EU
/1/1/3            input      USB Optical Mouse
/2        eth0    network    Ethernet interface
I don‘t really know how to debug this problem… There are multiple things I‘m unsure about

1) Is the sdio dtoverlay the right one to use? Or do I have to create a custom overlay?
2) Is the driver I used the correct one?
3) Is there anything else that needs to be confgured/setup in Userland to get the wlan interface up and running?

Any inputs are greatly appreciated!

Primerypile
Posts: 4
Joined: Fri Jun 29, 2018 10:54 am

Re: Integrating BCM43438-based SDIO WiFi Module on CM3

Fri Jun 29, 2018 1:57 pm

Update:
It works, but is kinda flaky. When I load the driver the first time I get the behavior as described in the previous post. However, if unload and reload the driver a second time the WiFi module gets correctly initialized (sometimes):

My commands:
  • sudo dtoverlay sdio poll_once=off
  • sudo modprobe brcmfmac
  • dmesg

Code: Select all

[   91.506054] mmc-bcm2835 3f300000.sdio: /aliases ID not available
[   91.506176] mmc-bcm2835 3f300000.sdio: mmc_debug:0 mmc_debug2:0
[   91.506181] mmc-bcm2835 3f300000.sdio: DMA channel allocated
[   91.599902] mmc2: queuing unknown CIS tuple 0x80 (2 bytes)
[   91.601427] mmc2: queuing unknown CIS tuple 0x80 (3 bytes)
[   91.602974] mmc2: queuing unknown CIS tuple 0x80 (3 bytes)
[   91.605715] mmc2: queuing unknown CIS tuple 0x80 (7 bytes)
[   91.704569] mmc2: new high speed SDIO card at address 0001
[   91.764312] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[   91.768532] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43430-sdio.bin for chip 0x00a9a6(43430) rev 0x000001
[   91.768691] usbcore: registered new interface driver brcmfmac
[   92.991107] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[   94.051422] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[   94.250202] Bluetooth: Core ver 2.22
[   94.250265] NET: Registered protocol family 31
[   94.250268] Bluetooth: HCI device and connection manager initialized
[   94.250284] Bluetooth: HCI socket layer initialized
[   94.250293] Bluetooth: L2CAP socket layer initialized
[   94.250312] Bluetooth: SCO socket layer initialized
Then I unloaded and reloaded
  • sudo modprobe -r brcmfmac
  • sudo modprobe brcmfmac
  • dmesg

Code: Select all

[  108.515672] usbcore: deregistering interface driver brcmfmac
[  111.387745] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[  111.394193] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43430-sdio.bin for chip 0x00a9a6(43430) rev 0x000001
[  111.394386] usbcore: registered new interface driver brcmfmac
[  112.652237] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[  112.652969] brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 7.11.15 Compiler: 1.24.2 ClmImport: 1.24.1 Creation: 2014-05-26 10:53:55 Inc Data: 9.10.39 Inc Compiler: 1.29.4 Inc ClmImport: 1.36.3 Creation: 2017-10-23 03:47:14 
[  112.937553] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  112.937662] brcmfmac: power management disabled
[  113.743064] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
In my search a came across the post Trouble “activating” the SDIO Broadcom BCM43430 Wifi chip on Linux 4.8.0. That discussion there made me realize that there are several different BCM43430 driver versions floating around (http://jwrdegoede.danny.cz/brcm-firmware/). Reassuringly, the one for the RP3 is identical to the one installed on my RPI Image, but the corresponding txt file contains some settings which are different. Using the brcmfmac43430-sdio.txt.raspberry-pi3 didn't really fix the issue though...

John Westlake
Posts: 82
Joined: Thu Nov 09, 2017 4:34 am

Re: Integrating BCM43438-based SDIO WiFi Module on CM3

Sat Jun 30, 2018 6:52 pm

Have you connected LPO_IN pad F5 (Low Power Oscillator IN) the 32.768KHz secondary clock to a GPIO on the CM3?

These are the GPIO used on the RPi3:-

[email protected] { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
[email protected] { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
[email protected] { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; };
[email protected] { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; };
[email protected] { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; };
[email protected] { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; };
[email protected] { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; };
[email protected] { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; };
[email protected] { function = "gp_clk"; termination = "pull_down"; }; // WIFI_CLK - Wifi 32kHz output

Also two "Internal" GPIO's are used on the I2C Port Expander:

GPIO 128 BT_ON
GPIO 129 WL_ON

If your not worried about power consumption, I'd not worry about these last "power contorl" GPIO's unless there is some issue of power sequencing I'm not aware of.

Primerypile
Posts: 4
Joined: Fri Jun 29, 2018 10:54 am

Re: Integrating BCM43438-based SDIO WiFi Module on CM3

Sun Jul 01, 2018 6:27 pm

Hello John

Thanks for your suggestions. We've only connected the SDIO pins at the moment. Reset and clock pins on the WiFi module are fixed to be always on and to use internal clock, respectively. It is my understanding that this setup should work. However, I think it would be cleaner/better to use the same setup as on the RPI3 if possible.

Will I need a custom device tree overlay to configure the WIFI_CLK & WL_ON pins on the compute module? I've been trying to find the corresponding section in the RPI3 dts, but couldn't find it. Can you provide a link to it?


On a side note: I found a couple of threads were people reported wifi issues; even on store bought rpi3. (search for "brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50")
viewtopic.php?p=1014512
viewtopic.php?p=919977

I've also read multiple times that people resorted to unloading/reloading the driver to fix the issue - just as I have - dunno what to think of that.

John Westlake
Posts: 82
Joined: Thu Nov 09, 2017 4:34 am

Re: Integrating BCM43438-based SDIO WiFi Module on CM3

Mon Jul 09, 2018 1:32 pm

Hows it going - have you made any progress? we are also considering implementing SDIO WiFi Module sometime in the future.

WRT your question, I'm no software guy (not since the days of ZX81 BASIC)...

I understand the I2C port connected to the GPIO expander that drives the various internal I/O's (including BT / WiFi enable and SMPS controller) can normally only be accessed from the VPU.... but there are extensions to control the Power LED's etc that are connected to the same BUS expander so its is possible to access these "Internal" GPIO's.

Primerypile
Posts: 4
Joined: Fri Jun 29, 2018 10:54 am

Re: Integrating BCM43438-based SDIO WiFi Module on CM3

Mon Jul 16, 2018 11:16 am

According to the module's datasheet the external clock should not be necessary. We are using the internal clock. The chip reset line has been connected to our reset-logic. I don't really know what that 'reset logic' entails, but we have the ability to reset the module from software if need be.

Our EE guys have completely redone the PCB layout. We've been promised a final, everything-included, prototype for tomorrow. We'll see how the WiFi behaves then.

If you plan on integrating SDIO all I can suggest is; get a devkit and try it out. We've spent alot of time getting the Silabs WF111 module to work - but ultimately had to give up. Your safest bet is to use the same components that are already used on other RPI models. That's my opinion as SW guy.

Return to “Compute Module”

Who is online

Users browsing this forum: No registered users and 4 guests