PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2219
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SDIO1 CM3+ WILC1000

Fri May 17, 2019 7:38 am

You can compile with:

Code: Select all

$ dtc [email protected] -I dts -O dtb -o sdio-overlay-final.dtbo sdio-overlay-final.dts
However, I would make the name something more meaningful like wilc_sdio.dtbo. Whatever name you choose, copy the .dtbo to /boot/overlays and add "dtoverlay=your_name.dtbo" to config.txt.

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Fri May 17, 2019 8:05 am

PhilE wrote:
Fri May 17, 2019 7:38 am
You can compile with:

Code: Select all

$ dtc [email protected] -I dts -O dtb -o sdio-overlay-final.dtbo sdio-overlay-final.dts
However, I would make the name something more meaningful like wilc_sdio.dtbo. Whatever name you choose, copy the .dtbo to /boot/overlays and add "dtoverlay=your_name.dtbo" to config.txt.
Ok thank you.
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

wilc-sdio
Can wilc-sdio.ko be anywhere or does it have to be in /lib/modules/<kernel_version>/kernel/drivers/staging/ ?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2219
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SDIO1 CM3+ WILC1000

Fri May 17, 2019 8:11 am

It needs to have been processed by the "depmod" utility (i.e. you will have to run depmod) along with all of the other modules - I don't think you can add modules one at a time - so it should be somewhere under /lib/modules/<kernel_version>, but I don't think it matters precisely where.

kaushalyas
Posts: 19
Joined: Fri Apr 05, 2019 4:10 am

Re: SDIO1 CM3+ WILC1000

Fri May 17, 2019 8:30 am

Hi,

This is my final setup.

Image

I used the version in wilc git repo.

I have this in my /boot/config.txt

Code: Select all

dtoverlay=sdio,poll_once=off,bus_width=4
Cheers,
Attachments
final setup.png
final setup.png (188.12 KiB) Viewed 1910 times
Last edited by kaushalyas on Fri May 17, 2019 8:40 am, edited 1 time in total.

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Fri May 17, 2019 8:33 am

Thank you. I don't have the same version as of ATWILC1000-SD as you. I guess that the pin above the 9 SDIO pins are chip_en, irq and reset, right ?

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Fri May 17, 2019 8:37 am

Good news... and bad news. It works once for me !

After that, I disconnected the wire and the kernel crashed. Now that I have rebooted the raspi, the mmc1 isn't working anymore... any idea ?

Code: Select all

[email protected]:~$ sudo cat /sys/kernel/debug/mmc1/ios
clock:          0Hz
vdd:            0 (invalid)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     0 (off)
bus width:      0 (1 bits)
timing spec:    0 (legacy)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)

kaushalyas
Posts: 19
Joined: Fri Apr 05, 2019 4:10 am

Re: SDIO1 CM3+ WILC1000

Fri May 17, 2019 12:21 pm

Hi, Yeah the above row of pins of the ATWILC include en, reset nd irq. I havent wired any of them. The driver apparently doesnt support out-bound interrupt (It uses DAT1 as the in-bound irq) So you should disable it in kernel config. However you need to assign a GPIO to it, otherwise driver probe fails.

One thing I noted in the driver is that the en and reset GPIOs gets configured as inputs when driver loads. I coudn't dig deep into whats happening there. Will check it. But as we use the dev kit, we should be ok.

You mean when you load the driver, you loose the sdio? I didn't experience anything like that.

How I tried debugging might help you as well. Since after the kernel oops I cant get any dmesgs, I wired up a USB to ethernet interface to CMIO. Then I get ssh to eth0, and run "dmesg -w" to continuously receive the dmesgs on the ssh terminal. Then I load the driver in my serial terminal. That way I could see what's happening almost real time. May be you can do something similar to observe whats happening when you load the driver.

Also kill the dhcpcd daemon by "sudo dhcpcd -k" before loading the driver. Otherwise as soon as wlan0 interface is up, the dhcpcd starts the DHCP session and causes the kernel oops.

Good luck and let me know if I can be of any help.

Cheers,

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Tue May 21, 2019 1:57 am

Hi,

I found the problem. I was just trying to disconnect and reconnect the dev board like I use to do when I was using poll_once=false...

Now, it works. I'm able to use it as a STA or a softAP. Thank you for your help !

