EasyManuals Logo

STW TC1 User Manual

STW TC1
374 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #63 background imageLoading...
Page #63 background image
6 Software
User Manual 63/374
Change the Transmit Queue Length
It is possible to vary the maximal number of CAN messages in the transmit queue of e.g. can0.
# ifconfig can0 txqueuelen 1000
# ifconfig can0
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:145
Interface at rc.conf: Activate / Deactivate CAN 0/1 and set bitrate
# CAN 0 "y" activate, else deactivate
export SYSCFG_CAN0="y"
# Baudrate of can0
export SYSCFG_CAN0_BAUD="500000"
# CAN 1 "y" activate, else deactivate
export SYSCFG_CAN1="y"
# Baudrate of can1
export SYSCFG_CAN1_BAUD="500000"
Example: Change bitrate of can0
Handling the user space interface can0 by using /sbin/ifconfig provided by the BusyBox multi-call binary and
/sbin/ip
Stop can0, change bitrate to 250000 and restart can0.
# ifconfig can0 down
# /bin/ip link set can0 up type can bitrate 250000
# ifconfig can0 up
Example: Socket CAN for C programming
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/can.h>
#include <linux/can/raw.h>
#include <string.h>
#include "stwtypes.h"
/* At time of writing, these constants are not defined in the headers */
/* ... */
/* Somewhere in your application */
/* Create the socket */
sint16 s16_Socket = socket( PF_CAN, SOCK_RAW, CAN_RAW);
/* Locate the interface you wish to use */
struct ifreq t_Ifr;
strcpy(t_Ifr.ifr_name, "can0");
ioctl(s16_Socket, SIOCGIFINDEX, &t_Ifr); /* Ifr.ifr_ifindex gets filled with that
device's index*/

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the STW TC1 and is the answer not in the manual?

STW TC1 Specifications

General IconGeneral
BrandSTW
ModelTC1
CategoryController
LanguageEnglish