First you have to open command prompt as dmin and navigate to the folder containing the installation files. Then start the 'install.batch' from the command prompt.
Before reinstalling you have to uninstall 'TqDriver' from within the Device manager!
EApiLibInitialize | Function must be called at the beginning of every application. It will return Error if TQ driver is not installed. |
EApiLibUnInitialize | Function must be called at the end of every application. |
Backlight Functions are available only if suitable display is connected. Latest Intel(R) HD Graphics driver must be installed on the system.
EApiVgaBacklightEnable | |
EApiVgaGetBacklightBrightness | Backlight Brightness Intervall 0 - 255. |
EApiVgaSetBacklightBrightness | Backlight Brightness Intervall 0 - 255. |
There are 2 available EEPROMs:
EApiStorageAreaRead | ID | Offset | Bytecnt |
---|---|---|---|
Datatype | dec | hex | dec |
EApiStorageAreaWrite | ID | Offset | Data |
---|---|---|---|
Datatype | dec | hex | hex …. hex |
The current frequency is defined in Windows registry:
HKLM\SYSTEM\CurrentControlSet\Services\TqDrv\Parameters\I2cBusSpeed
Default Frequency is 100KHz, the following frequencies are available on the primary CPLD I2C Bus:
After changing I2C frequency in Windows registry, you need to reset Tq driver in Windows Device Manager:
EApiI2CWriteReadRaw | bus_id | i2c_addr | string_to_write | bytes_to_read |
---|---|---|---|---|
Datatype | dec | hex | hex … hex | dec |
To ignore write operation: <string_to_write> = “”
To ignore read operation: <bytes_to_read> = 0
EApiI2CReadTransfer | bus_id | i2c_addr | cmd | type | bytes_to_read |
---|---|---|---|---|---|
EApiI2CWriteTransfer | bus_id | i2c_addr | cmd | type | bytes_to_write |
Datatype | dec | hex | hex | hex | dec |
where 'type' = 0/1/2 (No Command/ Standard Command/ Extended Command)
Delay mode is not supported. Event mode and Reset mode are supported.
List of possible Watchdog timeout values
If timeout falls between these values, the closest top value will be used: For Example:
For 10 seconds - 16 secnds will be used.
For 683 seconds - 1024 seconds will be used.
Event timeout must be defined, other Timeout values must be 0.
2 interrupt lines are supported: 10 and 11.
Default line is 11.
Interrupt number must be defined in 2 places:
To change IRQ line you need to change it in 2 places. After that you need to reset Tq driver in Windows Device Manager:
Reset timeout must be defined, other Timeout values must be 0.
Following reset modes are supported:
1 = watchdog reset output triggers hard reset signal
0 = watchdog reset output triggers power-on button
Reset mode is definded in Windows Registry, default value is 1.
HKLM\SYSTEM\CurrentControlSet\Services\TqDrv\Parameters\WdtReset
In dual-stage mode (Event + Reset) Event timeout will be used for both stages. Event timeout must be defined, reset timeout must not equal zero.
EApiWDogStart <Delay> <EventTimeout> <ResetTimeout>
Time must be specified in ms.
Example:
EApiWDogStart 0 15200 1000
ON TQ Boards, 8 GPIO's are available, all of which can be input or output. The EApi library defines two different mechanisms to address GPIO: pin addressing and bank addressing. EAPI_GPIO_BANK_ID(GPIO_NUM) is used to define the GPIO bank.
EApiGPIOGetDirection <bank> uses bank addressing, where <bank> is a group of 32 pins addressed simultaneously. Example:
> TqApp.exe EApiGPIOGetDirection 0 Bank 0: DIRECTION = 0xff
EApiGPIOSetDirection <Pin> <Direction> uses pin addressing. <Direction> == 0 means Output, otherwise Input
Example:
Setting pin 2 to output
> TqApp.exe EApiGPIOSetDirection 2 0
EApiGPIOSetLevel <bank> uses bank addressing, where <bank> is a group of 32 pins addressed simultaneously. Example:
> TqApp.exe EApiGPIOsetLevel 4 1
EApiGPIOGetLevel <bank> uses bank addressing, where <bank> is a group of 32 pins addressed simultaneously. Example:
> TqApp.exe EApiGPIOGetLevel 0 Bank 0: LEVEL = 0xfb
This function detects Watchdog interrupts, there is a standalone application for TqWdtWaitForInterrupt because it’s not part of EAPI.
First you have to unpack tqmx86-dist-0.1.tar.gz and deploy packages with dpkg, which is part of the dkms package.
$ sudo dpkg -i package-name.deb
Then install additional test and developer tools, drivers package and corresponding dependencies:
$ sudo apt-get i2c-tools lm-sensors $ sudo apt-get install dkms linux-headers --> $(uname -r) $ sudo dpkg -i tqmx86-drivers_0.1_amd64.deb
Now copy configs/sensors.tqmx to /etc/sensors.d/ and configs/tqmx86.conf to /lib/modules-load.d/ .
After that you have to edit the /etc/default/grub file by adding 'acpi_enforce_resources=lax' parameter to 'GRUB_CMDLINE_LINUX_DEFAULT', then reboot.
After the reboot check the output of “$ lsmod”, the following Kernel Modules/ Drivers must have loaded automatically.
If any of these drivers have not been loaded automatically, load them manually with modprobe:
$ sudo modprobe <Driver_name>
Lastly check config: these Device special- and sysfs files and directories must be present:
$ cat /sys/class/dmi/id/sys_vendor TQ-Group
$ cat /sys/devices/platform/tqmx86/board_id TQMxE38C
$ cat /sys/devices/platform/tqmx86/board_version 1
$ cat /sys/class/dmi/id/bios_version TQMxE38C.5.4.48.0025.02
Source code for watchdog test program ('wdtest') is provided in “examples” directory. To compile it, use the following command:
$ gcc wdtest.c -o wdtest
Intended usage of this program is to run as daemon and periodically ping watchdog. The following command pings watchdog every 20 seconds, this is short enough for the default timeout period of 32 seconds.
$ sudo sh -c $ ./wdtest -p 20 &
The wdtest command can also print watchdog info and set timeout. The following sequence of commands will kill the running daemon, provide watchdog info and start a new daemon:
$ ps ax |grep wdtest 1686 pts/8 S 0:00 $ ./wdtest -p 20 $ sudo kill -9 1686 ;sudo $ ./wdtest -i $ sudo sh -c $ ./wdtest -p 20 & Options: 8080, Version: 0, Id: TQMx86 Watchdog Status: 0 Timeout: 32
The process of changing the watchdog timeout is similar. Make sure the delay between 'kill' and 'start is short as to not allow the watchdog to reset the board.
$ ps ax |grep wdtest 1703 pts/8 S 0:00 $ ./wdtest -p 20 $ sudo kill -9 1703; $ sudo ./wdtest -t 800 Timeout set to 1024sec $ sudo sh -c $ ./wdtest -p 500 &
Once the watchdog is first accessed it is started and cannot be stopped by any means, it can only be restarted by 'wdtest' or a similar watchdog daemon program. Alternatively simply write a charecter into /dev/watchdog (dev/watchdog0) file
GPIO functionality can be tested with the gpio-test.sh shell script provided in the “examples” directory.
The program requires root priviliges to export a pin and to change the output value.
Pins 0-3 are hardwired as output only and pins 4-7 as input only. Their direction cannot be changed.
With a single pin argument the program reports pin status (direction and value). When a second argument is provided it changes the state of the pin accordingly:
$ sudo ./gpio-test.sh 2 Direction: out Value: 0 $ sudo ./gpio-test.sh 5 Direction: in Value: 1 $ sudo ./gpio-test.sh 2 1 $ ./gpio-test.sh 2 Direction: out Value: 1
You can read “on-module” EEPROM at address 0x50 (* are variables in the file-path). You can also read/ write EEPROM as a regular file.
$ sudo hexdump -C /sys/devices/platform/tqmx86/i2c-machxo2/i2c-*/*-0050/eeprom 00000000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 00000010 54 51 4d 78 45 33 38 4d 0a ff ff ff ff ff ff ff |TQMxE38M........| 00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| * 000002a0 ff a1 ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 000002b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| * 00001000
You can also access the GPIO chip PCA9538 using i2c-tools:
First you have to determine the number of the i2c-machxo2 bus.
Then read all 4 GPIO ports of PCA9538 located on this I2C bus:
Now configure pins 0 - 3 as outputs:
$ sudo i2cset 8 0x70 3 0xf0 $ sudo i2cdump -r 0-3 8 0x70 00: 0f ff 00 f0
Lastly you have to change the output state for pins 0-1 (pins 4-7 are not affected as they are hardwired inputs).
Setting pin 0 to 0 output should turn on an LED.
$ sudo i2cset 8 0x70 1 0x06 $ sudo i2cdump -r 0-3 8 0x70 00: 06 06 00 f0
Source code for i2c-rw test program is provided in the “examples” directory. Use the following command to compile it:
$ gcc i2c-rw.c -o i2c-rw
Examples:
Read EEPROM at address 0x57 with offset 0 and size 64
Standard linux '$ sensors' command can read NCT7802 and coretemp(MSR registers of CPU) hardware monitor data:
$ sensors coretemp-isa-0000 Adapter: ISA adapter Core 0: +30.0°C (high = +110.0°C, crit = +110.0°C) Core 1: +30.0°C (high = +110.0°C, crit = +110.0°C) Core 2: +31.0°C (high = +110.0°C, crit = +110.0°C) Core 3: +31.0°C (high = +110.0°C, crit = +110.0°C) soc_dts0-virtual-0 Adapter: Virtual device temp1: +29.0°C soc_dts1-virtual-0 Adapter: Virtual device temp1: +30.0°C nct7802-i2c-9-2c Adapter: SMBus I801 adapter at 3000 3V3: +3.37 V (min = +0.00 V, max = +4.09 V) RTC-bat: +3.02 V 5VSB: +5.08 V (min = +0.00 V, max = +6.24 V) COMe-input: +12.38 V (min = +0.00 V, max = +21.99 V) CPU-fan: 0 RPM (min = 0 RPM) COMe-fan: 3936 RPM (min = 0 RPM) CPU-temp: +30.2°C (low = +0.0°C, high = +85.0°C) (crit = +100.0°C) SYS-temp: +30.0°C (low = +0.0°C, high = +85.0°C) (crit = +100.0°C)