This article details how physical devices are handled by the Linux kernel in the context of the [[Bora_Embedded_Linux_Kit_(BELK)|BELK]] and [[BoraX_Embedded_Linux_Kit_(BXELK)|BXELK kit]]kits. == History =={| class="wikitable" border="1"!Version!Date!BELK/BXELK version!Notes|-|{{oldid|8547|1.0.0}}|Apr 2019|[[BELK/BXELK_software_components#BELK_3.0.2_.2F_BXELK_1.0.1|3.0.0]]|BELK 3.0.0|-|2.0.0|Jan 2020|[[BELK/BXELK_software_components#BELK_4.1.0|4.1.0]]|Updated for BELK/BXELK 4.1.0|-|} <section begin=Console/>
Ethernet port is associated to <code>eth0</code> interfaceon the J8 connector. It can be managed with standard Linux commands. See for example http://www.tecmint.com/ifconfig-command-examples/. === LED ===The two LEDs, connected to the ethernet PHY are configured as ''Tri-color dual-LED mode'' (see more info in the [https://ww1.microchip.com/downloads/en/DeviceDoc/00002117F.pdf#page=24 KSZ9031 datasheet]): link/activity for 100mbit/s and link/activity/ for 1000mbit/s. <section end=Ethernet/> <section begin=micro SD/>
==microSD card==
microSD cardon connector J21, if present, will be associated by the Linux kernel to the <code>mmcblk0</code> device:
<pre>
[ 24.100643] mmc0: new high speed SDHC card at address 1234
root@bora:~#
</pre>
<section end=micro SD/>
<section begin=NOR_NAND/>
==NOR and NAND flash==
TBD ({{ImportantMessage|text=NOR and NAND flash memories cannot be used accessed at the same time because they shares some Zynq pins. In U-boot the switching between accesses to NOR and NAND is automatically done by U-boot itself. By default in kernel only NAND flash can be accessed. For NOR support in Linux)kernel please contact [mailto:support-bora@dave.eu technical support].}}
NOR and NAND flashes are managed as [[Memory_Tecnology_Device_(MTD)|MTD devices]].
Generally speaking, NAND flash memory is partitons partitions are defined in using the devitetreekernel command line:
defines these adding <code>addmisc</code> to the <code>bootargs</code> parameters list. The kernel ''dmesg'' will configure the NAND partitionsin the following way: <pre>[ 1.148350] Creating 8 MTD partitions on "pl35x-nand":[ 1.153486] 0x000000000000-0x000000040000 : "spl"[ 1.170502] 0x000000040000-0x000000100000 : "uboot"[ 1.186404] 0x000000100000-0x000000140000 : "env1"[ 1.202301] 0x000000140000-0x000000180000 : "env2"[ 1.218170] 0x000000180000-0x000000780000 : "fpga"[ 1.229456] 0x000000780000-0x000000800000 : "fdt"[ 1.237981] 0x000000800000-0x000001000000 : "kernel"[ 1.244063] 0x000001000000-0x000040000000 : "nand-ubi"</pre>
<pre>
root@bora:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00080000 00040000 00020000 "nand-SPLspl"mtd1: 00080000 000c0000 00020000 "nand-uboot"mtd2: 00040000 00020000 "nand-uboot-env1"mtd3: 00040000 00020000 "nand-uboot-env2"mtd4: 00440000 00600000 00020000 "nand-bitstreamfpga"mtd5: 00040000 00080000 00020000 "nand-device-treefdt"mtd6: 00400000 00800000 00020000 "nand-linuxkernel"mtd7: 1f600000 3f000000 00020000 "nand-rootfsubi"</pre><section end=NOR_NAND/> <section begin=USB OTG/>==USB OTG=====Host mode=== For the USB Host mode an USB stick or another device must be pluged in at the system boot. See the issue related to USB not hotplug capable after the system boot. This example shows how a memory stick is detected by the Linux kernel.<pre>root@bora:~# [ 37.340873] usb 1-1: new high-speed USB device number 2 using zynq-ehci[ 37.508377] usb 1-1: device v05e3 p0736 is not supported[ 37.514823] usb-storage 1-1:1.0: USB Mass Storage device detected[ 37.521869] scsi host0: usb-storage 1-1:1.0[ 38.522235] scsi 0:0:0:0: Direct-Access Generic STORAGE DEVICE 0272 PQ: 0 ANSI: 0[ 38.531274] sd 0:0:0:0: Attached scsi generic sg0 type 0[ 38.663662] sd 0:0:0:0: [sda] 30679040 512-byte logical blocks: (15.7 GB/14.6 GiB)[ 38.673145] sd 0:0:0:0: [sda] Write Protect is off[ 38.677862] sd 0:0:0:0: [sda] Mode Sense: 0b 00 00 08[ 38.684026] sd 0:0:0:0: [sda] No Caching mode page found[ 38.689257] sd 0:0:0:0: [sda] Assuming drive cache: write through[ 38.703539] sda: sda1 sda2[ 38.715870] sd 0:0:0:0: [sda] Attached SCSI removable disk
</pre>
To connect it to micro AB connector (J19), a cable like the one shown in the following picture has been used [1].
[[File:Usb-cable-micro-host.jpg|thumb|center|USB cable used to connect memory stick]]
Once mounted (at <code>mnt/sda1</code> in the example), the memory stick can be accessed by regular commands:
<pre>
root@bora:~# mount /dev/sda1 /mnt/sda1/
root@bora:~# mount
192.168.0.13:/opt/nfsroot/users/mgeromin/bora/belk on / type nfs (rw,relatime,vers=2,rsize=4096,wsize=4096,namlen=255,hard,nolock,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.0.13,mountvers=1,mountproto=tcp,local_lock=all,addr=192.168.0.13)
devtmpfs on /dev type devtmpfs (rw,relatime,size=507916k,nr_inodes=126979,mode=755)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /var/volatile type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)
/dev/sda1 on /mnt/sda1 type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
root@bora:~# time cp LibreOffice_4.1.1_Win_x86.msi /mnt/sda1/
[ 209.099572] zynq-udc: bind to driver g_mass_storage
</pre>
Last, BoraEVB (or BoraXEVB) is connected to a Linux PC with a USB cable like this one:
[[File:USB-cable-micro-host-a.png|thumb|center|400px|USB cable used to connect BoraXEVB to PC]]
On PC side, BoraEVB (or BoraXEVB) is detected as a common USB mass storage device.
<section end=USB OTG/>
<section begin=CAN/>
==CAN==
See [[BORA_Xpress_SOM/BORA_Xpress_Evaluation_Kit/Interfaces_and_Connectors/CAN | CAN Pinout]] page and [[BORA_SOM/BELK-L/Development/Creating_and_building_a_Vivado_example | BXELK Vivado project]] for more details.
interface = can0, family = 29, type = 3, proto = 1
root@bora:~# candump can0
interface = can0, family = 29, type = 3, proto = 1
<0x100> [8] 12 34 56 78 9a bc de ff
<0x100> [8] 12 34 56 78 9a bc de ff
<0x100> [8] 12 34 56 78 9a bc de ff
<0x100> [8] 12 34 56 78 9a bc de ff
<0x100> [8] 12 34 56 78 9a bc de ff
^C
root@bora:~#
</pre>
----
In case <code>canutils</code> package is missing, user can install it directly from DAVE's [http://yocto.dave.eu/belk-latest/ BORA package server] using <code>smart update && smart install canutils</code> commands:
27.8kB of package files are needed. 46.8kB will be used.
Confirm changes? (Y/n): y
[..snip..]
</pre>
See [[BORA_SOM/BELK-L/Development/Advanced_use_of_Yocto_build_system | Advanced use of Yocto build system]] for more information about using Yocto packages and <code>smart</code>
<section end=CAN/>
<section begin=UART0/>
==UART0==
UART0 is a spare UART device available on the JP17 PMOD connector. This device is routed through the PL.
See [[BORA_SOM/BELK-L/Development/Creating_and_building_a_Vivado_example | BXELK Vivado project]] for more details.
{| class="wikitable"
|-
! Physical device !! Processor's resource !! Connector !! Type !! Linux device file !! Notes
Power consumption measure can be performed accessing the [https://www.ti.com/lit/ds/symlink/ina226.pdf INA226] device connected to the I2C bus in the BoraEVB (U3). The following commands can be saved as a shell script (e.g. read_power_values) and run to collect the measurements data: