SEMA Utility on COM Express Type 10 Elkhart Lake This document provides detailed instructions on how to use SEMA on COM Express Type 10 Elkhart Lake. Prerequisites [For Windows only] Download the latest Microsoft Visual C++ redistributable (X64) from here. [For Windows/Linux] Download the latest SEMA source code file from here. Once set, click one of the below to follow the instructions corresponding to your OS: Windows Host Users Linux Host Users Windows Host Install Microsoft Visual C++ redistributable on your targeted device. Go to the directory to which SEMA is downloaded (SEMA-4.0_Windows/Installer/) and execute “ADLINK_SEMA_Package_installer” file on your targeted device to install the SEMA source file. Open PowerShell and type the following command: Semautil You should see the output as exemplified below. To see the details of the commands listed, simply execute the following commands as needed. PS C:\Users\adlink> SemautilUsage:- Display this screen: semautil /h- Watch Dog: semautil /w for information on watchdog and related function- Storage: semautil /s for information on storage and related function- Smart FAN control: semautil /f for information on fan control and related function- System monitor-Board Info: semautil /i for information on monitor-board info and related function- Voltage monitor: semautil /v for information on voltage monitor and related function- Error log: semautil /e for information on error log and related function- GPIO: semautil /g for information on GPIO and related function- Exception Description: semautil /x for information on exception description and related function- Board values: semautil /d for information on board values and related function- LVDS Backlight control: semautil /b for information on LVDS backlight control and related function- Generic I2C Read/Write: semautil /i2c for information on generic I2C read/write and related function- BIOS source: semautil /src for information on BIOS source and related function To see the monitor-board info, execute the commands listed below. PS C:\Users\adlink> semautil /i- System monitor-Board Info: 1. semautil /i get_bd_info [EApi ID] 2. semautil /i set_bd_info [EApi ID] [new info] 1 : Board manufacturer name 2 : Board name 3 : Board serial number 4 : Board BIOS revision 5 : HW revision 6 : Board platform type 7 : BMC Bootloader revision 8 : BMC application revision 9 : Board restart event 10 : Board repair date 11 : Board manufacturer date 12 : Board MAC address 13 : Board 2nd HW revision number 14 : Board 2nd serialPS C:\Users\adlink> semautil /i get_bd_info 1ADLINK Technology Inc.PS C:\Users\adlink> semautil /i get_bd_info 2LEC-EL e.g. If you enter voltage monitor and execute the following commands in sequence, you shall get a similar output on your targeted device. PS C:\Users\adlink> semautil /v- Voltage monitor: 1. semautil /v get_voltage [Channel (0 - 15)]PS C:\Users\adlink> semautil /v get_voltage 2Voltage : 4854 mvDescription : VIN You can enter different sections to access and execute its related functions as needed. Linux Host 1. Getting Started Install git utility to download and compile the ADLINK SEMA module for Linux by executing the following command. sudo apt install git Install Hexer for editing the binary files. sudo apt install hexer Install i2c-tools. sudo apt install i2c-tools Install make (if needed). sudo apt install make Install gcc (if needed). sudo apt install gcc 2. Compiling SEMA Linux Package Download the SEMA source code. Open the terminal and go into the downloaded directory. Compile them. Once the compilation succeeds, the following kernel modules and executables are generated. File Description driver/adl-bmc.ko SEMA Linux BMC Driver Core Module driver/adl-bmc-boardinfo.ko SEMA Linux BMC Board Information Driver Module driver/adl-bmc-vm.ko SEMA Linux BMC Voltage Monitor Driver Module driver/adl-bmc-hwmon.ko SEMA Linux BMC Smart Fan and Hardware Monitor Driver Module driver/adl-bmc-wdt.ko SEMA Linux BMC Watchdog Driver Module driver/adl-bmc-nvmem.ko SEMA Linux BMC NVMEM Driver Module driver/adl-bmc-bklight.ko SEMA Linux BMC Backlight Driver Module wdogtest SEMA Linux Watchdog Test application adltest SEMA Linux Command Line Utility 3. Installing SEMA Linux Kernel Drivers Execute the commands listed below to install SEMA-related device drivers. cd SEMA_4.0_Linux_SandBox sudo make install sudo modprobe i2c_i801 sudo modprobe adl-bmc sudo modprobe adl-bmc-i2c sudo modprobe adl-bmc-boardinfo sudo modprobe adl-bmc-vm sudo modprobe adl-bmc-wdt sudo modprobe adl-bmc-hwmon sudo modprobe adl-bmc-nvmem sudo modprobe adl-bmc-bklight Install the native GPIO driver by executing the following commands in sequence: Load the native GPIO driver: sudo modprobe gpio-pca953x Once loaded, configure the GPIO device: echo pca9535 0x20 > /sys/bus/i2c/devices/i2c-12/new_device Note: Here, i2c-12 is used due to SMBus being located at bus 12. 0x20 is the GPIO device slave address. 4. Using the SEMA Linux Module 4.1 Board Information To get the board manufacturer name: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/manufacturer_name To get the board name: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/board_name To get the board serial number: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/serial_number To get the board BIOS version: cat /sys/class/dmi/id/bios_version To get the board hardware version: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/hw_rev To get the board bootloader version: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/bmc_boot_version To get BMC application version: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/bmc_application_version To get BMC capabilities: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/capabilities To get BMC extended capabilities: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/capabilities_ext To get BMC flags: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/bmc_flags To get BMC status: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/bmc_status To get the board main power current: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/main_current To get the board VCORE voltage value: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/voltage_vcore To get the board 2V5 voltage value: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/voltage_2v5 To get the board 3V3 voltage value: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/voltage_3v3 To get the board VBAT voltage value: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/voltage_vbat To get the board 5V voltage value: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/voltage_5v To get the board 5VSB voltage value: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/voltage_5vsb To get the board 12V voltage value: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/voltage_12v To get the board GFX-VCORE voltage value: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/voltage_gfx_vcore To get the board 1V05 voltage value: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/voltage_1v05 To get the board 1V5 voltage value: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/voltage_1v5 To get the board VIN voltage value: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/voltage_vin To get current position error log: cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/cur_pos_error_log To set the position (of read pointer) and get immediate error log: echo 1 > /sys/bus/platform/devices/adl-bmc-boardinfo/information/error_log cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/error_log To set error number and get error number description immediately: echo 88 > /sys/bus/platform/devices/adl-bmc-boardinfo/information/err_num_des cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/err_num_des To set exception code and get exception description: echo 0 > /sys/bus/platform/devices/adl-bmc-boardinfo/information/exc_des cat /sys/bus/platform/devices/adl-bmc-boardinfo/information/exc_des 4.2 Voltage Monitor The number of regulator devices and their names may change due to platform (LEC-AL, cExpress-EL, etc) and the number of times the monitor driver is loaded and unloaded. To confirm the device names that is created by our driver, check the /sys/bus/platform/devices/adl-bmc-vm/regulator/ path. e.g. ls /sys/bus/platform/devices/adl-bmc-vm/regulator/ Output (LEC-AL): regulator.1 regulator.2 regulator.3 regulator.4 regulator.5 regulator.6 regulator.7 regulator.8 For voltage id 1, need to replace with regulator.1 To get the hardware monitor input voltage and get the respective voltage description: cat /sys/class/regulator/<regulator index>/microvolts cat /sys/class/regulator/<regulator index>/name e.g. When the user is reading the voltage and description of id 1 cat /sys/class/regulator/regulator.1/microvolts cat /sys/class/regulator/regulator.1/name 4.3 Watchdog To start the watchdog: echo 1 > /dev/watchdog0 To stop the watchdog: echo “V” > /dev/watchdog0 To trigger / ping the watchdog: wdogtest –ping To update the watchdog timeout value. To set the watchdog timeout out value, use the following format: wdogtest –timeout=<time in seconds> The example below sets the watchdog timeout value as 20 seconds wdogtest –timeout=20 To get the information about the watchdog state: cat /sys/class/watchdog/watchdog0/state To get the configured watchdog timeout value: cat /sys/class/watchdog/watchdog0/timeout To get the current watchdog timeout value: cat /sys/class/watchdog/watchdog0/timeleft To get minimum/maximum watchdog timeout value: /sys/bus/platform/devices/adl-bmc-wdt/Capabilities/wdt_min_timeout /sys/bus/platform/devices/adl-bmc-wdt/Capabilities/wdt_max_timeout To start / update the power up watchdog timer value To update timeout out value, use the following format: echo <timeout> > /sys/bus/platform/devices/adl-bmc-wdt/Capabilities/PwrUpWDog The example below sets the power up watchdog timer timeout value as 1000 seconds echo 1000 > /sys/bus/platform/devices/adl-bmc-wdt/Capabilities/PwrUpWDog To get the power up watchdog timer value: cat /sys/bus/platform/devices/adl-bmc-wdt/Capabilities/PwrUpWDog To stop the power up watchdog timer: echo 0 > /sys/bus/platform/devices/adl-bmc-wdt/Capabilities/PwrUpWDog 4.4 GPIO To export the GPIO pin: echo N > /sys/class/gpio/export (N should replace with gpio chip base number) e.g. when 251 is the GPIO chip base number in Nano-EL: echo 251 > /sys/class/gpio/export To read the direction of a pin: cat /sys/class/gpio/gpio251/direction To write the direction of a pin: echo in > /sys/class/gpio/gpio251/direction To read the value of a pin: cat /sys/class/gpio/gpio251/value To write the value of a pin: echo 1 > /sys/class/gpio/gpio251/value 4.5 Hardware Monitor and Fan The device name may be different due to the platform used (LEC-EL, cExpress-EL, etc.). To confirm the device name that is created by our driver, check the /sys/bus/platform/devices/adl-bmc-hwmon/hwmon/ path. e.g. ls /sys/bus/platform/devices/adl-bmc-hwmon/hwmon/ Output: hwmon2 In the above example, our device is hwmon2, so should replace hwmonX with hwmon2 in the following commands. To set temperature set points (1-4): echo > /sys/class/hwmon/hwmonX/device/fan_auto_point_temp In the example below, the user is setting temperature of set point 1 and Fan ID as 1 (SEMA_EAPI_ID_FAN_CPU) with temperature as 10 echo 10 > /sys/class/hwmon/hwmon2/device/fan1_auto_point1_temp To get temperature set points (1-4): cat /sys/class/hwmon/hwmonX/device/fan_auto_point_temp In the example below, the user is getting temperature of set point 1 and fan ID 1 (SEMA_EAPI_ID_FAN_CPU) cat /sys/class/hwmon/hwmon2/device/fan1_auto_point1_temp To set PWM set points (1-4): echo > /sys/class/hwmon/hwmonX/device/fan_auto_point_pwm In the example below, user is setting PWM value of set point 1 and fan ID 1 (SEMA_EAPI_ID_FAN_CPU) with PWM level as 10 echo 10 > /sys/class/hwmon/hwmon2/device/fan1_auto_point1_pwm To get PWM set points (1-4): cat /sys/class/hwmon/hwmonX/device/fan_auto_point_pwm In the example below, user is getting PWM value of set point 2 and fan ID as 2 (SEMA_EAPI_ID_FAN_SYSTEM_1 ). cat /sys/class/hwmon/hwmon2/device/fan2_auto_point2_pwm To set the fan to one of the following modes: SEMA_FAN_AUTO (0) SEMA_FAN_OFF (1) SEMA_FAN_ON (2) SEMA_FAN_AUTO_SOFT_FAN (3) To set fan m: echo > /sys/class/hwmon/hwmonX/device/fan1_enable In the example below, user is setting fan mode as 1 echo 1 > /sys/class/hwmon/hwmon2/device/fan1_enable To get fan mode: cat /sys/class/hwmon/hwmon2/device/fan1_enable Temperature sources are: 0 = CPU Temperature 1 = Board Temperature To set the temperature source: echo /sys/class/hwmon/hwmonX/device/fan1_auto_channels_temp In the example below, user is setting temperature source as 1 (Board temperature) echo 1 > /sys/class/hwmon/hwmon2/device/fan1_auto_channels_temp To get the temperature source: cat /sys/class/hwmon/hwmon2/device/fan1_auto_channels_temp To get CPU’s current temperature: cat /sys/class/hwmon/hwmonX/device/cpu_cur_temp To get CPU minimum temperature: cat /sys/class/hwmon/hwmonX/device/cpu_min_temp To get CPU maximum temperature: cat /sys/class/hwmon/hwmonX/device/cpu_max_temp To get CPU startup temperature: cat /sys/class/hwmon/hwmonX/device/cpu_startup_temp Note: If the four entries are not found, use adltest application to get the required information. To get system1’s current temperature: cat /sys/class/hwmon/hwmonX/device/sys1_cur_temp To get system1 minimum temperature: cat /sys/class/hwmon/hwmonX/device/sys1_min_temp To get system1 maximum temperature: cat /sys/class/hwmon/hwmonX/device/sys1_max_temp To get system1 startup temperature: cat /sys/class/hwmon/hwmonX/device/sys1_startup_temp To get system2’s current temperature cat /sys/class/hwmon/hwmonX/device/sys2_cur_temp To get system2 minimum temperature: cat /sys/class/hwmon/hwmonX/device/sys2_min_temp To get system2 maximum temperature: cat /sys/class/hwmon/hwmonX/device/sys2_max_temp To get system2 start up temperature: cat /sys/class/hwmon/hwmonX/device/sys2_startup_temp To get CPU fan speed: cat /sys/class/hwmon/hwmonX/device/cpu_fan_speed To get system1 fan speed: cat /sys/class/hwmon/hwmonX/device/sys1_fan_speed To get system2 fan speed: cat /sys/class/hwmon/hwmonX/device/sys2_fan_speed To get system3 fan speed: cat /sys/class/hwmon/hwmonX/device/sys3_fan_speed 4.6 Storage To get the storage capabilities: cat /sys/bus/platform/devices/adl-bmc-nvmem/capabilities/nvmemcap To read the storage area: hexdump /sys/bus/nvmem/devices//nvmem e.g. hexdump /sys/bus/nvmem/devices/nvmem544/nvmem To write the storage area: hexer /sys/bus/nvmem/devices//nvmem e.g. hexer /sys/bus/nvmem/devices/nvmem544/nvmem Hexer will open a nvmem file in editor mode. To edit the data press, [r] (replace) and enter new data, then press [ESC] and type :wq to save. Then read the same file using hexdump to check the changes saved. 4.7 Backlight To get the current Backlight Enable State: cat /sys/class/backlight/adl-bmc-bklight/bl_power To Set the current Backlight Enable State to either ON / OFF echo > /sys/class/backlight/adl-bmc-bklight/bl_power e.g. To enable the backlight: echo 1 > /sys/class/backlight/adl-bmc-bklight/bl_power To disable the backlight: echo 0 > /sys/class/backlight/adl-bmc-bklight/bl_power To get the current Backlight Brightness level: cat /sys/class/backlight/adl-bmc-bklight/actual_brightness To Set the current Backlight brightness level: echo <level> > /sys/class/backlight/adl-bmc-bklight/brightness e.g. To set the brightness level of 78: echo 78 > /sys/class/backlight/adl-bmc-bklight/brightness 5. Test Scripts The following are the test scripts for testing individual drivers. Before running the script, change its permissions. e.g. sudo chmod a+x gpiotest.sh Note: All commands require administrator privileges and must be run as root user.