background image

 

 

 

DS-MPE-CAN2L User Manual Rev A. 

www.diamondsystems.com

  

 

    

 

Page 16 

// Set 500k Baud rate for CAN#0 

ret_val = set_baudrate(

can0_fd

, CAN_SPEED_500K ) ; 

if ( ret_val < 0 ) 

printf("Error while setting the baud rate \n") ; 

exit(0) ; 

// Set 500k Baud rate for CAN#1 

ret_val = set_baudrate(

can1_fd

, CAN_SPEED_500K ) ; 

if ( ret_val < 0 ) 

printf("Error while setting the baud rate \n") ; 

      exit(0) ; 

Use below macros for setting the different baud rates. These macros can also be found in can.h file.  

 

CAN_SPEED_1M  

CAN_SPEED_800K 

CAN_SPEED_500K 

CAN_SPEED_250K 

CAN_SPEED_125K 

CAN_SPEED_100K 

CAN_SPEED_50K 

CAN_SPEED_20K 

 

CAN Transmit & Receive:  

can_tx() & can_rx() : 

These function will be used to Transmit and Receive the CAN messages respectively.  

 

CAN Transmit Prototype.  

int can_tx( int can_fd, unsigned char  msgType, unsigned int can_id, int len,unsigned char *data) ; 

 

Assign the appropriate values, before calling the can_tx function. 

 

can0_fd : CAN descriptor, return value from init_can0() function 

msgType = MSG_STANDARD ; //  or MSG_EXTENDED .  

can_id = 0x12 ; // CAN ID, if the msgType is MSG_STANDARD then it should be 11-Bit CAN Message ID  

// if the msgType is MSG_EXTENDED then it should be 29-Bit CAN Message ID 

len = 4 ; // CAN Transmit Data Length  

data : CAN message data.  

data[0] = 0x1A ; 

data[1] = 0xAB ; 

Содержание DS-MPE-CAN2L

Страница 1: ...2014 Revision Date Comment A 0 4 25 2014 Initial release Copyright 2014 FOR TECHNICAL SUPPORT Diamond Systems Corporation PLEASE CONTACT 555 Ellis Street Mountain View CA 94043 USA support diamondsystems com Tel 1 650 810 2500 Fax 1 650 810 2525 www diamondsystems com ...

Страница 2: ...rawing 6 4 3 CAN Controllers 6 4 4 Transceivers 7 4 5 Isolation 7 4 6 Power Supply 7 5 Installation 7 6 Connector Pinout and Pin Description 8 6 1 PCIe MiniCard Edge Connector J1 8 6 2 CAN Ports J4 J7 8 7 Jumper Configuration 9 8 Driver installation 9 8 1 Installing the Software 9 8 2 Setting the Baud Rate 10 8 3 Setting the CAN ID and Message Length 11 8 4 Writing a Message 12 8 5 Viewing Message...

Страница 3: ...age However these design rules are not sufficient to prevent damage in all situations A third cause of failure is when a metal screwdriver tip slips or a screw drops onto the board while it is powered on causing a short between a power pin and a signal pin on a component This can cause overvoltage power supply problems described below To avoid this type of failure only perform assembly operations ...

Страница 4: ... programmable acceptance filters 11 bit and 29 bit identifiers 500V port to port and input to output isolation Driver supports dual independent and dual redundant modes Latching connectors for increased ruggedness 2 3 Operating System Support Linux 2 6 16 2 6 27 2 6 31 and 2 6 32 Windows 7 XP 2 4 Mechanical Electrical Environmental PCIe MiniCard full size format Dimensions 50 95mm x 30mm 2 x 1 18 ...

Страница 5: ...DS MPE CAN2L User Manual Rev A www diamondsystems com Page 5 4 FUNCTIONAL OVERVIEW 4 1 Functional Block Diagram The DS MPE CAN2L block diagram is shown below ...

Страница 6: ...lowing key features Conforms to the ISO 11898 1 CAN 2 0A and CAN 2 0B standards Supports both standard 11 bit identifier and extended 29 bit identifier frames Supports bit rates up to 1Mbps Transmit message FIFO with a user configurable depth of up to 64 messages Transmit prioritization through one High Priority Transmit buffer Automatic re transmission on errors or arbitration loss Receive messag...

Страница 7: ...er grounds and the host ground 4 6 Power Supply The module is powered by 3 3V from the PCIe MiniCard socket It provides all other required voltages on board including 5V for the CAN transceivers and the FPGA core voltages 5 INSTALLATION The DS MPE CAN2L plugs in to any socket meeting the PCIe MiniCard specifications It has two connectors one for each pair of serial ports a protocol configuration j...

Страница 8: ...IM_C8 17 18 GND10 RSVD UIM_C4 19 20 W_DISABLE GND3 21 22 PERST PERN0 23 24 3 3VAUX_4 PERP0 25 26 GND11 GND4 27 28 1 5V_2 GND5 29 30 SMB_CLK PETN0 31 32 SMB_DATA PETP0 33 34 GND12 GND6 35 36 USB_D GND7 37 38 USB_D 3 3VAUX_1 39 40 GND13 3 3VAUX_2 41 42 LED_WWAN GND8 43 44 LED_WLAN RSVD1 45 46 LED_WPAN RSVD2 47 48 1 5V_3 RSVD3 49 50 GND14 RSVD4 51 52 3 3VAUX_5 6 2 CAN Ports J4 J7 Each of the two CAN ...

Страница 9: ..._can directory contains the following files ls l 1 CANLib CAN Library 2 pci_fpga ko PCI CAN Interface driver 3 CAN_Monitor PCI CAN CAN_Monitor utility 4 qt opensource linux x86 5 2 1 run Qt Installer which is required by the PCI CAN Interface utility Step 2 Install the Qt shared libraries using the Qt Installer Execute the command below and follow the Qt Installer instructions Use the command belo...

Страница 10: ...will open the CAN interface utility Note To start CAN utility in the future follow Steps 3 to 5 only 8 2 Setting the Baud Rate Using the CAN interface utility software the baud rate for each port can be selected On the desired CAN port select the baud rate from the Baud Rate drop down menu After selecting the desired baud rate press Connect to connect with specified baud rate as shown in below fig...

Страница 11: ...al Rev A www diamondsystems com Page 11 8 3 Setting the CAN ID and Message Length Set the CAN ID and CAN message length for each CAN port by entering the desired numbers into the ID and Len fields respectively for that port ...

Страница 12: ...he below figure To transmit to a different CAN ID change the data in the CAN ID field enter the desired data into the Data Hex fields and click on Write Message To change the message length change the CAN message length to the new length enter the desired data into the Data Hex fields and click on Write Message To transmit a different CAN message to the same CAN ID change the CAN message to the de...

Страница 13: ...DS MPE CAN2L User Manual Rev A www diamondsystems com Page 13 8 5 Viewing Messages Transmitted messages are listed in the CAN message box for the sending CAN port as shown in below figure ...

Страница 14: ...DS MPE CAN2L User Manual Rev A www diamondsystems com Page 14 Received CAN messages are listed in the CAN message box for the CAN port receiving the message as shown in below figure ...

Страница 15: ...se APIs 9 1 API to Configure and Manage CAN ports init_can0 init_can1 These function will initialize the CAN 0 CAN 1 ports respectively Both these functions will return the CAN file descriptor fd The return value of these functions should be retained for all subsequent operations Its prototypes are defined in the can h file Declare two CAN file descriptors and retains its return values include can...

Страница 16: ...K CAN_SPEED_125K CAN_SPEED_100K CAN_SPEED_50K CAN_SPEED_20K CAN Transmit Receive can_tx can_rx These function will be used to Transmit and Receive the CAN messages respectively CAN Transmit Prototype int can_tx int can_fd unsigned char msgType unsigned int can_id int len unsigned char data Assign the appropriate values before calling the can_tx function can0_fd CAN descriptor return value from ini...

Страница 17: ...gned char msgType unsigned char rx_data unsigned int can_id unsigned char can_msg_len Pass the appropriate pointers for calling the can_rx function if can_rx can0_fd msgType data can_id dlc If msgType MSG_STANDARD received message is CAN Standard Message else if msgType MSG_EXTENDED received message is CAN Extended Message dlc Received CAN Data Length can_id Will contain the CAN Message ID Data of...

Страница 18: ... com Page 18 Compiling CAN Application using CANLib Library Export the Library path using below command export LD_LIBRARY_PATH LD_LIBRARY_PATH path to CANLib To compile the application use the below command g can_app c lCAN L path to CANLib o can_app ...

Страница 19: ...ity Acceptance filters 16 programmable 29 bit Identifiers 11 bit and 29 bit Modes Dual independent Dual redundant Isolation 500V port to port and input to output Input power 3 3VDC 5 Power consumption 0 462W 3 3V Software drivers Windows XP Linux 2 6 16 2 6 27 2 6 31 and 2 6 32 Operating temperature 40 C to 85 C MTBF 1 583 210 hours at 20 C Dimensions 50 95mm x 30mm 2 x 1 18 Weight 8 5g 0 3oz RoHS...

Отзывы: