DART-6UL Yocto Unit Testing V1 Fido: Difference between revisions

From Variscite Wiki
m (Text replacement - "http://variscite" to "https://variscite")
 
(14 intermediate revisions by one other user not shown)
Line 22: Line 22:
wlcore: Association completed.
wlcore: Association completed.
</pre>
</pre>
Disable eth0:
Disable eth0,eth1:
<pre>
<pre>
$ ifconfig eth0 down
$ ifconfig eth0 down
$ ifconfig eth1 down
</pre>
</pre>
Run DHCP:
Run DHCP:
Line 34: Line 35:
<br>
<br>
'''Useful link for common iw commands:''' https://wiki.archlinux.org/index.php/Wireless_network_configuration#Manual_setup
'''Useful link for common iw commands:''' https://wiki.archlinux.org/index.php/Wireless_network_configuration#Manual_setup
== Access Point ==
== Access Point ==
This example will demonstrate you how to use the VAR-SOM-MX6 as an access point. It will forward packets from wlan0 to eth0.
This example will demonstrate you how to use the DART-6UL as an access point. It will forward packets from wlan0 to eth0.
DHCPD:
DHCPD:
<pre>$ vi /etc/udhcpd.conf  
<pre>$ vi /etc/udhcpd.conf  
Line 81: Line 83:
</pre>
</pre>


= Ethernet =
= Ethernet (2 ports) =
On Target:
On Target:
You can plug in the Ethernet cable into port 0 or port 1.
<pre>$ ifconfig
<pre>$ ifconfig
$ iperf -s -u
$ iperf -s -u
Line 96: Line 99:


= Audio record/play  =
= Audio record/play  =
<pre>$ amixer set PCM 125
<pre>$ amixer set 'Output Mixer HiFi' on
$ aplay /usr/share/sounds/alsa/Front_Center.wav
$ amixer set Master 150
$ arecord -f cd -d 10 -D hw:0,0 test.wav
$ aplay /usr/share/sounds/alsa/Front_Center.wav  
 
$ amixer set 'Capture' 22
$ arecord -f cd -d 10 test.wav  
$ aplay test.wav  
$ aplay test.wav  
</pre>
</pre>
= LVDS boot arguments =
== Resistive/Capacitive alternate screen ==
Variscite expand the default display settings to support alternate display without any requirement to change the device tree. During the boot sequence Variscite u-boot will add screen_alternate=yes option to enable selection of the second display settings (capacitive display).<br>
For example:
<pre>
U-Boot # printenv mmcargs
mmcargs=setenv bootargs console=${console},${baudrate} ${smp} video=mxcfb1:off root=${mmcroot}
screen_alternate=yes
</pre>
The developer can prevent the modification of u-boot by settings var_auto_fdt_file=N.
<pre>
U-Boot # setenv var_auto_fdt_file=N
</pre>
== Switching to LVDS1 as main display ==
Switching to LVDS1 display requires changing the "primary" of the lvds section flag in the device tree.
Setting display to be LVDS1 by default: edit arch/arm/boot/dts/imx6qdl-var-som.dtsi and set section of the lvds1. When you set the "primary" property to the LVDS1 struct, make sure you remove it from the LVDS0 struct
:lvds-channel@1 {<br>
::fsl,data-mapping = "spwg";<br>
::fsl,data-width = <18>;<br>
::crtc = "ipu1-di1";<br>
::primary;<br>
:status = "okay";<br>
::display-timings {<br>
:::native-mode = <&timing1>;<br>
:::timing1: hsd100pxn1 {<br>
::::clock-frequency = <35714000>;<br>
::::hactive = <800>;<br>
::::vactive = <480>;<br>
::::hback-porch = <28>;<br>
::::hfront-porch = <17>;<br>
::::vback-porch = <13>;<br>
::::vfront-porch = <20>;<br>
::::hsync-len = <20>;<br>
::::vsync-len = <13>;<br>
:::};<br>
::};<br>
:};<br>
Please take a look on the wiki section for kernel out of tree to see how to compile the device tree.


= Backlight  =
= Backlight  =
Line 166: Line 129:
Use minicom to connect.
Use minicom to connect.
Set the serial to ttymxc2
Set the serial to ttymxc2
You can use a loopback or connect to anther computer
You need to shortcut pin 1-3 and 5-7 on J9 connector.
 
= SATA  =
<pre>$ $ fdisk /dev/sda
When you get prompt "Command (m for help):" hit p
</pre>
Test output example:<br>
<pre>root@varsommx6q:~# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: ST9120823AS      Rev: 3.AD
  Type:  Direct-Access                    ANSI  SCSI revision: 05
root@varsommx6q:~# fdisk /dev/sda
 
The number of cylinders for this disk is set to 14593.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
  (e.g., DOS FDISK, OS/2 FDISK)
 
Command (m for help): p
 
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
  Device Boot      Start        End      Blocks  Id System
/dev/sda1  *          1        9123    73280466  7 HPFS/NTFS
/dev/sda2            9124      14593    43937744+  f Win95 Ext'd (LBA)
/dev/sda5            9124      11035    15358108+  7 HPFS/NTFS
/dev/sda6          14319      14593    2208906  82 Linux swap
/dev/sda7          11036      14318    26369024  83 Linux
</pre>


= eMMC (SOM version 2.x) =
= eMMC =
{{note| NOTE:<br>nand-recovery version 34 and 36 supports flashing of eMMC without the requirement of the process below.|info}}
{{note| NOTE:<br>nand-recovery version 01 support flashing of eMMC without the requirement of the process below.|info}}
* Check that the device is up.
* Check that the device is up.
<pre>
<pre>
Line 221: Line 151:
</pre>
</pre>
Example of a partition
Example of a partition
root@varsomimx6:~# fdisk /dev/mmcblk1
root@imx6ul-var-dart:~# fdisk /dev/mmcblk1
Device contains neither a valid DOS partition table, nor Sun, SGI, OSF or GPT disklabel
Device contains neither a valid DOS partition table, nor Sun, SGI, OSF or GPT disklabel
Building a new DOS disklabel. Changes will remain in memory only,
Building a new DOS disklabel. Changes will remain in memory only,
Line 264: Line 194:
</pre>
</pre>


= PCIE =
= USB OTG as host =
<pre>$ lspci
By default the OTG is configure to be "host".
</pre>
You can plug in a USB stick mouse or keyboard and check it.
The output should look like:<br>
00:00.0 PCI bridge: Device 16c3:abcd (rev 01)
01:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN [Kedron] Network Connection (rev 61)


= USB OTG as host  =
= USB OTG as device =


By default the OTG is configure to be "host". You can switch it to  "peripheral" if you change the dr_mode in the device tree.<br>
By default the OTG is configure to be "host". You can switch it to  "peripheral" if you change the dr_mode in the device tree.<br>
<pre>
<pre>
&usbotg {
/* dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg" */
vbus-supply = <&reg_usb_otg_vbus>;
&usbotg1 {
pinctrl-names = "default";
dr_mode = "peripheral";
pinctrl-0 = <&pinctrl_usbotg_var>;
disable-over-current;
disable-over-current;
/* dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg" */
dr_mode = "host" ;
status = "okay";
status = "okay";
};
};
</pre>
</pre>
* build Linux out of tree.
* build Linux out of tree.
* edit arch/arm/boot/dts/imx6qdl-var-som.dtsi
* edit arch/arm/boot/dts/imx6ul-var-dart.dts
* Change the dr_mode in usbotg section
* Change the dr_mode in usbotg section
* re build the device tree with
* re build the device tree with
<pre>$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx6q-var-som.dtb
<pre>$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- dtbs
</pre>  
</pre>  
copy the file to the sd-card or re flash it to nand. See the relevant section in the WIKI.
copy the DTB's to the sd-card or re flash it to nand. See the relevant section in the WIKI.
 
= USB OTG as device =


Plug a cable to a A linux host.<br>  
Plug a cable to a A linux host.<br>  
Line 312: Line 234:
= GPIO manipulation  =
= GPIO manipulation  =


Please look at the forum post: http://variscite.com/support-forum/viewtopic.php?f=5&t=29&p=51#p51
Please look at the forum post: https://variscite.com/support-forum/viewtopic.php?f=5&t=29&p=51#p51


= Can-bus  =
= Can-bus  =

Latest revision as of 11:56, 10 June 2020

Unit Testing

WLAN

Test

Scan for wireless networks:

$ ifconfig wlan0 up
$ iw dev wlan0 scan | grep SSID


Connecting to a WPA encrypted network:
Find your network from the above scan command.

$ mv /etc/wpa_supplicant.conf /etc/wpa_supplicant.conf.org
$ wpa_passphrase <YourAP> <YourPassword> >/etc/wpa_supplicant.conf
$ wpa_supplicant -B -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf

wait for:

wlcore: Association completed.

Disable eth0,eth1:

$ ifconfig eth0 down
$ ifconfig eth1 down

Run DHCP:

$ udhcpc -iwlan0
$ ifconfig


Useful link for common iw commands: https://wiki.archlinux.org/index.php/Wireless_network_configuration#Manual_setup

Access Point

This example will demonstrate you how to use the DART-6UL as an access point. It will forward packets from wlan0 to eth0. DHCPD:

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

This is a network example. You need to set the IP address based on your network.
First ensure that wpa_supplicant is not holding the device

$ killall wpa_supplicant

IP Forwarding:

$ echo 1 > /proc/sys/net/ipv4/ip_forward
$ ifconfig wlan0 192.168.5.1
$ hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
$ udhcpd /etc/udhcpd.conf
$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

As a next step one should take a look at /etc/hostapd.conf. You may want to configure password access point name etc.

Setup

This phase is not required by default.

  • Select your WL183x p/n:
$ cd /usr/bin/wlconf/
$ ./configure-device.sh wl18xx
select one out of : WL1831, WL1833, WL1835, WL1837.