Now I will try to run some test to see if the kernel oops are frequent. For the moment, my wiring is not really nice and I got a kernel oops if I move the board or when there is some vibration. I hope this will be fixed once I use it on a pcb. Although, it would have been nice if this wifi module didn't cause a kernel oops every time there is a problem.

Cheers,
Antoine

kaushalyas
Posts: 19
Joined: Fri Apr 05, 2019 4:10 am

Re: SDIO1 CM3+ WILC1000

Tue May 21, 2019 2:45 am

Hey Antoine,

Thats good news. Congrats.

I think the wiring is a big contributor to the oops, but also I think there is a bug in the driver that does not gracefully handle a CMD52 read operation failure. I will try to contact the maintainers to get it sorted.

I am trying to get the SoftAP working. I am refering to "http://ww1.microchip.com/downloads/en/D ... rGuide.pdf" but not clear about S80dhcp-server stuff. Could you please shed some light?

Cheers,
kaushalyas

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Tue May 21, 2019 3:08 am

kaushalyas wrote:
Tue May 21, 2019 2:45 am
Hey Antoine,

Thats good news. Congrats.

I think the wiring is a big contributor to the oops, but also I think there is a bug in the driver that does not gracefully handle a CMD52 read operation failure. I will try to contact the maintainers to get it sorted.

I am trying to get the SoftAP working. I am refering to "http://ww1.microchip.com/downloads/en/D ... rGuide.pdf" but not clear about S80dhcp-server stuff. Could you please shed some light?

Cheers,
kaushalyas
I have followed this tutorial : https://www.raspberrypi.org/documentati ... s-point.md

I think it's easier and it works for me. (No need the rooting part if you don't need internet access.)

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Tue May 21, 2019 9:44 am

kaushalyas wrote:
Tue May 21, 2019 2:45 am
Hey Antoine,

Thats good news. Congrats.

I think the wiring is a big contributor to the oops, but also I think there is a bug in the driver that does not gracefully handle a CMD52 read operation failure. I will try to contact the maintainers to get it sorted.

I am trying to get the SoftAP working. I am refering to "http://ww1.microchip.com/downloads/en/D ... rGuide.pdf" but not clear about S80dhcp-server stuff. Could you please shed some light?

Cheers,
kaushalyas
Does the cmd52 & cmd53 prevent you from running the module? I often have the "Failed cmd53, read reg.." error that prevent me to set up the wlan..

It's even more frustrating to be stuck here now that I've managed to use the module as a softAP several times.

kaushalyas
Posts: 19
Joined: Fri Apr 05, 2019 4:10 am

Re: SDIO1 CM3+ WILC1000

Wed May 22, 2019 4:59 am

Hi,

I dont see any failure of CMD52/53 no in my case. I am not 100% sure what causes the CMD52/53 failure.

Also I cant get the AP mode running after following the raspberry Pi document.

I can see following network interfaces.

Code: Select all

