Difference between revisions of "What can I do with IGEP SMARC iMX6"

From IGEP - ISEE Wiki

Jump to: navigation, search
Line 81: Line 81:
 
== CAN BUS  ==
 
== CAN BUS  ==
  
'''under construction'''
+
To be able to communicate the board via CAN bus, we will use can0 interface and the J1002 connector. We can communicate with another IGEP0046 or an IGEP0030 (via J9001 in IGEP BERLIN), but also with a wide variety of CAN sensors and devices. In this example, we use two IGEP boards.
 +
 
 +
* We must, first of all, set the interface up in each device. We can do it with ip commands:
 +
<pre>ip link set can0 up type can bitrate 125000</pre>
 +
''Where '''can0''' is the interface we will use''
 +
* Then we must choose who will send data and who will receive it; for the one to receive we will use the following line:
 +
<pre>candump can0</pre>
 +
''Where '''can0''' is the interface we will use''
 +
* For the one to send CAN data, we will use the following command:
 +
<pre>cansend can0 -i 0x123 0xaa 0xbb 0xcc 0xdd</pre>
 +
''Where '''can0''' is the interface we will use, '''-i 0x123''' is used to identify the device as 0x123, and '''0xaa 0xbb 0xcc 0xdd''', the data to be sent.''
 +
 +
* We should get this in the CAN receiver:
 +
<pre><0x123> [4] aa bb cc dd</pre>
 +
 
 +
* To stop receiving data, press '''Ctrl+C''' in the listening device.
  
 
== Audio ==
 
== Audio ==
Line 94: Line 109:
 
<pre>ums 0 mmc 1</pre>
 
<pre>ums 0 mmc 1</pre>
  
''Where 0 is the USB device number 0 (USB OTG, in this case), mmc is the kind of storage device to be read (mmc or sata), and 1 is the storage device number, in this case mmc1 (onboard eMMC).''
+
''Where '''0''' is the USB device number 0 (USB OTG, in this case), '''mmc''' is the kind of storage device to be read (mmc or sata), and '''1''' is the storage device number, in this case mmc1 (onboard eMMC).''
  
 
* If correctly done, U-boot should print something similar to the next line, and a mass storage device should appear in your computer.
 
* If correctly done, U-boot should print something similar to the next line, and a mass storage device should appear in your computer.
Line 101: Line 116:
  
 
* You can now backup its contents, as well as format it, make partitions, or [http://labs.isee.biz/index.php/How_to_create_a_SD-card_with_the_latest_software_image use igep-media-create to flash it with an image]; all straight from the computer.
 
* You can now backup its contents, as well as format it, make partitions, or [http://labs.isee.biz/index.php/How_to_create_a_SD-card_with_the_latest_software_image use igep-media-create to flash it with an image]; all straight from the computer.
 +
 +
* To stop UMS, press '''Ctrl+C''' and the mass storage device in your computer should disappear.
  
 
== Boot from SATA ==
 
== Boot from SATA ==

Revision as of 10:30, 30 May 2016


Overview

This is the 2/3 chapter of the Getting Started with IGEP SMARC iMX6 Tutorial Guide.

In this second chapter, we will learn some basics tasks. Upon completion, you will be ready to continue with chapter 3/3 that explains more advanced tasks.



What can I do

You must logged in the board.

Handle the GPIO-LEDS

The board has two user bicolor (green/red) leds available that can be controlled. In its simplest form, you can control of LEDs from userspace. LEDs appear in /sys/class/leds/igep and you can turn on and off with following commands:

echo 1 > /sys/class/leds/igep\:red\:led1/brightness
echo 1 > /sys/class/leds/igep\:red\:led0/brightness
echo 0 > /sys/class/leds/igep\:red\:led1/brightness
echo 0 > /sys/class/leds/igep\:red\:led0/brightness
echo 1 > /sys/class/leds/igep\:green\:led1/brightness
echo 1 > /sys/class/leds/igep\:green\:led0/brightness
echo 0 > /sys/class/leds/igep\:green\:led1/brightness
echo 0 > /sys/class/leds/igep\:green\:led0/brightness

If you want to trigger the leds you can enable this mode and select the trigger source (none by default) to: mmc0, mmc1, timer, heartbeat and default-on.

To enable any of this modes you just have to change a parameter in the directory of the led you want to control. You can see all the possibilities using the instruction 'cat':

cat /sys/class/leds/igep\:red\:led0/trigger

[none] mmc0 mmc1 timer heartbeat default-on

In the example above, we have checked the status of the trigger in led red\led0. Mode 'none' is selected.

To change it, for example, to the timer mode you can use 'echo':

echo timer > /sys/class/leds/igep\:red\:led0/trigger

In this case, we have set the trigger to the 'timer' mode. Now you can set the time for what the led is ON and the time it is OFF using:

echo 250 > /sys/class/leds/igep\:red\:led0/delay_on
echo 750 > /sys/class/leds/igep\:red\:led0/delay_off

Now the selected led is configured with a timer consisting of 250 miliseconds ON and 750 miliseconds OFF.

The base has two user (red/blue) leds available that can be controlled. Can't use them in the same time. In its simplest form, you can control of LEDs from userspace. LEDs appear in /sys/class/leds/base and you can turn on and off with following commands:

echo 1 > /sys/class/leds/base\:blue\:led0/brightness
echo 1 > /sys/class/leds/base\:red\:led0/brightness
echo 0 > /sys/class/leds/base\:blue\:led0/brightness
echo 0 > /sys/class/leds/base\:red\:led0/brightness

How to use UART (RS485)

under construction

CAN BUS

To be able to communicate the board via CAN bus, we will use can0 interface and the J1002 connector. We can communicate with another IGEP0046 or an IGEP0030 (via J9001 in IGEP BERLIN), but also with a wide variety of CAN sensors and devices. In this example, we use two IGEP boards.

  • We must, first of all, set the interface up in each device. We can do it with ip commands:
ip link set can0 up type can bitrate 125000

Where can0 is the interface we will use

  • Then we must choose who will send data and who will receive it; for the one to receive we will use the following line:
candump can0

Where can0 is the interface we will use

  • For the one to send CAN data, we will use the following command:
cansend can0 -i 0x123 0xaa 0xbb 0xcc 0xdd

Where can0 is the interface we will use, -i 0x123 is used to identify the device as 0x123, and 0xaa 0xbb 0xcc 0xdd, the data to be sent.

  • We should get this in the CAN receiver:
<0x123> [4] aa bb cc dd
  • To stop receiving data, press Ctrl+C in the listening device.

Audio

under construction

Install firmware in eMMC

In order to access the eMMC and be capable of flashing it, we can make use of the UMS (U-boot Mass Storage gadget).

  • Plug a microUSB to USB cable from J602 USB OTG connector to your computer. Boot the board from the microSD card and abort autoboot pressing a key when U-boot is waiting before loading the kernel. Then, start UMS with the following command:
ums 0 mmc 1

Where 0 is the USB device number 0 (USB OTG, in this case), mmc is the kind of storage device to be read (mmc or sata), and 1 is the storage device number, in this case mmc1 (onboard eMMC).

  • If correctly done, U-boot should print something similar to the next line, and a mass storage device should appear in your computer.
UMS: disk start sector: 0x0, count: 0xe90000
  • To stop UMS, press Ctrl+C and the mass storage device in your computer should disappear.

Boot from SATA

As specified in SMARC the booting device can be chosen by a combination of jumpers. To boot from carrier SATA, a SATA disk must be present in J1103 mSATA connector, and no jumpers should be connected in J1202, leaving BOOT0, BOOT1 and BOOT2 pulled down to GND. For more information, refer to SMARC Hardware Specification Guide.

Boot from eMMC

As specified in SMARC the booting device can be chosen by a combination of jumpers. To boot from module eMMC Flash, jumpers should be connected to BOOT1 and BOOT2 in J1202, leaving BOOT0 pulled down to GND. For more information, refer to SMARC Hardware Specification Guide.

How to use EEPROM

EEPROM can be read and write via /sys/devices/soc0/soc.0/2100000.aips-bus/21a8000.i2c/i2c-2/2-0050/eeprom:

  • Write EEPROM:
echo "data" > /sys/devices/soc0/soc.0/2100000.aips-bus/21a8000.i2c/i2c-2/2-0050/eeprom 
  • Read EEPROM:
cat /sys/devices/soc0/soc.0/2100000.aips-bus/21a8000.i2c/i2c-2/2-0050/eeprom
  • Following output is expected on console:
data
d
drate=115200boot_fdt=trybootcmd=echo Try first mmc (SD)...; mmc dev ${mmcdev};if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; fi; fi; fi; echo Try a
d
drate=115200boot_fdt=trybootcmd=echo Try first mmc (SD)...; mmc dev ${mmcdev};if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; fi; fi; fi; echo Try a
d
drate=115200boot_fdt=trybootcmd=echo Try first mmc (SD)...; mmc dev ${mmcdev};if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; fi; fi; fi; echo Try a
d

When ever you think you want to stop recording just press CTRL+C

How to use SPI NOR

Can be read and write files into SPI NOR:

  • Create a directory:
mkdir Documents 
  • Create a file in the directory:
cd Documents/
touch prova
  • Write something in the file:
echo "data" > prova
  • Write the file into SPI NOR:
mtd_debug write /dev/mtd0 0 1 ./Documents/prova
  • Read the file:
mtd_debug read /dev/mtd0 0 1 prova


IO expansion

under construction

Wifi

In this example, we will connect to an Access Point.

  • First of all, we must disable Soft Blocking on the wlan0 interface via rfkill:
rfkill unblock 0
  • Then we can set the interface up:
ifconfig wlan0 up
  • We can scan for Access Points if we don't know its exact SSID:
iw wlan0 scan
  • Then we proceed to connect to our Access Point:
  • In case our Access Point is WPA secured, we can use wpa_supplicant to connect. For this purpose, we should configure /etc/wpa_supplicant.conf file:
network={
        ssid="IGEP_example"
        proto=WPA2
        key_mgmt=WPA-PSK
        psk="password"
}
To start the supplicant, we specify the interface, the configuration file and the driver to be used. In this case:
wpa_supplicant -Dnl80211 -i wlan0 -c wpa_supplicant.conf
  • On the other hand, if it is a WEP secured Access Point, you must enter the next command. If your AP doesn't have a password, omit the key part:
iw wlan0 connect IGEP_example key 0:12345
  • After a few seconds, the link should be established. We can now check the connection pinging a known server, for example:
ping www.google.com

HDMI resolution

under construction

modem USB

under construction



You have successfully completed this chapter of the guide.


Continue this tutorial guide: 3/3 - Start developing under IGEP Technology
Igep forum.png If you have any question, don't ask to ask at the IGEP Community Forum or the IGEP Community Chat Irc.png