As a result some additional information may be required like 1/2 antenna connected
<reboot system!>

First time need to set mac address to be used automatically (Not required in Yocto Dizzy)

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

Ethernet (2 ports)

On Target: You can plug in the Ethernet cable into port 0 or port 1.

$ ifconfig
$ iperf -s -u

On Host:

$ iperf -c 192.168.1.189 -u -b95M

Bluetooth

$ hcitool scan
$ l2ping 98:03:D8:C7:1A:96

Audio record/play

$ amixer set 'Output Mixer HiFi' on
$ amixer set Master 150
$ aplay /usr/share/sounds/alsa/Front_Center.wav 

$ amixer set 'Capture' 22
$ arecord -f cd -d 10 test.wav 
$ aplay test.wav 

Backlight

$ cd /sys/class/backlight/backlight.X (number changes)
$ echo 0 > brightness 
$ echo 7 > brightness

RTC

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

$ date --set="20150225 09:04"

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

$ hwclock --systohc --utc

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

External Uart

Use minicom to connect. Set the serial to ttymxc2 You need to shortcut pin 1-3 and 5-7 on J9 connector.

eMMC

NOTE:
nand-recovery version 01 support flashing of eMMC without the requirement of the process below.
  • Check that the device is up.
$ dmesg | grep mmcblk
  • Output example

mmcblk0: mmc1:0001 MBG4GC 29.1 GiB
mmcblk0boot0: mmc1:0001 MBG4GC partition 1 4.00 MiB
mmcblk0boot1: mmc1:0001 MBG4GC partition 2 4.00 MiB
mmcblk0rpmb: mmc1:0001 MBG4GC partition 3 4.00 MiB
mmcblk0: unknown partition table
mmcblk0boot1: unknown partition table
mmcblk0boot0: unknown partition table
Select the eMMC device number. Number will change if SD card is in.

  • Create partition
 $fdisk /dev/mmcblk1
enter n p 1 <enter> <enter> w

Example of a partition root@imx6ul-var-dart:~# fdisk /dev/mmcblk1 Device contains neither a valid DOS partition table, nor Sun, SGI, OSF or GPT disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that the previous content won't be recoverable.


The number of cylinders for this disk is set to 954240. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs

  (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n Command action

  e   extended
  p   primary partition (1-4)

p Partition number (1-4): 1 First cylinder (1-954240, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-954240, default 954240): Using default value 954240

Command (m for help): p

Disk /dev/mmcblk1: 31.2 GB, 31268536320 bytes 4 heads, 16 sectors/track, 954240 cylinders Units = cylinders of 64 * 512 = 32768 bytes

       Device Boot      Start         End      Blocks  Id System

/dev/mmcblk1p1 1 954240 30535672 83 Linux

Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table

mmcblk1: p1
  • Format and mount
$ mkfs.ext3 /dev/mmcblk1p1 
$ reboot

USB OTG as host

By default the OTG is configure to be "host". You can plug in a USB stick mouse or keyboard and check it.

USB OTG as device

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

	/* dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg" */
&usbotg1 {
	dr_mode = "peripheral";
	disable-over-current;
	status = "okay";
};
  • build Linux out of tree.
  • edit arch/arm/boot/dts/imx6ul-var-dart.dts
  • Change the dr_mode in usbotg section
  • re build the device tree with
$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- dtbs

copy the DTB's to the sd-card or re flash it to nand. See the relevant section in the WIKI.

Plug a cable to a A linux host.

Folow 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:

use dmesg and find out your device for example /dev/sdb
$ sudo dd if=/dev/zero of=/dev/sdb bs=128k count=1000

USB Host

Plug a DiskOnKey, Mouse or Keyboard to any of the 3 USB host ports on EVK

GPIO manipulation

Please look at the forum post: https://variscite.com/support-forum/viewtopic.php?f=5&t=29&p=51#p51

Can-bus

Starting Release 4 of the Yocto Canbus is integrated into the system. No patch required.

  1. Connect 2 boards. Each board JP26 connect to the other with the right cable.

Set up the 2 boards by running on each of them:

$ ip link set can0 up type can bitrate 125000

On board #1:

$ cansniffer can0

On board #2:

$ cansend can0 500#1E.10.10

SPI

Testing SPI from user space require some changes.

  • Configure your kernel and add spidev driver. Device Drivers -> SPI support -> <*> User mode SPI device driver support
  • Add spidev to your device tree
&ecspi1 {
	fsl,spi-num-chipselects = <1>;
	cs-gpios = <&gpio4 9 0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_ecspi1_2>;
	status = "okay";

        chip1: spidev@0 {
               compatible = "spidev";
               spi-max-frequency = <12000000>;
               reg = <0>;
        };
/*
        chip2: spidev@1 {
               compatible = "spidev";
               spi-max-frequency = <20000000>;
               reg = <1>;
	};
*/
};

Pick and choose the right chip select and you can also have multiple chip selects.