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> interface on 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==
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:
[1] This type of cables forces the ID signal of the USB port to be connected to ground, selecting the host mode on SBC Lynx side.
===Device mode===
The following examples shows how to configure Bora/BoraEVB or BoraX and /BoraXEVB to act as a mass storage device.
First, a local file named <code>mass</code> is created to emulate a mass storage disk that is populated with a file named <code>file.txt</code>:
[ 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. {| class="wikitable"|-! Physical device !! Processor's resource !! Connector !! Type !! Notes|-| CAN BUS || can0 || J24 || differential CAN bus |||-|} The following commands can be issued from command line in order to send and receive CAN frames:<pre>root@bora:~# dmesg | grep -i can[ 0.643798] CAN device driver interface[ 0.997787] can: controller area network core (rev 20120528 abi 9)[ 1.008392] can: raw protocol (rev 20120528)[ 1.012661] can: broadcast manager protocol (rev 20120528 t)[ 1.018294] can: netlink gateway (rev 20130117) max_hops=1root@bora:~# canconfig can0 stopcan0 state: STOPPEDroot@bora:~# canconfig can0 bitrate 500000can0 bitrate: 500000, sample-point: 0.875root@bora:~# canconfig can0 startcan0 state: ERROR-ACTIVEroot@bora:~# cansend can0 -i 0x77 0x33 0x88 0x33 0x88 0x33 0x88 0x33interface = can0, family = 29, type = 3, proto = 1root@bora:~# cansend can0 -i 0x77 0x33 0x88 0x33 0x88 0x33 0x88 0x33interface = can0, family = 29, type = 3, proto = 1root@bora:~# cansend can0 -i 0x77 0x33 0x88 0x33 0x88 0x33 0x88 0x33interface = can0, family = 29, type = 3, proto = 1root@bora:~# candump can0interface = 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^Croot@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: <pre>root@bora:~# smart updateUpdating cache... ######################################## [100%] Fetching information for 'all'...-> https://yocto.dave.eu/belk-3.0.1/all/repodata/repomd.xmlrepomd.xml ######################################## [ 50%][snip]Channels have 393 new packages.Saving cache... root@bora:~# smart install canutilsLoading cache...Updating cache... ######################################## [100%] Computing transaction... Installing packages (2): canutils-4.0.6-r0@armv7a_vfp_neon libsocketcan2-0.0.9-r0@armv7a_vfp_neon 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|-| UART0 || UART0 || JP17 || 2-wire LVTTL UART || <code>/dev/ttyPS1</code> |||-|}<section end=UART0/> <section begin=Temperature sensors/> == Temperature sensors ==Bora SOM has a [http://www.ti.com/lit/ds/symlink/tmp422.pdf TMP421AIDCN] temperature sensor onboard. The following commands can be issued from command line in order to get the SOM temperatue:* read the PCB temperature<pre>root@bora:~# cat /sys/devices/soc0/amba/e0004000.i2c/i2c-0/0-004f/hwmon/hwmon1/temp1_input</pre>the returned value has to be divided by 1000 for a °C temperature* read the CPU temperature<pre>root@bora:~# cat /sys/devices/soc0/amba/e0004000.i2c/i2c-0/0-004f/hwmon/hwmon1/temp2_input</pre>the returned value has to be divided by 1000 for a °C temperature Moreover, the SOC has an internal temperature sensor device which can be read using the following shell script:<pre>root@bora:~# cat temp.sh#!/bin/sh # TcpuTEMP_RAW=`cat /sys/devices/soc0/amba/f8007100.adc/iio:device0/in_temp0_raw`TEMP_OFFSET=`cat /sys/devices/soc0/amba/f8007100.adc/iio:device0/in_temp0_offset`TEMP_SCALE=`cat /sys/devices/soc0/amba/f8007100.adc/iio:device0/in_temp0_scale`TEMP=`awk "BEGIN {print (($TEMP_RAW+$TEMP_OFFSET)*$TEMP_SCALE)/1000}"` echo "Cpu Temp: ${TEMP}"</pre><section end=Temperature sensors/> <section begin=Power meter/> == Power consumption == 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: <pre>root@bora:~# cat read_power_values.sh#!/bin/sh path_dev=/sys/class/hwmon/hwmon0 IN1=`cat $path_dev/in1_input`IN0=`cat $path_dev/in0_input`VOLTAGE=`awk "BEGIN {print ($IN1-$IN0)/1000}"`CURRENT=`cat $path_dev/curr1_input`CURRENT=`awk "BEGIN {print ($CURRENT)/1000}"`POWER=`cat $path_dev/power1_input`POWER=`awk "BEGIN {print ($POWER)/1000000}"`echo "Voltage: ${VOLTAGE}, Current: ${CURRENT}, Power:${POWER}"</pre> <pre>root@bora:~# ./read_power_values.shVoltage: 3.308, Current: 0.64, Power:2.175root@bora:~#</pre> <section end=Power meter/>