Summary of Contents for Tews Technologies TPMC501-SW-82
Page 1
The Embedded I/O Company TPMC501-SW-82 Linux Device Driver 32 Channel 16 Bit ADC Version 2.0.x User Manual Issue 2.0.2 March 2024 TEWS Technologies GmbH Eggerstedter Weg 14, 25421 Pinneberg, Germany Phone: +49 (0) 4101 4058 0 e-mail: info@tews.com www.tews.com...
Page 2
Linux Device Driver proprietary to TEWS Technologies GmbH. Any reproduction without written permission is forbidden. 32 Channel 16 Bit ADC TEWS Technologies GmbH has made any effort to Supported Modules: ensure that this manual is accurate and complete. TPMC501 However TEWS Technologies GmbH reserves the right to change the product described in this document at any time without notice.
1 Introduction The TPMC501-SW-82 Linux device driver allows the operation of a TPMC501 ADC PMC on Linux operating systems. The TPMC501-SW-82 device driver software includes the following features: read value from a selected ADC channel use sequencer mode for continuously reads from selected channels ...
Example application example/Makefile Example application makefile In order to perform an installation, extract all files of the archive TPMC501-SW-82-SRC.tar.gz to the desired target directory. The command ‘tar -xzvf TPMC501-SW-82-SRC.tar.gz’ will extract the files into the local directory. Login as root and change to the target directory ...
Be sure that the driver isn’t opened by any application program. If opened you will get the response “tpmc501drv: Device or resource busy” and the driver will still remain in the system until you close all opened files and execute modprobe –r again. TPMC501-SW-82 - Linux Device Driver Page 6 of 28...
Keep in mind that it is necessary to create new device nodes if the major number for the TPMC501 driver has changed and the makenode script is not used. TPMC501-SW-82 - Linux Device Driver Page 7 of 28...
TPMC501 device is named “/dev/tpmc501_0” the second device is named “/dev/tpmc501_1” and so on. EXAMPLE #include “tpmc501api.h” TPMC501_HANDLE hdl; ** open file descriptor to device hdl = tpmc501Open(“/dev/tpmc501_0”); if (hdl == NULL) /* handle open error */ TPMC501-SW-82 - Linux Device Driver Page 8 of 28...
Page 9
A device handle, or NULL if the function fails. An error code will be stored in errno. ERROR CODES The error codes are stored in errno. The error code is a standard error code set by the I/O system. TPMC501-SW-82 - Linux Device Driver Page 9 of 28...
This value specifies the device handle to the hardware module retrieved by a call to the corresponding open-function. EXAMPLE #include “tpmc501api.h” TPMC501_HANDLE hdl; TPMC501_STATUS result; ** close file descriptor to device result = tpmc501Close( hdl ); if (result != TPMC501_OK) /* handle close error */ TPMC501-SW-82 - Linux Device Driver Page 10 of 28...
Page 11
On success, TPMC501_OK is returned. In the case of an error, the appropriate error code is returned by the function. ERROR CODES Error Code Description TPMC501_ERR_INVALID_HANDLE The specified device handle is invalid TPMC501-SW-82 - Linux Device Driver Page 11 of 28...
0-10V, Front I/O) TPMC501_TYPE_20 TPMC501-20 (Gain 1/2/5/10, +/-10V, Back I/O) TPMC501_TYPE_21 TPMC501-21 (Gain 1/2/4/8, +/-10V, Back I/O) TPMC501_TYPE_22 TPMC501-22 (Gain 1/2/5/10, 0-10V, Back I/O) TPMC501_TYPE_23 TPMC501-23 (Gain 1/2/4/8, 0-10V, Back I/O) TPMC501-SW-82 - Linux Device Driver Page 12 of 28...
Page 13
On success, TPMC501_OK is returned. In the case of an error, the appropriate error code is returned by the function. ERROR CODES Error Code Description TPMC501_ERR_INVALID_HANDLE The specified TPMC501_HANDLE is invalid. TPMC501_ERR_INVAL Invalid model type specified. TPMC501-SW-82 - Linux Device Driver Page 13 of 28...
PciDevNo; ADCOffsetCal[4]; ADCGainCal[4]; } TPMC501_INFO_BUFFER; Variant This parameter returns the configured module variant (e.g. 10 for a TPMC501-10). PciBusNo, PciDevNo These parameters specify the PCI location of this module. TPMC501-SW-82 - Linux Device Driver Page 14 of 28...
Page 15
On success, TPMC501_OK is returned. In the case of an error, the appropriate error code is returned by the function. ERROR CODES Error Code Description TPMC501_ERR_INVALID_HANDLE The specified TPMC501_HANDLE is invalid. TPMC501-SW-82 - Linux Device Driver Page 15 of 28...
This argument specifies the input channel number. Valid channels for single-ended mode are 1…32, for differential mode 1...16. gain This argument specifies the gain for this channel. Valid gains are 1, 2, 5, 10 for TPMC501-10/-12/-20/-22 and 1, 2, 4, 8 for TPMC501-11/-13/-21/-23. TPMC501-SW-82 - Linux Device Driver Page 16 of 28...
Page 17
AdcData; channel, gain, flags; channel = 32; gain = 2; flags = TPMC501_CORR | TPMC501_FAST; result = tpmc501Read(hdl, channel, gain, flags, &AdcData); if (result != TPMC501_OK) /* handle error */ TPMC501-SW-82 - Linux Device Driver Page 17 of 28...
Page 18
At least one of the parameters is invalid. TPMC501_ERR_TIMEOUT ADC conversion timed out. TPMC501_ERR_RANGE Invalid channel number. TPMC501_ERR_BUSY This error occurs if the sequencer is still running. Please stop the sequencer before executing this function. TPMC501-SW-82 - Linux Device Driver Page 18 of 28...
This array of channel configuration structures specifies the configuration of the active channels. The channel configuration defines the channel number, the gain and some flags. The ordering of channels in a ring buffer page is the same as defined in this array. TPMC501-SW-82 - Linux Device Driver Page 19 of 28...
Page 21
TPMC501_ERR_INVAL At least one of the parameters is invalid. TPMC501_ERR_RANGE Invalid channel number. TPMC501_ERR_BUSY This error occurs if the sequencer is still running. Please stop the sequencer before executing this function. TPMC501-SW-82 - Linux Device Driver Page 21 of 28...
TPMC501_FLUSH If this flag is set the sequencer FIFO will be flushed and the function will wait for new data otherwise the function will read the next available data set. TPMC501-SW-82 - Linux Device Driver Page 22 of 28...
Page 23
TPMC501_STATUS result; unsigned int seqStatus; numOfSeqChannels; *pData; numOfSeqChannels = 2; /* Two channels used in sequencer mode */ /* allocate sequencer input buffer */ pData = malloc(sizeof(int) * numOfSeqChannels); … TPMC501-SW-82 - Linux Device Driver Page 23 of 28...
Page 24
The specified TPMC501_HANDLE is invalid. TPMC501_ERR_TIMEOUT There the expected wait time has been exceeded. TPMC501_ERR_NOT_READY The sequencer is stopped. TPMC501_ERR_NODATA The function returned without data TPMC501_ERR_BUSY The device is not configured in sequencer mode TPMC501-SW-82 - Linux Device Driver Page 24 of 28...
This argument specifies the device handle to the hardware module retrieved by a call to the corresponding open-function. EXAMPLE #include “tpmc501api.h” TPMC501_HANDLE hdl; TPMC501_STATUS result; result = tpmc501StopSequencer(hdl); if (result != TPMC501_OK) /* handle error */ TPMC501-SW-82 - Linux Device Driver Page 25 of 28...
Page 26
On success, TPMC501_OK is returned. In the case of an error, the appropriate error code is returned by the function. ERROR CODES Error Code Description TPMC501_ERR_INVALID_HANDLE The specified TPMC501_HANDLE is invalid. TPMC501-SW-82 - Linux Device Driver Page 26 of 28...
The following screen dumps display information of a correct running TPMC501 driver (see also the proc man pages). # tail –f /var/log/messages /* before modprobing the TPMC501 driver */ Jul 21 12:14:59 linux kernel: TEWS Technologies - TPMC501 32 Channel 12 Bit ADC version 2.0.x (<Release Date>) Jul 21 12:14:59 linux kernel: TPMC501: Installing device (vendor=0x10B5, device=0x9050) at 4:2.0...
Need help?
Do you have a question about the TPMC501-SW-82 and is the answer not in the manual?
Questions and answers