How to connect to WPA/WPA2 Wifi Network in CM-FX6 (Debian)

The default Wifi device name is mlan0 on the iMX6. We will bring this wifi link up.

> ip link show mlan0

> ip link set mlan0 up

Then check whether mlan0 is up.

> ip link show mlan0

You should see there is a UP in the text that you see.

To scan for wifi networks.

> iwlist scan

Keep a look out for the SSID name, this is the Wifi network name you want to connect to.

Create a passphrase to connect to the Wifi SSID.

> wpa_passphrase <wifiname> >> /etc/wpa_supplicant.conf

(type in the passphrase and press enter)

> cat /etc/wpa_supplicant.conf

You should see your passphrase in the conf file.

Run wpa_supplicant with the new conf file.

> wpa_supplicant -B -D wext -i mlan0 -c /etc/wpa_supplicant.conf

-B means run wpa_supplicant in the background.
-D specifies the wireless driver. wext is the generic driver.
-c specifies the path for the configuration file.

Obtain the IP address by DHCP.

> dhclient mlan0

> ip route show

You should see that mlan0 is an entry in the route table.

At this juncture, you are connected to the internet. Congratulations!

Enabling GPIO Without Recompiling Kernel

Recently I needed to access a GPIO signal on the CM-FX6.

After searching, to convert from the iMX6 multifunction signal to the gpioXX number in Linux userspace, you have to do the following :

linux gpio number = (gpio_bank – 1) * 32 + gpio_bit

For GPIO2_25,

XX = (2 – 1) * 32 + 25  = 57

However, doing this

# echo 57 > /sys/class/gpio/export

# echo out > /sys/class/gpio/gpio57/direction

# echo 1 > /sys/class/gpio/gpio57/value

still didn’t work. Reading, I realised you need to ensure that the multiplexer on the card itself is set to use GPIO2_25. Search for GPIO2_25 in The corresponding iMX6 Mux Pad value is EIM_OE Look up EIM_OE in iMX6 Reference Manual You will realise that you need to set IOMUXC_SW_MUX_CTL_PAD_EIM_OE_B at physical memory 20E_0100h So that means you have to add the corresponding code and recompile the kernel, right? But you may not want to do so, for various reasons. What you can do is this : Make use of the “devmem2” application. Make sure that you are root.

1) Download it:

# wget

2) Make it executable:

# chmod +x devmem2

3) Read the IOMUXC_SW_MUX_CTL_PAD_EIM_OE value # ./devmem2 0x20E0100

4) Set the IOMUXC_SW_MUX_CTL_PAD_EIM_OE value # ./devmem2 0x20E0100 w 5

Check it :

# echo 57 > /sys/class/gpio/export

# echo out > /sys/class/gpio/gpio57/direction

# echo 1 > /sys/class/gpio/gpio57/value

Measure the voltage from this pin on your baseboard, it should give ~3.3v. You need to set the multiplexer values in /etc/rc.local as it is not persistent. References: