Summary of Contents for Tews Technologies TIP810-SW-42
Page 1
VxWorks Device Driver CAN Bus IP Version 2.0.x User Manual Issue 2.0.0 November 2008 TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC Am Bahnhof 7 Phone: +49 (0) 4101 4058 0 9190 Double Diamond Parkway, Phone: +1 (775) 850 5830 25469 Halstenbek, Germany...
Page 2
However TEWS TECHNOLOGIES GmbH reserves the right to change the product described in this document at any time without notice. TEWS TECHNOLOGIES GmbH is not liable for any damage arising out of the application or use of the device described herein.
1 Introduction 1.1 Device Driver The TIP810-SW-42 VxWorks device driver allows the operation of the TIP810 CAN Bus IP conforming to the VxWorks I/O system specification. This includes a device-independent interface with open, read, write and ioctl functions. After installation of the device driver in the I/O system messages can be transmitted to and received from the CAN bus by calling the write() or read() functions.
IndustryPack I/O and memory spaces. To simplify the implementation of IPAC device drivers which work with any supported carrier board, TEWS TECHNOLOGIES has designed a so called Carrier Driver that hides all differences of different carrier boards under a well defined interface.
Release history 2.1 Include device driver in VxWorks project For including the TIP810-SW-42 device driver into a VxWorks project (e.g. Tornado IDE or Workbench) follow the steps below: Copy the files from the distribution media into a subdirectory in your project path.
A call to this function is the first thing the user has to do before adding any device to the system or performing any I/O request. EXAMPLE #include "tip810.h” STATUS result; /*------------------- Initialize Driver -------------------*/ result = tip810Drv(); if (result == ERROR) /* Error handling */ TIP810-SW-42 - VxWorks Device Driver Page 7 of 36...
Page 8
ERROR CODES Error codes are only set by system functions. The error codes are stored in errno and can be read with the function errnoGet(). SEE ALSO VxWorks Programmer’s Guide: I/O System TIP810-SW-42 - VxWorks Device Driver Page 8 of 36...
The device number of one TIP810-10 will be assigned as n. Example: A system with 2 TIP810-10 will assign the following device indices: Module Device Index TIP810-10 TIP810-10 funcType This parameter is unused and should be set to 0. TIP810-SW-42 - VxWorks Device Driver Page 9 of 36...
Page 10
The argument filter sets the acceptance filter code and mask register(s). For more details see FIO_T810_SET_FILTER ioctl function. timing The argument timing selects the transfer rate of the CAN bus. For more details see FIO_T810_SET_BUSTIMING ioctl function. TIP810-SW-42 - VxWorks Device Driver Page 10 of 36...
Page 12
The error codes are stored in errno and can be read with the function errnoGet(). Error code Description S_ioLib_NO_DRIVER The TIP810 driver has not been started EINVAL Input parameters are invalid EISCONN The device has been created already SEE ALSO VxWorks Programmer’s Guide: I/O System TIP810-SW-42 - VxWorks Device Driver Page 12 of 36...
Before I/O can be performed to the TIP810 device, a file descriptor must be opened by invoking the basic I/O function open(). PARAMETER name Specifies the device which shall be opened, the name specified in t810DevCreate() must be used flags Not used mode Not used TIP810-SW-42 - VxWorks Device Driver Page 13 of 36...
Page 14
The error code can be read with the function errnoGet(). The error code is a standard error code set by the I/O system (see VxWorks Reference Manual). SEE ALSO ioLib, basic I/O routine - open() TIP810-SW-42 - VxWorks Device Driver Page 14 of 36...
Receives CAN message attributes as a set of bit flags. The following attribute flags are possible: Value Description T810_EXTENDED Set if the received message is an extended message frame. Reset for standard message frames. T810_REMOTE_FRAME received message remote transmission request (RTR) frame. TIP810-SW-42 - VxWorks Device Driver Page 15 of 36...
Page 16
EXAMPLE #include “tip810.h” num_bytes; T810_MSG_BUF msg_buf; msg_buf.timeout = 200; /* wait max. 200 ticks */ num_bytes = read(fd, &msg_buf, sizeof(msg_buf)); if (num_bytes != ERROR) /* process received CAN message */ TIP810-SW-42 - VxWorks Device Driver Page 16 of 36...
Page 17
RETURNS ERROR or number of data bytes read [0..8]. In the case of ERROR see tip810.h for device specific error codes. SEE ALSO ioLib, basic I/O routine - read() TIP810-SW-42 - VxWorks Device Driver Page 17 of 36...
Transmit an extended message frame. If this macro isn't set or the "dummy" macro T810_STANDARD is set a standard frame will be transmitted. T810_REMOTE_FRAME A remote transmission request (RTR bit is set) will be transmitted. TIP810-SW-42 - VxWorks Device Driver Page 18 of 36...
Page 20
ERROR or number of data bytes written [0..8]. In the case of ERROR see tip810.h for device specific error codes retrieved by errnoGet(). SEE ALSO ioLib, basic I/O routine - write() TIP810-SW-42 - VxWorks Device Driver Page 20 of 36...
FIO_T810_DISABLE_SELFTEST Disable self test mode FIO_T810_ENABLE_LISTENONLY Enable listen only mode FIO_T810_DISABLE_LISTENONLY Disable listen only mode FIO_T810_SET_LIMIT Set new error warning limit See behind for more detailed information on each control code. TIP810-SW-42 - VxWorks Device Driver Page 21 of 36...
Page 22
On success, OK is returned. In the case of an error, a value of ERROR is returned. The global variable errno contains the detailed error code. See tip810.h for device specific error codes. SEE ALSO ioLib, basic I/O routine - ioctl() TIP810-SW-42 - VxWorks Device Driver Page 22 of 36...
If this parameter is TRUE (1) the CAN bus is sampled three times per bit time instead of one. Use one sample point for faster bit rates and three sample points for slower bit rate to make the CAN bus more immune against noise spikes. TIP810-SW-42 - VxWorks Device Driver Page 23 of 36...
Page 24
= ioctl(fd, FIO_T810_SET_BUSTIMING, (int)&timing); if (result == ERROR) { /* handle ioctl error */ SEE ALSO tip810.h for predefined bus timing constants SJA1000 Product Specification Manual – 6.5.1/2 BUS TIMING REGISTER TIP810-SW-42 - VxWorks Device Driver Page 24 of 36...
The contents of this parameter will be written to the acceptance mask register of the controller. For TIP810 V1.0 only Bits 7…0 are used. A detailed description of the acceptance filter and possible filter modes can be found in the SJA1000 Product Specification Manual. TIP810-SW-42 - VxWorks Device Driver Page 25 of 36...
Page 26
= 1; // TRUE result = ioctl(fd, FIO_T810_SET_FILTER, (int)&filter); if (result < 0) { /* handle ioctl error */ SEE ALSO SJA1000 Product Specification Manual – 6.4.15 ACCEPTANCE FILTER (PeliCAN Mode) TIP810-SW-42 - VxWorks Device Driver Page 26 of 36...
This parameter receives content of the RX error counter register. This register contains the current value of the receive error counter. error_warning_limit This parameter receives content of the error warning limit register. status_register This parameter receives content of the status register. TIP810-SW-42 - VxWorks Device Driver Page 29 of 36...
Page 30
0 after reading. EXAMPLE #include “tip810.h” int fd; int result; T810_STATUS can_status; result = ioctl(fd, FIO_T810_GET_CANSTATUS, (int)&can_status); if (result == ERROR) { /* handle ioctl error */ SEE ALSO SJA1000 Product Specification Manual TIP810-SW-42 - VxWorks Device Driver Page 30 of 36...
/* handle ioctl error */ ERRORS S_t810Drv_NOBUSOFF The CAN controller is in operating mode. This mode can be changed only in reset mode. SEE ALSO SJA1000 Product Specification Manual – 6.4.3 MODE REGISTER (MOD) TIP810-SW-42 - VxWorks Device Driver Page 31 of 36...
/* handle ioctl error */ ERRORS S_t810Drv_NOBUSOFF The CAN controller is in operating mode. This mode can be changed only in reset mode. SEE ALSO SJA1000 Product Specification Manual – 6.4.3 MODE REGISTER (MOD) TIP810-SW-42 - VxWorks Device Driver Page 32 of 36...
/* handle ioctl error */ ERRORS S_t810Drv_NOBUSOFF The CAN controller is in operating mode. This mode can be changed only in reset mode. SEE ALSO SJA1000 Product Specification Manual – 6.4.3 MODE REGISTER (MOD) TIP810-SW-42 - VxWorks Device Driver Page 33 of 36...
/* handle ioctl error */ ERRORS S_t810Drv_NOBUSOFF The CAN controller is in operating mode. This mode can be changed only in reset mode. SEE ALSO SJA1000 Product Specification Manual – 6.4.3 MODE REGISTER (MOD) TIP810-SW-42 - VxWorks Device Driver Page 34 of 36...
/* handle ioctl error */ ERRORS S_t810Drv_NOBUSOFF The CAN controller is in operating mode. This mode can be changed only in reset mode. SEE ALSO SJA1000 Product Specification Manual – 6.4.3 MODE REGISTER (MOD) TIP810-SW-42 - VxWorks Device Driver Page 35 of 36...
S_t810Dev_ILLREQUEST 0x0810000A Unknown ioctl() request S_t810Dev_SIZE 0x0810000B A message buffer had a wrong size. S_t810Dev_NOBUSOFF 0x0810000C The concerning request expected the CAN Controller in BUSOFF state. TIP810-SW-42 - VxWorks Device Driver Page 36 of 36...
Need help?
Do you have a question about the TIP810-SW-42 and is the answer not in the manual?
Questions and answers