VAR-SOM-AM33 Linux Unit Testing: Difference between revisions

From Variscite Wiki
No edit summary
m (Text replacement - "http://variwiki" to "https://variwiki")
 
(52 intermediate revisions by 3 users not shown)
Line 4: Line 4:


= CPU info =
= CPU info =
<pre>
<pre>root@varsomam33:~# cat /proc/cpuinfo
root@am335x-evm:~# cat /proc/cpuinfo
processor       : 0
Processor       : ARMv7 Processor rev 2 (v7l)
model name      : ARMv7 Processor rev 2 (v7l)
BogoMIPS        : 598.35
BogoMIPS        : 298.80
Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls  
Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU implementer : 0x41
CPU architecture: 7
CPU architecture: 7
Line 15: Line 15:
CPU revision    : 2
CPU revision    : 2


Hardware        : VAR-SOM-AM33
Hardware        : Generic AM33XX (Flattened Device Tree)
Revision        : 0000
Revision        : 0000
Serial          : 0000000000000000
Serial          : 0000000000000000
root@am335x-evm:~# cat /proc/version
root@varsomam33:~# cat /proc/version
Linux version 3.2.0-AM335XPSP_04.06.00.11.VAR_R13 (uri@pluto) (gcc version 4.7.3 20130226
Linux version 4.1.6 (aviad@baba) (gcc version 4.9.3 20150413 (prerelease) (Linaro GCC 4.9-2015.05) ) #1 PREEMPT
(prerelease) (crosstool-NG linaro-1.13.1-4.7-2013.03-20130313 - Linaro GCC 2013.03) ) #1 T
Thu Dec 10 10:26:00 IST 2015
ue Oct 15 10:06:14 IST 2013
</pre>
</pre>


Line 34: Line 33:
Power down your board wait 15 seconds and power up. Check your system with date and the time should be up to date.<br>
Power down your board wait 15 seconds and power up. Check your system with date and the time should be up to date.<br>


= Audio record/play =
= Audio record/play =
<pre>
<pre>$ aplay /usr/share/sounds/alsa/Front_Center.wav
$ aplay /usr/share/sounds/alsa/Front_Center.wav
$ amixer sset 'Left Line1L Mux' differential
$ arecord -f cd -d 10 -D hw:0,0 test.wav
$ amixer sset 'Right Line1R Mux' differential
$ arecord -f dat -d 10 -D hw:0,0 -N  test.wav
$ aplay test.wav  
$ aplay test.wav  
</pre>
</pre>


= WLAN  =
= WLAN  =
''' VAR-SOM-AM33 V2.X only:''' <br>
When using VAR-SOM-AM33 v2.x, SOM has a WL183x module. In that case you should configure the WL183x module as follows (only in the first boot):
<pre>
$ cd /usr/bin/wlconf/
$ ./configure-device.sh
Then choose the correct number of module and antennas on board
For example for WL1831:
root@varsomam33:/usr/bin/wlconf# ./configure-device.sh
Please provide the following information.


Are you using a TI module? [y/n] : y
What is the chip flavor? [1801/1805/1807/1831/1835/1837 or 0 for unknown] : 1831
Should SISO40 support be applied? [y/n] : n
The device has been successfully configured.
TI Module: y
Chip Flavor: 1831
Number of 2.4GHz Antennas Fitted: 1
Number of 5GHz Antennas Fitted: 0
Diversity Support: n
SISO40 Support: n
Japanese Standards Applied: n
root@varsomam33:/usr/bin/wlconf# [  713.882024] wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11)
[  713.909501] wlcore: loaded
For example for WL1837:
root@varsomam33:/usr/bin/wlconf# ./configure-device.sh
Please provide the following information.
Are you using a TI module? [y/n] : y
What is the chip flavor? [1801/1805/1807/1831/1835/1837 or 0 for unknown] : 1837
Should Japanese standards be applied? [y/n] : n
How many 2.4GHz antennas are fitted? [1/2] : 2
How many 5GHz antennas are fitted? [0/1/2] : 2
The device has been successfully configured.
TI Module: y
Chip Flavor: 1837
Number of 2.4GHz Antennas Fitted: 2
Number of 5GHz Antennas Fitted: 2
Diversity Support: y
SISO40 Support: y
Japanese Standards Applied: n
root@varsomam33:/usr/bin/wlconf# [  872.471817] wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11)
[  872.499145] wlcore: loaded
</pre>
'''General usage:''' <br>
List SSIDs, from Linux shell type:  
List SSIDs, from Linux shell type:  
<pre>$&nbsp;ifconfig wlan0 up
<pre>$&nbsp;ifconfig wlan0 up
$&nbsp;iw wlan0 scan
$&nbsp;iw wlan0 scan
</pre>  
</pre>  
Connecting to an encrypted network<br>  
'''Connecting to an encrypted network:'''<br>  


Find your network from the above scan command.<br>  
Find your network from the above scan command.<br>  
Line 61: Line 117:
Calibration of TI WL12xx wireless device is required and is saved into the NVS file. The NVS file is then used by the wl12xx driver.
Calibration of TI WL12xx wireless device is required and is saved into the NVS file. The NVS file is then used by the wl12xx driver.
For more details please read [http://processors.wiki.ti.com/index.php/WL12xx_NLCP_Calibration_Process NLCP Calibration Process]
For more details please read [http://processors.wiki.ti.com/index.php/WL12xx_NLCP_Calibration_Process NLCP Calibration Process]
First time need to set mac address to be used automatically
<pre>
$ calibrator set nvs_mac /lib/firmware/ti-connectivity/wl1271-nvs.bin 00:00:00:00:00:00
</pre>
= 100Mbit Ethernet =
On Target:
<pre>$ ifconfig
$ iperf -s -u
</pre>
On Host:
<pre>$ iperf -c 192.168.1.189 -u -b95M
</pre>
= Gbit Ethernet =
On Target:
First, enable the eth1 Gbit ethernet interface:
<pre>$ ifconfig eth1 up
$ udhcpc -i eth1
</pre>
To test the performance of the interface, please type the following on the target:
<pre>$ ifconfig
$ iperf -s -u
</pre>
On Host:
<pre>$ iperf -c 192.168.1.189 -u -b400M
</pre>


= OpenGL demo (supported CPUs) =
= OpenGL demo (supported CPUs) =
Line 71: Line 158:
please follow TI wiki pages:
please follow TI wiki pages:
http://processors.wiki.ti.com/index.php/AM335x_ADC_Driver%27s_Guide
http://processors.wiki.ti.com/index.php/AM335x_ADC_Driver%27s_Guide
= USB OTG as host  =
By default the OTG is configure to be "peripheral". You can switch it to  "host" if you change the dr_mode in the device tree.
Please see details on the Wiki page below:
https://variwiki.com/index.php?title=VAR-SOM-AM33_Linux_SDK_7_Configurations
Once the USB-OTG port has been configured as host, simply connect a USB Mouse or DOK to the OTG port.
= USB OTG as device =
Plug a USB cable to a Linux or a Windows host.<br>
Follow [http://www.linux-usb.org/gadget/file_storage.html www.linux-usb.org/gadget/file_storage.html] and build the backing_file.<br>
On the Target:<br>
<pre>$ modprobe g_mass_storage file=./backing_file
</pre>
On the Host:<br>
Wait for a mass-storage device to be detected.


= Bluetooth =  
= Bluetooth =  
Line 76: Line 184:
<pre>
<pre>
$ hciconfig hci0 up
$ hciconfig hci0 up
</pre>
* Scan for BT devices and ping:
<pre>
$ hcitool scan  
$ hcitool scan  
$ l2ping 98:03:D8:C7:1A:96
</pre>
</pre>


Work with standard bluetooth API and commands
Then work with any other standard bluetooth API and commands.
= CAN Bus<br/> <br/> =
 


= CAN Bus =


*Connect CANL, CANH and GND pins of two VAR-SOM-AM33 boards (located on J17).
*Connect CANL, CANH and GND pins of two VAR-SOM-AM33 boards (located on J17).
*Power-up both boards.
*Power-up both boards.
*Type the following to the shell of board 1 (which is used for testing receiving over can0 device):
*Type the following into the shell of both boards for configuration the CAN bus device:
<pre>$ ip link set can0 type can bitrate 50000 triple-sampling on
<pre>$ ip link set can0 type can bitrate 50000 triple-sampling on
$ ip link set can0 up
$ ip link set can0 up
$ candump can0
</pre>
</pre>
*Type the following to the shell of board 1 (which is used for testing sending data packets over can0 device):
*Type the following to the shell of board 1 (which is used for testing receiving over can0 device):
<pre>$ ip link set can0 type can bitrate 50000 triple-sampling on
<pre>$ candump can0
$ ip link set can0 up
</pre>
$ cansend can0 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88</pre>
*Type the following to the shell of board 2 (which is used for testing sending data packets over can0 device):
<pre>$ cansend can0 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88</pre>
*At this point, board 1 will receive the data packet sent from board 2:
*At this point, board 1 will receive the data packet sent from board 2:
<pre>$ <0x001> [8] 11 22 33 44 55 66 77 88
<pre><0x001> [8] 11 22 33 44 55 66 77 88
</pre>
 
= RS-232 port =
*Enable RS232 UART ttyO1 I/F on the VAR-SOM-AM33:
<pre>
echo 20 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio20/direction
echo 0 > /sys/class/gpio/gpio20/value
</pre>


*Start minicom and connect to a UART device:
<pre>
minicom -D/dev/ttyO1 -b115200 -8
</pre>
</pre>
= SPI interface =
*The VAR-SOM-AM33 supports SPI interface over am335x SPI-1 bus.
*To enable the SPI bus, the developer should apply the following HW modifications on the VAR-AM33CustomBoard Rev1.2:
1) Remove resistors R9 and R10 (from CustomBoard carrier).<br>
2) Remove U21 component (from CustomBoard carrier).
*Download the kernel out-of-tree, and update the DTS:
<pre>
$ gedit arch/arm/boot/dts/var-som-am33.dts
</pre>
and update the following lines(change #if 0 to #if 1) - From:
<pre>
&spi1 {
status = "okay";
#if 0 /* NOTE: In order to use SPI on VAR-SOM-AM33 CustomBoard -
</pre>
To
<pre>
&spi1 {
status = "okay";
#if 1 /* NOTE: In order to use SPI on VAR-SOM-AM33 CustomBoard -
</pre>
*Rebuild the var-som-am33.dtb and replace it.
*Then, to test, build the SPI test application for ARM (and copy it to the target rootfs):
<pre>
$ cd Documentation/spi/
$ make spidev_test
$ sudo cp spidev_test /media/rootfs/sbin
</pre>
*Start the var-som-am33 board and run the test (SPI-Rx and SPI-Tx lines should be shorted for this test), as follows:
<pre>
root@varsomam33:~# spidev_test -D /dev/spidev1.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
FF FF FF FF FF FF
40 00 00 00 00 95
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
DE AD BE EF BA AD
F0 0D
root@varsomam33:~#
</pre>
Please see a more detailed explanation on the AM335x SPI interface on http://processors.wiki.ti.com/index.php/Linux_Core_SPI_User%27s_Guide
= Configuring WIFI as access point (supported on WL18xx only) =
== Configuring hostapd.conf ==
First, we will back up the existing hostapd.conf file by invoking:
<pre>
$ mv /etc/hostapd.conf /etc/hostapd.conf.orig
</pre>
Create a new hostapd.conf with the following content:
<pre>
$ vi /etc/hostapd.conf
</pre>
Copy/paste the following configuration file into /etc/hostapd.conf and save it:
<pre>
interface=wlan0
driver=nl80211
channel=1
hw_mode=g
preamble=1
dtim_period=2
beacon_int=100
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
supported_rates=10 20 55 110 60 90 120 180 240 360 480 540
basic_rates=10 20 55 110
ssid=SoftAP_Role
max_num_sta=5
macaddr_acl=0
auth_algs=3
ieee80211d=0
uapsd_advertisement_enabled=1
wep_rekey_period=0
own_ip_addr=127.0.0.1
wpa_group_rekey=0
wpa_strict_rekey=0
wpa_gmk_rekey=0
wpa_ptk_rekey=0
#ap_table_max_size=255
#ap_table_expiration_time=60
eap_server=1
disassoc_low_ack=1
ap_max_inactivity=4294967295
country_code=US
For AP on 5GHz set to these values:
channel=36
hw_mode=a
basic_rates=60 120 240
</pre>
Explanation:</br>
1) interface - in that case will be wlan0, since wlan0 will take the role of AP</br>
2) channel - should be the same as the commericial AP channel that the station (wlan0)is connected too (since AP and Station need to be in the same channel)</br>
3) hw_mode=g - to support 2.4GHz, a - to support 5GHz </br>
4) ieee80211n=1 - optional to support 802.11n band ssid - the AP SSID</br>
5) basic_rates=10 20 55 110 (11B rates for 2.4GHz) , 60 120 240 (11G rates for 5GHz as not allowed to use 11B in 5GHz)</br>
==  Configuring udhcpd.conf ==
First, we will back up the existing udhcpd.conf file by invoking:
<pre>
$ mv /etc/udhcpd.conf /etc/udhcpd.conf.orig
</pre>
Create a new udhcpd.conf with the following content:
- opt router: is the Router IP address and have to be the same as was defined by ifconfig command, in that example it is 10.4.30.34
<pre>
$ vi /etc/udhcpd.conf
</pre>
Copy/paste the following configuration file into /etc/udhcpd.conf and save it:
<pre>
# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
start 10.4.30.40 #default: 192.168.0.20
end 10.4.30.48 #default: 192.168.0.254
# The interface that udhcpd will use
interface  wlan0 #default: eth0
#Examles
opt dns 8.8.8.8  8.8.4.4 # public google dns servers
option subnet 255.255.255.0
opt router 10.4.30.34
option lease 864000 # 10 days of
</pre>
==  operate WLAN as AP (Run hostapd) ==
<pre>
hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
</pre>
Expected results:
<pre>
root@varsomam33:~# hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
Configuration file: /etc/hostapd.conf
rfkill: Cannot open RFKILL control device
[  137.215567] wlcore: PHY firmware version: Rev 8.2.0.0.232
[  137.266947] wlcore: firmware booted (Rev 8.9.0.0.48)
[  137.293599] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE[  137.304404] cfg80211: Calling CRDA for country: US
root@varsomam33:~# [  137.372193] cfg80211: Regulatory domain changed to country: US
[  137.378114] cfg80211:  DFS Master region: FCC
[  137.383328] cfg80211:  (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[  137.393336] cfg80211:  (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[  137.402341] cfg80211:  (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 1700 mBm), (N/A)
[  137.412024] cfg80211:  (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
[  137.422169] cfg80211:  (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[  137.430304] cfg80211:  (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[  137.461606] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
</pre>
Assign IP address to the wlan port, note that it has to be the same one as defined in the "udhcpd.conf" file in field "opt router"
<pre>
$ ifconfig wlan0 10.4.30.34 netmask 255.255.255.0 up
</pre>
Add NAT and DHCP server capability to the AP:
<pre>
echo 1 > /proc/sys/net/ipv4/ip_forward
udhcpd /etc/udhcpd.conf
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
</pre>
== Enable NAT for internet sharing ==
Assumption: Internet connection is available on port eth0 and we want to share it with wlan0 incoming access point connections.
We type the following to enable internet sharing, in this case:
<pre>
$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
</pre>
Please see more details on http://processors.wiki.ti.com/index.php/WiLink8_WLAN_Demo:_Linux#AP_.28create_AP_with_no_security.29

Latest revision as of 11:54, 10 June 2020

Unit Testing

CPU info

root@varsomam33:~# cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 2 (v7l)
BogoMIPS        : 298.80
Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc08
CPU revision    : 2

Hardware        : Generic AM33XX (Flattened Device Tree)
Revision        : 0000
Serial          : 0000000000000000
root@varsomam33:~# cat /proc/version
Linux version 4.1.6 (aviad@baba) (gcc version 4.9.3 20150413 (prerelease) (Linaro GCC 4.9-2015.05) ) #1 PREEMPT 
Thu Dec 10 10:26:00 IST 2015

RTC

To set the RTC first set the date from Linux shell, type:

$ date 2013.08.27-15:43

Then set the real time clock from Linux shell, type:

$ hwclock --systohc

Power down your board wait 15 seconds and power up. Check your system with date and the time should be up to date.

Audio record/play

$ aplay /usr/share/sounds/alsa/Front_Center.wav
$ amixer sset 'Left Line1L Mux' differential
$ amixer sset 'Right Line1R Mux' differential
$ arecord -f dat -d 10 -D hw:0,0 -N  test.wav
$ aplay test.wav 

WLAN

VAR-SOM-AM33 V2.X only:
When using VAR-SOM-AM33 v2.x, SOM has a WL183x module. In that case you should configure the WL183x module as follows (only in the first boot):

$ cd /usr/bin/wlconf/
$ ./configure-device.sh
Then choose the correct number of module and antennas on board


For example for WL1831:

root@varsomam33:/usr/bin/wlconf# ./configure-device.sh

Please provide the following information.

Are you using a TI module? [y/n] : y
What is the chip flavor? [1801/1805/1807/1831/1835/1837 or 0 for unknown] : 1831
Should SISO40 support be applied? [y/n] : n

The device has been successfully configured.
TI Module: y
Chip Flavor: 1831
Number of 2.4GHz Antennas Fitted: 1
Number of 5GHz Antennas Fitted: 0
Diversity Support: n
SISO40 Support: n
Japanese Standards Applied: n

root@varsomam33:/usr/bin/wlconf# [  713.882024] wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11)
[  713.909501] wlcore: loaded


For example for WL1837:

root@varsomam33:/usr/bin/wlconf# ./configure-device.sh

Please provide the following information.

Are you using a TI module? [y/n] : y
What is the chip flavor? [1801/1805/1807/1831/1835/1837 or 0 for unknown] : 1837
Should Japanese standards be applied? [y/n] : n
How many 2.4GHz antennas are fitted? [1/2] : 2
How many 5GHz antennas are fitted? [0/1/2] : 2

The device has been successfully configured.
TI Module: y
Chip Flavor: 1837
Number of 2.4GHz Antennas Fitted: 2
Number of 5GHz Antennas Fitted: 2
Diversity Support: y
SISO40 Support: y
Japanese Standards Applied: n

root@varsomam33:/usr/bin/wlconf# [  872.471817] wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11)
[  872.499145] wlcore: loaded

General usage:
List SSIDs, from Linux shell type:

$ ifconfig wlan0 up
$ iw wlan0 scan

Connecting to an encrypted network:

Find your network from the above scan command.

$ wpa_passphrase <YourAP> <YourPassword> >wpa.conf
$ ps | grep wpa_supplicant
*kill the wpa_supplicant process if exist.
$ wpa_supplicant -Dnl80211 -iwlan0 -c./wpa.conf -B
$ udhcpc -iwlan0
$ ifconfig
  • WL12xx calibration tool

Calibration of TI WL12xx wireless device is required and is saved into the NVS file. The NVS file is then used by the wl12xx driver. For more details please read NLCP Calibration Process

First time need to set mac address to be used automatically

$ calibrator set nvs_mac /lib/firmware/ti-connectivity/wl1271-nvs.bin 00:00:00:00:00:00

100Mbit Ethernet

On Target:

$ ifconfig
$ iperf -s -u

On Host:

$ iperf -c 192.168.1.189 -u -b95M

Gbit Ethernet

On Target:

First, enable the eth1 Gbit ethernet interface:

$ ifconfig eth1 up
$ udhcpc -i eth1

To test the performance of the interface, please type the following on the target:

$ ifconfig
$ iperf -s -u

On Host:

$ iperf -c 192.168.1.189 -u -b400M 

OpenGL demo (supported CPUs)

Run the demo script at Linux command prompt after the VAR-DVK-AM33 EVB boots up

/etc/init.d/335x-demo 

ADC controller

please follow TI wiki pages: http://processors.wiki.ti.com/index.php/AM335x_ADC_Driver%27s_Guide

USB OTG as host

By default the OTG is configure to be "peripheral". You can switch it to "host" if you change the dr_mode in the device tree.

Please see details on the Wiki page below: https://variwiki.com/index.php?title=VAR-SOM-AM33_Linux_SDK_7_Configurations

Once the USB-OTG port has been configured as host, simply connect a USB Mouse or DOK to the OTG port.

USB OTG as device

Plug a USB cable to a Linux or a Windows host.

Follow www.linux-usb.org/gadget/file_storage.html and build the backing_file.

On the Target:

$ modprobe g_mass_storage file=./backing_file

On the Host:
Wait for a mass-storage device to be detected.

Bluetooth

  • Bring BT device up:
$ hciconfig hci0 up
  • Scan for BT devices and ping:
$ hcitool scan 
$ l2ping 98:03:D8:C7:1A:96

Then work with any other standard bluetooth API and commands.

CAN Bus

  • Connect CANL, CANH and GND pins of two VAR-SOM-AM33 boards (located on J17).
  • Power-up both boards.
  • Type the following into the shell of both boards for configuration the CAN bus device:
$ ip link set can0 type can bitrate 50000 triple-sampling on
$ ip link set can0 up
  • Type the following to the shell of board 1 (which is used for testing receiving over can0 device):
$ candump can0
  • Type the following to the shell of board 2 (which is used for testing sending data packets over can0 device):
$ cansend can0 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88
  • At this point, board 1 will receive the data packet sent from board 2:
<0x001> [8] 11 22 33 44 55 66 77 88

RS-232 port

  • Enable RS232 UART ttyO1 I/F on the VAR-SOM-AM33:
echo 20 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio20/direction
echo 0 > /sys/class/gpio/gpio20/value
  • Start minicom and connect to a UART device:
minicom -D/dev/ttyO1 -b115200 -8

SPI interface

  • The VAR-SOM-AM33 supports SPI interface over am335x SPI-1 bus.
  • To enable the SPI bus, the developer should apply the following HW modifications on the VAR-AM33CustomBoard Rev1.2:

1) Remove resistors R9 and R10 (from CustomBoard carrier).
2) Remove U21 component (from CustomBoard carrier).

  • Download the kernel out-of-tree, and update the DTS:
$ gedit arch/arm/boot/dts/var-som-am33.dts

and update the following lines(change #if 0 to #if 1) - From:

&spi1 {
	status = "okay";

#if 0	/* NOTE: In order to use SPI on VAR-SOM-AM33 CustomBoard -

To

&spi1 {
	status = "okay";

#if 1	/* NOTE: In order to use SPI on VAR-SOM-AM33 CustomBoard -
  • Rebuild the var-som-am33.dtb and replace it.
  • Then, to test, build the SPI test application for ARM (and copy it to the target rootfs):
$ cd Documentation/spi/
$ make spidev_test
$ sudo cp spidev_test /media/rootfs/sbin
  • Start the var-som-am33 board and run the test (SPI-Rx and SPI-Tx lines should be shorted for this test), as follows:
root@varsomam33:~# spidev_test -D /dev/spidev1.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

FF FF FF FF FF FF
40 00 00 00 00 95
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
DE AD BE EF BA AD
F0 0D
root@varsomam33:~#

Please see a more detailed explanation on the AM335x SPI interface on http://processors.wiki.ti.com/index.php/Linux_Core_SPI_User%27s_Guide

Configuring WIFI as access point (supported on WL18xx only)

Configuring hostapd.conf

First, we will back up the existing hostapd.conf file by invoking:

$ mv /etc/hostapd.conf /etc/hostapd.conf.orig

Create a new hostapd.conf with the following content:

$ vi /etc/hostapd.conf

Copy/paste the following configuration file into /etc/hostapd.conf and save it:

interface=wlan0
driver=nl80211
channel=1
hw_mode=g
preamble=1
dtim_period=2
beacon_int=100
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
supported_rates=10 20 55 110 60 90 120 180 240 360 480 540
basic_rates=10 20 55 110
ssid=SoftAP_Role
max_num_sta=5
macaddr_acl=0
auth_algs=3
ieee80211d=0
uapsd_advertisement_enabled=1
wep_rekey_period=0
own_ip_addr=127.0.0.1
wpa_group_rekey=0
wpa_strict_rekey=0
wpa_gmk_rekey=0
wpa_ptk_rekey=0
#ap_table_max_size=255
#ap_table_expiration_time=60
eap_server=1
disassoc_low_ack=1
ap_max_inactivity=4294967295
country_code=US


For AP on 5GHz set to these values: 

channel=36
hw_mode=a
basic_rates=60 120 240 

Explanation:
1) interface - in that case will be wlan0, since wlan0 will take the role of AP
2) channel - should be the same as the commericial AP channel that the station (wlan0)is connected too (since AP and Station need to be in the same channel)
3) hw_mode=g - to support 2.4GHz, a - to support 5GHz
4) ieee80211n=1 - optional to support 802.11n band ssid - the AP SSID
5) basic_rates=10 20 55 110 (11B rates for 2.4GHz) , 60 120 240 (11G rates for 5GHz as not allowed to use 11B in 5GHz)

Configuring udhcpd.conf

First, we will back up the existing udhcpd.conf file by invoking:

$ mv /etc/udhcpd.conf /etc/udhcpd.conf.orig

Create a new udhcpd.conf with the following content: - opt router: is the Router IP address and have to be the same as was defined by ifconfig command, in that example it is 10.4.30.34

$ vi /etc/udhcpd.conf

Copy/paste the following configuration file into /etc/udhcpd.conf and save it:

# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
start 		10.4.30.40	#default: 192.168.0.20
end		10.4.30.48	#default: 192.168.0.254
# The interface that udhcpd will use
interface   wlan0		#default: eth0
#Examles
opt	dns	8.8.8.8  8.8.4.4 # public google dns servers
option	subnet	255.255.255.0
opt	router	10.4.30.34
option	lease	864000		# 10 days of

operate WLAN as AP (Run hostapd)

hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid

Expected results:

root@varsomam33:~# hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
Configuration file: /etc/hostapd.conf
rfkill: Cannot open RFKILL control device
[  137.215567] wlcore: PHY firmware version: Rev 8.2.0.0.232
[  137.266947] wlcore: firmware booted (Rev 8.9.0.0.48)
[  137.293599] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE[  137.304404] cfg80211: Calling CRDA for country: US

root@varsomam33:~# [  137.372193] cfg80211: Regulatory domain changed to country: US
[  137.378114] cfg80211:  DFS Master region: FCC
[  137.383328] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[  137.393336] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[  137.402341] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 1700 mBm), (N/A)
[  137.412024] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
[  137.422169] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[  137.430304] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[  137.461606] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

Assign IP address to the wlan port, note that it has to be the same one as defined in the "udhcpd.conf" file in field "opt router"

$ ifconfig wlan0 10.4.30.34 netmask 255.255.255.0 up

Add NAT and DHCP server capability to the AP:

echo 1 > /proc/sys/net/ipv4/ip_forward
udhcpd /etc/udhcpd.conf
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

Enable NAT for internet sharing

Assumption: Internet connection is available on port eth0 and we want to share it with wlan0 incoming access point connections.

We type the following to enable internet sharing, in this case:

$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Please see more details on http://processors.wiki.ti.com/index.php/WiLink8_WLAN_Demo:_Linux#AP_.28create_AP_with_no_security.29