mon.wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        unspec 00-00-00-00-00-00-30-30-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.110.11.5  netmask 255.255.0.0  broadcast 10.110.255.255
        inet6 fe80::faf0:5ff:fee5:46c5  prefixlen 64  scopeid 0x20<link>
        ether f8:f0:05:e5:46:c5  txqueuelen 1000  (Ethernet)
        RX packets 48172  bytes 4760911 (4.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 47552  bytes 4689913 (4.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
The IP for the wlan0 is from dhcpcd. Should I disable dhcp on wlan0 and assign a static IP?

Also I time to time get the

Code: Select all


[  602.086826] wilc_sdio mmc1:0001:1 wlan0: INFO [debug_thread]*** Debug Thread Running ***
[  608.486877] wilc_sdio mmc1:0001:1 wlan0: INFO [debug_thread]*** Debug Thread Running ***
[  613.457670] wilc_sdio mmc1:0001:1 wlan0: INFO [add_key]Adding key with cipher suite = fac04
[  613.457685] wilc_sdio mmc1:0001:1 wlan0: INFO [add_key]b80881a0 b9cc0000 2
[  613.457697] wilc_sdio mmc1:0001:1 wlan0: INFO [add_key]key d3 28 61
[  613.457765] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[  613.470506] pgd = 2857ec76
[  613.475466] [00000000] *pgd=00000000
[  613.481269] Internal error: Oops: 17 [#1] SMP ARM

Message from [email protected] at May 22 06:03:05 ...
 kernel:[  613.481269] Internal error: Oops: 17 [#1] SMP ARM
[  613.488773] Modules linked in: ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 snd_bcm2835(C) bcm2835_codec(C) v4l2_mem2mem bcm2835_v4l2(C) v4l2_common bcm2835_mmal_vchiq(C) raspberrypi_hwmon snd_pcm videobuf2_vmalloc videobuf2_dma_contig hwmon snd_timer videobuf2_memops snd videobuf2_v4l2 videobuf2_common videodev media vc_sm_cma(C) fixed uio_pdrv_genirq uio wilc_sdio sha256_generic cfg80211 rfkill ip_tables x_tables ipv6
[  613.544732] CPU: 0 PID: 45 Comm: kworker/u8:1 Tainted: G         C        4.19.42-v7+ #2
[  613.557975] Hardware name: BCM2835
[  613.564032] Workqueue: WILC_wq handle_key [wilc_sdio]
[  613.571748] PC is at handle_key+0x218/0x80c [wilc_sdio]
[  613.578311] LR is at   (null)
[  613.582582] pc : [<7f18feec>]    lr : [<00000000>]    psr: 60000013
[  613.590205] sp : b9f71e70  ip : b657f680  fp : b9f71f0c
[  613.596790] r10: 00000000  r9 : 00000000  r8 : b657f640
[  613.603377] r7 : b5848b20  r6 : 00000001  r5 : b9cc0500  r4 : b96bfb70
[  613.611241] r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : b657f650
[  613.619060] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  613.627534] Control: 10c5383d  Table: 358f806a  DAC: 00000055
[  613.634646] Process kworker/u8:1 (pid: 45, stack limit = 0xf14412c0)
[  613.642389] Stack: (0xb9f71e70 to 0xb9f72000)

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Wed May 22, 2019 9:44 am

kaushalyas wrote:
Wed May 22, 2019 4:59 am
Hi,

I dont see any failure of CMD52/53 no in my case. I am not 100% sure what causes the CMD52/53 failure.

Also I cant get the AP mode running after following the raspberry Pi document.

I can see following network interfaces.

Code: Select all

mon.wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        unspec 00-00-00-00-00-00-30-30-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.110.11.5  netmask 255.255.0.0  broadcast 10.110.255.255
        inet6 fe80::faf0:5ff:fee5:46c5  prefixlen 64  scopeid 0x20<link>
        ether f8:f0:05:e5:46:c5  txqueuelen 1000  (Ethernet)
        RX packets 48172  bytes 4760911 (4.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 47552  bytes 4689913 (4.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
The IP for the wlan0 is from dhcpcd. Should I disable dhcp on wlan0 and assign a static IP?
What do you mean ? Did you add this in /etc/dhcpcd.conf ?

Code: Select all

interface wlan0
    static ip_address=192.168.4.1/24
    nohook wpa_supplicant

kaushalyas
Posts: 19
Joined: Fri Apr 05, 2019 4:10 am

Re: SDIO1 CM3+ WILC1000

Thu May 23, 2019 4:44 am

Hi, I initially tried it with DHCP on station mode.

I have

Code: Select all

source-directory /etc/network/interfaces.d
auto wlan0

allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
in /etc/network/interfaces

My idea is to run both client and AP modes concurrently. Have you done that?

When I remove that section and have static IP assigned as you mentioned, I can see the AP. But after some time it disappears!!

Also I can see

Code: Select all

[FAILED] Failed to start Advanced IEEE 802.11… 802.1X/WPA/WPA2/EAP Authenticator.
when it boots up.

Cheers,

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Thu May 23, 2019 8:21 am

No I haven't done that, I can't help you on this part sorry.

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Mon May 27, 2019 9:01 am

Hi !

Have you succeeded to resolve your problem ?

For my side, I decided to buy a new module and it work now (well, sometime at least). However, it doesn't run at the boot (the module wilc-sdio.ko is not loaded even if I added wilc-sdio in /etc/nodules), but this is a minor problem.

One more thing, I'm curious about the way you install the driver, do you do like this ?

Code: Select all

sudo rpi-update
sudo reboot
sudo apt-get install git bc bison flex libssl-dev libncurses5-dev -y
git clone --depth=1 https://github.com/linux4wilc/driver
git clone --depth=1 https://github.com/linux4wilc/firmware
git clone --depth=1 https://github.com/raspberrypi/linux
rm linux/drivers/staging/wilc1000/*
cp driver/wilc/* linux/drivers/staging/wilc1000/
cd linux
KERNEL=kernel7
make bcm2709_defconfig
make menuconfig
	>>add device drivers -> staging drivers -> wilc sdio module
make prepare
make modules_prepare
make modules SUBDIRS=drivers/staging/wilc1000/
sudo cp drivers/staging/wilc1000/wilc-sdio.ko /lib/modules/<kernel_version>/kernel/drivers/staging/
sudo nano /boot/config.txt
	>>add this line at the end : dtoverlay=sdio,poll_once=off
sudo reboot
sudo mkdir /lib/firmware/mchp 
sudo cp firmware/wilc1000_wifi_firmware.bin /lib/firmware/mchp/
sudo apt-get -y install hostapd
sudo insmod /lib/modules/<kernel_version>/kernel/drivers/staging/wilc/wilc-sdio.ko
Cheers,
Antoine

kaushalyas
Posts: 19
Joined: Fri Apr 05, 2019 4:10 am

Re: SDIO1 CM3+ WILC1000

Tue May 28, 2019 1:28 am

Hi Antoine,

It seems like you are building it locally. I cross compiled it in my Ubuntu virtual environment and flashed the kernel, DTBs, overlays and drivers to the eMMC by using rpiboot as explained in https://www.raspberrypi.org/documentati ... uilding.md

To integrate the driver to kernel source, I followed the Section 2 of http://ww1.microchip.com/downloads/en/D ... 05329C.pdf. I did what is mentioned in section 2.1 and 2.2 so didnt used the staging.

As I have mentioned, I modified the sdio-overlay.dts. Then did kernel menuconfig to enable the microchip driver and build the image.

As I don't have buildroot configured yet, I first flashed the pre-built Raspbian Stretch Lite image to the CM3+. Then I could mount the boot and root partitions into my dev environment after running rpiboot utility. Then I could update kernel, drivers, dtb and overlays to appropriate folders.

Then finally modified the /boot/config.txt to include

Code: Select all

dtoverlay=sdio,poll_once=off,bus_width=4
Your git clone paths seems correct.

Cheers,
Kaushalyas

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Tue May 28, 2019 8:38 am

Hi,

Thank you for the precision. Yes, I am building the driver locally without any dependencies so I don't have to rebuild the whole kernel. I don't know if this can cause stability issues but at least it works for my test.

You have managed to merge the sdio-overlay with the one you sent or do you your custom one as sdio-overlay ?

Cheers,

kaushalyas
Posts: 19
Joined: Fri Apr 05, 2019 4:10 am

Re: SDIO1 CM3+ WILC1000

Tue May 28, 2019 8:43 am

Hi,

Yes I think build locally or cross compiled wouldn't affect the stability. What errors you see now?

I just edited the existing sdio-overlay.dts and update as what I have attached. Then build it dts and update the eMMC as given in raspberry pi kernel build page.

Cheers,

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Tue May 28, 2019 8:53 am

Now it works when I install the driver on the stretch image but it doesn't work with my application (A web server is running on the raspi and the user can access to this server when he is connected to the raspi access point).

So when I run the driver, I got the error : "mmc1 sdio cmd53 failed, error(-84)". I think I've made a mistake during the installation that disrupts sdio communication. That's why I am trying to follow a clean installation process now.

EDIT: I've managed to make it work, thank you for precision. I still have some kernel oops sometime. I guess it's because of the wiring so we will see how it work on a pcb.

Cheers,

kaushalyas
Posts: 19
Joined: Fri Apr 05, 2019 4:10 am

Re: SDIO1 CM3+ WILC1000

Tue May 28, 2019 10:45 am

hmm this is the same I was seeing before reducing the clock, the dreaded CMD52/53 failures with error -84 and sometimes -110(based on memory).

You have shorten up the wiring? make sure the clock is low? or even make it lower and see.

Cheers,
Kaushalyas

antoinebore
Posts: 51
Joined: Fri Apr 12, 2019 4:01 am

Re: SDIO1 CM3+ WILC1000

Fri May 31, 2019 4:03 am

OK, I found the problem. The server tried to use the GPIO25 which is used for the SDIO communication.

Now all work as expected, thank you for your help !

Return to “Compute Module”