Home

USB-CANmodul Systems Manual

image

Contents

1. Bit 31 30 29 28 27 26 25 24 CLK SMP 23 22 21 20 19 18 17 16 BPR 15 14 13 12 11 10 9 8 SYNC PROPAG 7 6 5 4 3 2 1 Bit 0 PHASE1 PHASE2 Figure 24 Format of the extended baud rate register for sysWORXX Modules BPR Baudrate Prescaler specifies the ration between system clock of the microcontroller and the bus clock on CAN bus SYNC Synchronization Jump Width specifies the compensation of phase shift between the system clock and the different CAN controllers connected to the CAN bus SAM Sampling specifies the number of sample points used for reading the bits on the CAN bus If SAM 1 three sample points are used otherwise only one sample point is used PROPAG Programming Time Segment specifies the compensation of the physical delay time on the CAN bus PHASE Time Segment specifies the number of clock cycles of one bit on the CAN bus as well as the position of the sample points CLK Clock specifies the frequency of the microcontroller If set to 0 then the microcontroller runs with 48 MHz clock cycle internally otherwise with 24 MHz This influences the CAN bus baud rate see system clock tuck in the example below MCK JUUUUU CAN Clock leech SYNC_SEG PROP_SEG PHASE_SEG1 NOMINAL BIT TIME PHASE _SEG2 Sample Point Transmission Point Figure 25 Generic structure of one bit on the CAN bus source Atmel AT91SAM7A3 manual SYS TEC electronic GmbH 2015 L 487
2. 15 USB CANmodul Control Tool 16 Device Number Selection Dialog Box 17 Dialog Box with Hardware Configuration 18 Dialog Box Message Filter Configuration 19 PCANView USBCAN Main Window cccccceceeeeeeeeeeteeeeeeeeeeeeeeeeeneeeeeeeeneeeeeeenea 20 precisely timed CAN messages in PCANView USBCAN 21 configuration of cyclic CAN messages in PCANView USBCAN 21 Debug settings in USB CANmodul Control 25 Location of CAN and Expansion Port on GW 002 31 Location of the Expansion Port on USB CANmodul2 32 Position of expansion plugs on USB CANmodul2 G4 ccceeeereeeeeeeteeeeeeeeeeeeeeeee 32 simple example circuit for Expansion Port 33 termination resistors on CAN bus 34 Internal structure of the Multiport CAN to USB ceeeeeeeeeeeeeeeetteeeeeteeeeeeeeeees 37 Dialog Box for Manipulating the Port Expansion and the CAN Port 42 Software State Diagram ss 46 Example for parallel mode with two defined CAN messages seeeeeceeseteeeeee 106 Example of sequential mode with two defined CAN messages 106 Structure of baud rate register BTRO 129 Structure of baud rate register BTR1 ne 129 General structure of a single bit on the CAN bus 129 Format of the extended baud rate register for sysWORX
3. memset amp InitParam 0 sizeof InitParam InitParam m dwSize sizeof InitParam InitParam m bMode kUcanModeNormal InitParam m bBTRO HIBYTE USBCAN BAUD 1MBit InitParam m bBTRI LOBYTE USBCAN BAUD 1MBit InitParam m bOCR USBCAN OCR DEFAULT InitParam m dwAMR USBCAN AMR ALL InitParam m dwACR USBCAN ACR ALL InitParam m dwBaudrate USBCAN BAUDEX USE BTRO1 InitParam m wNrOfRxBufferEntries USBCAN DEFAULT BUFFER ENTRIES InitParam m wNrOfTxBufferEntries USBCAN DEFAULT BUFFER ENTRIES initialize CAN channel bRet UcanInitCanEx2 UcanHandle USBCAN CHANNEL CHO amp InitParam Example 2 will not work for GW 001 GW 002 tUcanHandle UcanHandle UCANRET bRet tUcanInitCanParam InitParam preset init parameters memset amp InitParam 0 sizeof InitParam InitParam m_dwSize sizeof InitParam InitParam m bMode kUcanModeNormal InitParam m bBTRO HIBYTE USBCAN BAUD USE _BTREX InitParam m bBTR1 LOBYTE USBCAN BAUD USE BTREX InitParam m bOCR USBCAN OCR DEFAULT InitParam m dwAMR USBCAN AMR ALL InitParam m dwACR USBCAN ACR ALI InitParam m dwBaudrate USBCAN BAUDEX SP2 125kBit InitParam m wNrOfRxBufferEntries USBCAN DEFAULT BUFFER ENTRIES InitParam m wNrOfTxBufferEntries USBCAN DEFAULT BUFFER ENTRIES initialize CAN channel bRet UcanInitCanEx2 UcanHandle USBCAN CHANNEL CHO amp InitParam SYS TEC electronic GmbH 2015 L 48
4. X XHO X XHO UcanGetMsgPending X XHO X XHO UcanGetCanErrorCounter X XHO X XHO UcanDeinitCan X X CHO X CHO X UcanDeinitCanEx XHO XHO X XHO X XHO Table 12 Software State Functions Meaning of entries in Table 12 x CHO XHO SYS TEC electronic GmbH 2015 Function not supported Function supported without limitations Function supported for each module with one CAN channel and or for CAN channel 0 of a logical module with two CAN channels because the function parameter for selecting the channel number is missing Function only supported with function parameter selecting CAN channel 0 of a logical module because the hardware does only have one CAN channel L 487e_29 47 USB CANmodul 2 3 2 Functions of the USBCAN library This section describes the various functions provided by USBCAN library Most of the functions return a value of the type UCANRET containing an error code The meaning of this code is the same for each function Besides the syntax the meaning and the parameters of each function the possible error codes are shown Some of the extended functions have an additional parameter for support of multi CAN instances and enable operations on a single CAN channel on Multiport CAN to USB 3004006 or USB CANmodul2 3204002 3204003 These extended functions are also applicable on GW 002 or GW 001 as long as CAN channel 0 is used Otherwise the functions returns with error code USBCAN_ERR_ILLCHANNE
5. TEC LECTRONIC USB CANmodul GW 001 GW 002 3004006 3204xxx 3304xxx 3404xxx Systems Manual Preliminary Edition February 2015 system house for distributed automation USB CANmodul This manual comprises descriptions for copyrighted products which are not explicitly indicated as such The absence of the trademark and copyright symbols does not infer that a product is not protected Additionally registered patents and trademarks are similarly not expressly indicated in this manual The information in this document has been carefully checked and is believed to be entirely reliable However SYS TEC electronic GmbH assumes no responsibility for any inaccuracies SYS TEC electronic GmbH neither gives any guarantee nor accepts any liability whatsoever for consequential damages resulting from the use of this manual or its associated product SYS TEC Electronic GmbH reserves the right to alter the information contained herein without prior notification and accepts no responsibility for any damages which might result Additionally SYS TEC electronic GmbH offers no guarantee nor accepts any liability for damages arising from the improper usage or improper installation of the hardware or software SYS TEC electronic GmbH further reserves the right to alter the layout and or design of the hardware without prior notification and accepts no liability for doing so Copyright 2015 SYS TEC electronic GmbH D 08468 Heinsdo
6. now USBCAN_CANERR_BUSOFF 0x0010 CAN controller is in BUSOFF state USBCAN_CANERR_QOVERRUN 0x0040 Receive buffer in module is overrun USBCAN_CANERR_QXMTFULL 0x0080 Transmit buffer in module is overrun USBCAN_CANERR_REGTEST 0x0100 CAN controller not found hardware error USBCAN_CANERR_TXMSGLOST 0x0400 A transmit CAN message was deleted automatically by the firmware because transmission timeout run over refer to function UcanSetTxTimeout This WORD is bit oriented it can indicate multiple errors simultaneously WORD m_wuUsbSiatus is becoming obsolete and is retained only for compatibility purposes It retains the value 0 SYS TEC electronic GmbH 2015 L 487e 29 87 USB CANmodul UcanGetStatusEx Syntax UCANRET PUBLIC UcanGetStatusEx tUcanHandle UcanHandle p BYTE bChannel p CSCACUSSeAIeE PsSrEaeus yp Usability HW_INIT CAN_INIT version 3 00 and higher Description This function returns the error status of a specific CAN channel from the USB CANmodul This function may be used alternatively for function UcanGetStatus Structure tStatusStruct is described in section UcanGetStatus Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx pStatus_p Error status of the USB CANmodul bChannel_p Specifies the CAN channel of which the status is to be returned USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN
7. DWORD bEvent p BYTE bChannel p void BATS D SYS TEC electronic GmbH 2015 L 487e_29 61 USB CANmodul Return value Error codes of the function 62 USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_HWINUSE USBCAN_ERR_ILLHW USBCAN_ERR_MAXMODULES USBCAN_ERR_RESOURCE USBCAN_ERR_ILLVERSION USBCAN_ERR_ILLPARAM USBCAN_ERR_IOFAILED USBCAN_ERR_BUSY USBCAN_ERR_TIMEOUT USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS UcaninitHardwareEx2 Syntax UCANRET PUBLIC UcanInitHardwareEx2 tUcanHandle pUcanHandle p DWORD dwSerialNr p tCallbackFktEx fpCallbackFktEx p Voe pCallbackArg p Usability DLL_INIT version 5 04 and higher Description Initializes an USB CANmodul as alternative to the functions UcaninitHardware and UcaninitHardwareEx Instead of passing the device number the serial number is passed to identify the USB CANmodul Parameter pUcanHandle_p Pointer to the variable for the USB CAN Handle This pointer may not be NULL dwSerialNr_p Serial number of the USB CANmodul at the bar code sticker at the device s case For the logical modules of an 8 or 16 channel device the serial number must be calculated with the following formula dwSerialNr_p BarCodeNr 1000 n where n is the number of the logical module beginning with 1 fpCallbackFktEx_p Address to the callback
8. Syntax Visual Basic Public Event USBcanServer DeinitCanEvent _ ByVal bChannel p As Byte Description The CAN channel was shut down Parameter bChannel_p CAN Channel which status has been changed USBCAN_CHANNEL_CHO for CAN Channel 0 USBCAN_CHANNEL_CH1 for CAN Channel 1 190 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS DeinitHwEvent Syntax C public event USBcanServer DeinitHwEvent Syntax Visual Basic Public Event USBcanServer DeinitHwEvent Description The device was shut down ConnectEvent Syntax C public static event USBcanServer ConnectEvent Syntax Visual Basic Public Shared Event USBcanServer ConnectEvent Description A new device was connected to the USB port DisconnectEvent Syntax C public static event USBcanServer DisconnectEvent Syntax Visual Basic Public Shared Event USBcanServer DisconnectEvent Description A previously shut down device was disconnected from the USB port SYS TEC electronic GmbH 2015 L 487e 29 191 USB CANmodul FatalDisconnectEvent Syntax C public event USBcanServer FatalDisconnectEvent Syntax Visual Basic Public Shared Event USBcanServer FatalDisconnectEvent Description A device was disconnected from the USB port without prior shutdown 2 4 3 Properties of Class USBcanServer IsHardwarelnitialized Syntax C
9. Thus additional signals such as Standby STB and Enable EN on a low speed CAN transceiver can be controlled This function may be used alternatively for function UcanWriteCanPort Parameter UcanHandle_p USB CAN handle received with the function Ucan nitHardware or UcanInitHardwareEx bChannel_p CAN channel to read data from USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 bOutValue_p New output value for the CAN port interface see Table 19 Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e 29 113 USB CANmodul UcanReadCanPort Syntax UCANRET PUBLIC UcanReadCanPort tUcanHandle BYTES Usability UcanHandle p pbValue _p HW_INIT CAN_INIT version 2 15 or higher Description Reads the current input value from the CAN port interface Thus the additional signal ERR for error can be read on a low speed CAN transceiver It is also possible to read the state constant for the terminating resistor on devices with high speed transceivers currently only supported for USB CANmodul2 Parameter UcanHandle_p pbinValue_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx Address poi
10. UCANRET PUBLIC UcanReadUserPort tUcanHandle UcanHandle p BTE pbinValue p Usability HW_INIT CAN INIT version 2 16 or higher Description Reads the current input value from the expansion port Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcaninitHardwareEx pbinValue p Address pointing to a variable that contains the read input value following the successful return of this function This variable then contains the state of the 8 bit expansion port Each bit in this parameter corresponds to matching pin on the expansion port Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLPARAM USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD_ Note After the USB CANmodul has been connected to the PC all expansion port pins are configured as inputs except sysWORXX modules see above This function can also be used to read back the states of ports configured as outputs SYS TEC electronic GmbH 2015 L 487e 29 119 USB CANmodul UcanReadUserPortEx Syntax UCANRET PUBLIC UcanReadUserPortEx tUcanHandle UcanHandle p ETES pbinValue p BYCIE S pblastOutEn p BYERS pblastOutVal p Usability HW_INIT CAN _INIT version 3 00 and higher Description Reads the current input v
11. USBCAN library as DLL and a demo application in source code for Microsoft eMbedded Visual C 4 0 The following Windows CE versions and CPU types are tested with the driver Windows CE version CPU type Tested at CPU 5 0 ARMVAI Intel PXA255 Intel PXA270 6 0 X86 Intel Atom Table 22 tested Windows CE versions and CPU types On request we can build a driver for other CPU types too Please contact our support department for this 4 1 Installation of the driver under Windows CE After unzipping the archive you will find the driver in subfolder Driver XXX whereas XXX marks the CPU type For example the driver for CPU type ARMVAI is located in subfolder Driver ARMVAI The name of the driver file in each case is UsbCanDrv dil This driver in its current version supports the following USB CANmoduls GW 002 USB CANmodul1 3204000 and 3204001 and all derivates of USB CANmodul2 3204001 3204003 Prior to connecting the USB CANmodul to your Windows CE device copy the driver to the subfolder Windows Now connect the USB CANmodul with your Windows CE device If the USB CANmodul is connected for the first time a window Unidentified USB device appears Type in the name of the driver usbcandrv no capitalization rules Now you can access the USB CANmodul with an application You can use our ConsoleDemo exe for example It sends 100 CAN messages with 1 MBit sec and prints out received CAN messages in the mean
12. public bool IsHardwareInitialized Syntax Visual Basic Public ReadOnly Property IsHardwareInitialized As Boolean Return Value Displays true if the USB CANmodul was initialized as hardware The method set is not implemented IsCanOlnitialized Syntax C public bool IsCan0Initialized Syntax Visual Basic Public ReadOnly Property IsCanOInitialized As Boolean Return Value Displays true if the first CAN channel of the USB CANmodul has been initialized The method set is not implemented 192 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS IsCan1Initialized Syntax C public bool IsCanlInitialized Syntax Visual Basic Public ReadOnly Property IsCanlInitialized As Boolean Return Value Displays true if the second CAN channel of the USB CANmodul was initialized The method set is not implemented SYS TEC electronic GmbH 2015 L 487e_29 193 USB CANmodul 3 Software support for Linux OS For the Linux operating system a Socket CAN driver is being offered Please ask at the help desk support for the respective article number or refer to the download page of the SYS TEC homepage www systec electronic com 194 SYS TEC electronic GmbH 2015 L 487e 29 Software support for Linux OS SYS TEC electronic GmbH 2015 L 487e 29 195 USB CANmodul 4 Software support for Windows CE OS The software package with order number SO 1091 contains a driver for Windows CE an
13. tUcanHardwarelnitInfo should try to find further modules SYS TEC electronic GmbH 2015 L 487e 29 149 USB CANmodul Example define APP MAX DEVICES 10 lt for example only 10 modules tUcanHandle aUcanHandles g APP MAX DEVICES DWORD dwFoundModules g int main void UCANRET bRet find all USB CANmoduls dwFoundModules g UcanEnumerateHardware AppEnumCallback NULL TRUE also find modules which are currently used by other apps 0 0 no limitations for the device number 0 0 no limitations for the serial number 0 0 no limitations for the Product Code beginning from here all initialized modules can be used iy initialze the CAN interface of the first found module bRet UcanInitCan aUcanHandles g 0 0x00 0x14 OxFFFFFFFF 0x00000000 void PUBLIC AppEnumCallback DWORD dwIndex_p BOOL fIsUsed p tUcanHardwareInfoEx pHwInfoEx p tUcanHardwareInitInfo pInitInfo p void pArg p if fIsUsed_p FALSE printf module d is already used n pHwInfoEx_p gt m_dwSerialNr ie if dwIndex_p lt APP MAX DEVICES l printf initialize module d n pHwInfoEx_p gt m_dwSerialNr fill out the parameters for auto initializing plinitinfo p gt m fDo nitialize TRUE pinitInfo p gt m_pUcanHandle amp aUcanHandles g dwIndex_p pInitInfo_ p gt m fpCallbackFktEx UcanCallbackFktEx plnitinfo p gt m pCallbackArg pArg p find further mo
14. us 45 2 3 2 Functions of the USBCAN library ss 48 2 3 2 1 General TUNCHONS eee prere eneee rare item tes eadid als Paris 49 2 3 2 2 Functions for automatic transmission 0 0 0 2 eee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeteeeeaaeeeees 106 2 3 2 3 Functions for the CAN Port is 111 2 3 2 4 Functions for the Expansion Port 116 2 3 3 Error Codes of the Functions 121 2 3 4 Baud Rate Configuration c ccccccceceseeeececeeeeeeeeeeeeeeeeeceaaeeseceeeeeseeeeeeiaaeesees 128 2 3 4 1 Baud Rate Configuration for GW 001 and GW 002 ee ccecceeeeeeeetteeeeees 128 2 3 4 2 Baud Rate Configuration for sysWORXX Modules 130 2 3 4 3 Baud Rate Configuration for Fourth Generation USB CANmodul 134 2 3 4 4 Use of non listed Bit Rates eee eee eeeeeeee tere eeeeeeeeeeeeeeeeeeeeeeeeeneaeeeees 137 2 3 5 CAN Messages Filter Function 138 2 3 6 Using multiple CAN channels ccccceceeeeeeeeeeeeeeeeeeecaaeeeeeeeeeeeeeeeesaeeeees 141 2 3 7 Using the Callback FUNCTIONS 0 ccccecceeeeeeeeeeeeeeeeeeeeeeeeaaeeseeaeeeeeeaeeeestaaeetees 141 2 4 Class library for NET programming languages cccccseceeeeeeeeeeeeeeeeeaeees 151 2 4 1 Methods of class USBcanServer cccceeeeeeeeeeeeeeeeeeeeaaeeseeeeeeeseneeeessaaeeeees 152 SYS TEC electronic GmbH 2015 L 487e 29 USB CANmodul 2 4 1 1 General methods oo cece ccc ceeeececes eee eesceaeeeceseeaeeee
15. 487e 29 Software Support for Windows OS USBCAN CHECK SUPPORT TWO CHANNEL pHwindoEx This Macro checks whether the logical USB CANmodul supports two CAN channels USBCAN CHECK SUPPORT _TERM_RESISTOR pHwindoEx This Macro checks whether the logical USB CANmodul supports to read back the state of the termination resistor USBCAN CHECK _ SUPPORT USER PORT pHwindoEx This Macro checks whether the logical USB CANmodul supports a programmable Expansion Port refer to section 1 5 USBCAN_ CHECK _ SUPPORT _RBUSER_PORT pHwindoEx This Macro checks whether the logical USB CANmodul supports a programmable Expansion Port including the storing of the last output configuration to a non volatile memory After next power on this configuration will be automatically set to the Expansion Port USBCAN_CHECK_SUPPORT_RBCAN_PORT pHwindoEx This Macro checks whether the logical USB CANmodul supports a programmable CAN Port for low speed CAN transceivers including the storing of the last output configuration to a non volatile memory After next power on this configuration will be automatically set to the CAN Port Example UCANRET bRet tUcanHandle UcanHandle tUcanHardwareInfoEx HwiInfoEx init USB CANmodul bRet UcanInitHardware amp UcanHandle USBCAN ANY MODULE NULL if bRet USBCAN SUCCESSFUL memset amp HwInfoEx 0 sizeof HwInfoEx HwInfoEx m dwSize sizeof HwInfoEx get th xten
16. 82C251 Currently available order numbers 3004006 3204000 3204001 3204003 3204004 3204008 3204017 3204018 3204019 3404000 3404001 Other accessories WKO54 Unshielded CAN bus cable for max 5 nodes with removable 120 Ohm terminating resistors and configured for supply voltage input WK 004 Shielded CAN cable for direct connection of 2 nodes with integrated 120 Ohm terminating resistors GW 002 Z01 Wall mounting plate GW 002 Z02 DB 9 to 5 pin Combicon pin adapter pinout according to DeviceNet specification GW 002 Z03 USB cable 3 m A B GW 002 Z04 USB cable 4 5 m A B GW 002 Z05 Mounting plate for DIN rail 36 SYS TEC electronic GmbH 2015 L 487e 29 Getting Started 1 8 The new sys WORXX USB CANmoduls 1 8 1 The Multiport CAN to USB The Multiport CAN to USB 3004006 is an industrial USB CAN interface with 16 CAN channels coming in a 19 rack mounted housing The device is structured into 8 logical USB CAN devices with 2 CAN channels each The logical devices are combined by 2 USB hubs and connected to the PC via two USB ports see picture below USB USB port port Power Supply USB USB Hub Hub usB USB USB USB USB USB oe oe CAN CAN CANS CAN4 CAN5 an CANT USB CANmodul 0 USB CANmoduL 7 CHO CHI CHO CHI Figure 16 Internal structure of the Multiport CAN to USB There is no separate software driver for the Multiport CAN to USB as it is supported by the standard drivers used for USB
17. CANmodul A special API function set was implemented to support the extended functions of the Multiport CAN to USB such as SYS TEC electronic GmbH 2015 L 487e 29 37 USB CANmodul multiple CAN channels baud rate configuration and acceptance mask filtering Please also refer to sections 2 3 4 2 8 5 and 2 3 7 In a limited scope these extended function are also applicable to GW 002 devices and the standard functions are applicable to the Multiport CAN to USB The USB device numbers of the 8 logical devices are assigned sequentially The first logical device counted from left side device number 0 the second logical device has number 1 and so on The device numbers can be reconfigured using the USB CANmodul Control icon in the Windows Control Panel 1 8 2 The USB CANmodul1 The USB CANmodul1 ordering number 3204000 or 324001 is a cost optimized variant of the new sysWORXX USB CANmodul series including only one CAN channel Optionally you can order this device with or without a galvanic isolation refer to section 1 7 Both variants has built in a high speed CAN transceiver There is no Expansion Port for connecting digital inputs or outputs 38 SYS TEC electronic GmbH 2015 L 487e 29 Getting Started 1 8 3 The USB CANmodul2 The USB CANmodul2 ordering number 324003 is an extended variant of the new sysWORXX USB CANmodul series including two CAN channels This device has a galvanic isolation refer to section 1 7 This v
18. Figure 17 Please note that the jumper JP104 must have the same state like JP200 for CAN channel 0 and the jumper JP105 must have the same stat like JP300 for CAN channel 1 Otherwise the read state of the termination resistor is not correct The reason of this solution is the optical isolation of the CAN channels max cable length max bitrate specific resistance Cable cross section m kBit s kQ m mm 30 1000 70 0 25 0 34 100 500 lt 60 0 34 0 60 500 100 lt 40 0 50 0 60 1000 20 lt 26 0 75 0 80 Table 10 recommended cable parameters 34 SYS TEC electronic GmbH 2015 L 487e_29 Getting Started 1 7 Order Options Obsolete USB CANmoduls which are not available any more Part Number Option GW 002 Standard version high speed 82C251 GW 002 x0x high speed with Philips 82C251 transceiver GW 002 x1x low speed with Philips TJA1054 transceiver GW 002 x2x low speed single wire with Philips AU5790 GW 002 x3x low speed with Philips TJA1041 transceiver GW 002 0xx without optical CAN signal isolation GW 002 1xx with optical CAN signal isolation GW 002 xx0 internal supply via USB GW 002 xx1 external supply 7 27V GW 002 xx2 external supply 12 30V GW 002 KSMxx customer specific version MOQ 25 AU5790 requires external supply voltage External supply not available with standard 82C251 transceiver The USB CANmodul is available in different options All sysWORXX variants Part Number Option 3004006
19. L 487e 29 Software Support for Windows OS Example for Visual Basic NET variable for return value Dim bRet As Byte 0 array of tCanMsgStruct with length 1 Dim canMsgStruct 0 As UcanDotNET USBcanServer tCanMsgStruct initialize the first element with a new structure instance canMsgStruct 0 _ UcanDotNET USBcanServer tCanMsgStruct CreateInstance amp H123 fill message data with some value canMsgStruct 0 m bData 0 amp HAB canMsgStruct 0 m bData 1 amp HCD canMsgStruct 0 m bData 2 amp HEF canMsgStruct 0 m bData 3 amp H12 canMsgStruct 0 m_bData 4 amp H34 canMsgStruct 0 m_bData 5 amp H56 canMsgStruct 0 m_bData 6 amp H78 canMsgStruct 0 m_ bData 7 amp H90 send message bRet m USBcan WriteCanMsg _ UcanDotNET USBcanServer USBCAN CHANNEL CHO canMsgStruct check return value SYS TEC electronic GmbH 2015 L 487e_29 169 USB CANmodul GetMsgCountinfo Syntax C public byte USBcanServer GetMsgCount byte bChannel p ref short wRecvdMsgCount_p _ ret short wsentMsg ount ph Syntax Visual Basic Public Function USBcanServer GetMsgCount _ ByVal bChannel p As Byte _ ByRef pwRecvdMsgCount p As Short _ ByRef pwSentMsgCount_p As Short As Byte Usability CAN_INIT version 3 01 and higher Description Reads the message counters of the specified CAN channel Parameter bChannel_p
20. Multiport CAN to USB 16 CAN channels high speed transceiver 82C251 galvanic isolation separated into 8 logical devices with 2 channels each 3204000 USB CANmodul1 One CAN channel high speed transceiver 82C251 3204001 USB CANmodul1 with galvanic isolation One CAN channel high speed transceiver 82C251 3204002 USB CANmodul2 Two CAN channels high speed transceiver 82C251 3204003 USB CANmodul2 with galvanic isolation Two CAN channels high speed transceiver 82C251 3204007 USB CANmodul2 same as 3204000 but with 8 bit Expansion Port SYS TEC electronic GmbH 2015 L 487e 29 35 USB CANmodul Part Number Option 3204008 USB CANmodul2 same as 3204003 but with single wire CAN transceiver Philips AU5790 at the first CAN channel 3204009 USB CANmodul2 same as 3204002 but with low speed CAN transceiver Philips TJA1054 at the first CAN channel 3204011 USB CANmodul2 same as 3204002 but with low speed CAN transceiver Philips TJA1054 at both CAN channels 3204017 USB CANmodul2 same as 3204003 but without housing and with wired LEDs USB CANmodul2 same as 3204003 but with high speed See CAN Transceiver NXP TJA1041 on first CAN channel 3204019 USB CANmodul2 same as 3204003 but with high speed CAN transceiver NXP TJA1054 at th first CAN channel 3404000 USB CANmodul8 with galvanic isolation 8 CAN channels high speed transceiver 82C251 3404001 USB CANmodul16 with galvanic isolation 16 CAN channels high speed transceiver
21. TEC electronic GmbH 2015 L 487e_29 Getting Started Since Software version V4 09 it is possible to call PCANView by using command line parameters e g for using a batch file If at least one of these command line parameters is used then the dialog box for hardware parameters is not shown see Figure 5 The following command line parameters are available in PCANView Syntax PCANView exe d lt devicenr gt c lt channelnr gt b lt baudrate gt 1 x lt x pos gt y lt y pos gt n d lt devicenr gt defines the device number of the USB CANmodul The range of values is between 0 and 254 Any USB CANmodul that is found first is allocated value 255 default value C lt channelnr gt defines the CAN channel that is to be used for multi channel USB CANmoduls The range of values is between 0 and 1 Default value is 0 first CAN channel b lt baudrate gt defines the bit rate on CAN bus in kBit sec Possible values are 1000 800 500 250 125 100 50 20 10 There is no default value for this parameter It must be set if the dialog box for setting hardware parameters shall not be shown If this parameter is set the USB CANmodul will be initialized in listen only mode In this case CAN messages cannot be sent X y lt Xx pos gt and lt y pos gt define the position of the PCANView main window If those parameters are missing the position of the PCANView main window is read from the registry and is the same
22. This callback function is not called if the filter parameters does not match User specific parameter that is passed to the callback function as well Set to TRUE if USB CANmoduls should be found too which are currently exclusively used by another application These modules cannot be used by the own application Filter parameters for the device number The value bDeviceNrLow p specifies the lower limit and the value bDeviceNrHigh_p specifies the upper limit of the device number which have to be found Filter parameters for the serial number The values specifies the lower and upper limit of the serial number area which have to be found Filter parameters for the Product Code The values specifies the lower and upper limit of the Product Code area which have to be found Possible values are shown in Table 15 SYS TEC electronic GmbH 2015 L 487e 29 57 USB CANmodul The callback function must have the following format see section 2 3 7 void PUBLIC UcanEnumCallback DWORD dwindex p BOOL fIsUsed p tUcanHardwareInfoEx pHwInfoEx p tUcanHardwareInitInfo pInitInfo p vondi BAG D Return value The function UcanEnumerateHardware returns the number of found USB CANmoduls logical modules Example 1 DWORD dwFoundModules find all USB CANmoduls which are NOT used by other applications dwFoundModules UcanEnumerateHardware AppEnumCallback NULL FALSE 0 0 no limitation of dev
23. UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx bChannel_p CAN channel that is to be changed USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 bBTRO p Baud rate register BTRO refer to section 2 3 4 bBTR1_p Baud rate register BTR1 refer to section 2 3 4 dwBaudrate p Baud rate register for all sysWORXX modules refer to section 2 3 4 Note The configuration of the baud rate differs significantly between the older USB CANmodul versions GW 001 and GW 002 and the new sysWORXX modules For standardized baud rate values see section 2 3 4 the baud rate registers BTRO and BTR1 are as well applicable for the new sysWORXX modules Therefore set m dwBaudrate to USBCAN BAUDEX USE BTRO1 90 SYS TEC electronic GmbH 2015 L 487e 29 Return value Error code of the function SYS TEC electronic GmbH 2015 USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD_ L 487e_29 Software Support for Windows OS 91 USB CANmodul UcanSetAcceptance Syntax UCANRET PUBLIC UcanSetAcceptance tUcanHandle DWORD DWORD Usability CAN_INIT Description UcanHandle p dwAMR_p dwACR_p Changes the acceptance Mask Register of the USB
24. amp InitParam 136 SYS TEC electronic GmbH 2015 L 487e 29 2 3 4 4 Use of non listed Bit Rates Software Support for Windows OS As the setting of the bit rate on the CAN bus is done via index values also other bit rates not listed with above constants can be set For defining these bit rates the above listed equations must be used In table 18 a selection of bit rates which have been occasionally requested is listed Bit Rate GW 001 GW 002 sysWORXX sysWORXX USB CANmodul G3 USB CANmodul G4 33 33 kBit sec bBTRO Ox6F bBTR1 0x09 dwBaudrate 0x00000000 83 33 kBit sec bBTRO Ox6F bBTR1 0x03 dwBaudrate 0x00000000 307 69 kBit sec bBTRO 0x19 bBTR1 0x01 dwBaudrate 0x00000000 333 33 kBit sec bBTRO Ox6F bBTR1 0x00 dwBaudrate 0x00000000 Table 20 SYS TEC electronic GmbH 2015 bBTRO 0x00 bBTR1 0x00 dwBaudrate 0x003B0776 bBTRO 0x00 bBTR1 0x00 dwBaudrate 0x00170776 bBTRO 0x00 bBTR1 0x00 dwBaudrate 0x000B0450 bBTRO 0x00 bBTR1 0x00 dwBaudrate 0x00050776 Examples for non listed bit rates L 487e_29 bBTRO 0x00 bBTR1 0x00 dwBaudrate 0x412F0023 bBTRO 0x00 bBTR1 0x00 dwBaudrate 0x411E000F bBTRO 0x00 bBTR1 0x00 dwBaudrate 0x40190005 bBTRO 0x00 bBTR1 0x00 dwBaudrate 0x402D0003 137 USB CANmodul 2 3 5 CAN Messages Filter Function It is possible to filter the received CAN messages The SJA1000 CAN c
25. callback function is registered with the USBCAN library by function UcaninitHwConnectControlEx and may have a different name within the application Parameter bEvent_p dwParam_p PArg_p Event which occurred USBCAN_EVENT_CONNECT 6 USBCAN_EVENT_DISCONNECT USBCAN_EVENT_FATALDISCON 8 Additional parameter If bEvent p 8 then the parameter is returned from the USB CAN Handle of the disconnected module No messages are received from this module and no messages can be sent The corresponding USB CAN Handle is invalid in other instances the parameter is 0 Additional user parameter which was handed over to function UcanlnitHwConnectControlEx as parameter pCallbackArg_p SYS TEC electronic GmbH 2015 L 487e_29 143 USB CANmodul UcanCallbackFkt Syntax void PUBLIC UcanCallbackFkt tUcanHandle UcanHandle p BYTE bEvent_p Description This callback function informs the application program if an event occurred on an initialized USB CANmodul This callback function is registered with the USBCAN library by function UcanInitHardware and may have a different name within the application Parameter UcanHandle_p USB CAN handle of the USB CANmodul where the event occurred This handle is returned with the function UcaninitHardware bEvent_p Event which occurred USBCAN_EVENT_INITHW 0 USBCAN_EVENT_INITCAN 1 USBCAN_EVENT_RECEIVE 2 USBCAN_EVENT_STATUS 3 USBCAN_EVENT_DEINITCAN 4 USBCAN_EVENT
26. can be defined for the automatic transmission of cyclic CAN messages Two modes are available for the automatic transmission The first mode is called parallel mode the second one is called sequential mode In parallel mode the cycle times of all defined CAN messages are checked within a process cycle When a cycle time of a defined CAN message is over it will be sent to the CAN bus The cycle time of a defined CAN message relates to the previous transmission of the same CAN message refer to Figure 19 CAN message 1 CAN message 2 cycle time 1 cycle time 2 Figure 19 Example for parallel mode with two defined CAN messages In sequential mode the defined CAN messages are considered as a list of CAN messages which should be sent sequentially to the CAN bus The cycle time of a defined CAN message relates to the transmission of the previously defined CAN message refer to Figure 20 You can define a CAN message including the same CAN identifier but different data bytes more than once in sequential mode CAN message 1 CAN message 2 EF time cycle time 1 cycle time 2 Figure 20 Example of sequential mode with two defined CAN messages 106 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS Important The transmission of CAN messages by calling the function UcanWriteCanMsg or UcanWriteCanMsgEx can be influenced by the automatic transmission of cyclic CAN messages When the CAN bu
27. can find a solution for your problem To activate the feature please open USB CANmodul Control from the control panel At the tab sheet Debug you will find the following window USB CANmodul Control C SYS TEC electronic GmbH Hardware Versions Debug Update g List of debug information of USBCAN32 dll meaning r r r r Cl Enable Debug LOG Levet 5 hex keo Figure 10 Debug settings in USB CANmodul Control Enable the feature by ticking the box Enable Debug In the list above you can activate different debug information that should be added to the debug log file Click to Browse for choosing the folder in which the debug log file should be stored to The default setting is the Documents folder Apply the new settings and close USB CANmodul Control Start your application using an USB CANmodul and wait until the problem will occur After this close your application Afterwards you will find a file named USBCAN_XXXXXXXX_YYYYYY_ZZZ LOG XXXXXXXX represents the creation date of the log file in format YYYYMMDD year month day and YYYYYY stands for the creation time in format HHMMSS hour minute second ZZZ is the name of the application executed SYS TEC electronic GmbH 2015 L 487e_29 25 USB CANmodul Note Enabling this feature decreases the performance of the software because API functions have to execute much more code to generate debug outputs It limits the
28. channel which is to be initialized USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 plnitCanParam_p Pointer a structure containing the initialization data Structure tUcaninitCanParam is described with function UcaninitCanEx Description Initializes the specified CAN channel of an USB CANmodul For GW 001 and GW 002 only CAN channel 0 can be initialized Use this function alternatively for function UcaninitCanEx Return value Error codes of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_RESOURCE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHW USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e_29 71 USB CANmodul UcanSetTxTimeout Syntax UCANRET PUBLIC UcanSetTxTimeout tUcanHandle UcanHandle p BYTE bChannel p DWORD dwIxTimeout_p Usability CAN_INIT since version 3 10 only for multi channel modules Description Is this function called with a timeout value bigger than 0 milliseconds then firmware controls all transmit CAN messages by this timeout If a CAN message cannot be sent during this timeout then firmware changes to a special state whereas all further transmit CAN messages for the specified channel will be deleted automatically At each deleted transmit CAN message firmware sets the new CAN driver state USB
29. channel 1 Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHW 88 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS UcanSetBaudrate Syntax UCANRET PUBLIC UcanSetBaudrate tUcanHandle UcanHandle p BARE bBTRO p BYTE bBTR1 JS Usability CAN_INIT Description Changes the baud rate configuration of the USB CANmodul Parameter UcanHandle_p USB CAN handle received with the function Ucan nitHardware or UcanInitHardwareEx bBTRO _p Baud rate register 0 refer to section 2 3 4 bBTR1_p Baud rate register 1 refer to section 2 3 4 Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD _ SYS TEC electronic GmbH 2015 L 487e 29 89 USB CANmodul UcanSetBaudrateEx Syntax UCANRET PUBLIC UcanSetBaudrateEx tUcanHandle UcanHandle p BYTE bChannel p BYTE bBTRO p ER bBTR1 p DWORD dwBaudrate p Usability CAN_INIT version 3 00 and higher Description Changes the baud rate configuration of a specific CAN channel of the USB CANmodul This function may be used alternatively for function UcanSetBaudrate Parameter
30. function of this USB CANmodul This value can be NULL The callback function will not be called if corresponding events appear This address can also be same as one that is already used from other USB CANmoduls because the callback function contains the associated USB CAN Handle pCallbackArg_p User specific parameter that is passed to the callback function as well The callback function must have the following format see section 2 3 7 void PUBLIC UcanCallbackFktEx tUcanHandle UcanHandle p DWORD bEvent p BYTE bChannel Sy VOGA pArg p SYS TEC electronic GmbH 2015 L 487e 29 63 USB CANmodul Return value Error codes of the function 64 USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_HWINUSE USBCAN_ERR_ILLHW USBCAN_ERR_MAXMODULES USBCAN_ERR_RESOURCE USBCAN_ERR_ILLVERSION USBCAN_ERR_ILLPARAM USBCAN_ERR_IOFAILED USBCAN_ERR_BUSY USBCAN_ERR_TIMEOUT USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS UcanDeinitHardware Syntax UCANRET PUBLIC UcanDeinitHardware tUcanHandle UcanHandle p Usability HW_INIT CAN_INIT Description Shuts down an initialized USB CANmodul that was initialized with UcaninitHardware or UcanInitHardwareEx The software returns to the state DLL_INIT After the function call the USB CAN handle is not valid That means execution of the valid functions s
31. mode of transmission iss et and the sending of cyclic CAN messages is initiated and stopped Additionally single CAN messages from the prior defined list can be locked Parameter bChannel_p CAN Channel USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 dwFlags_p Bit oriented flags which can be used for setting the mode starting resp Stopping the sending and locking single CAN messages ref Table 18 The flags caqn be combined Return Value Error Code of Function USBCAN_SUCCESSFUL USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHANDLE USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHW USBCAN_ERR_ILLHWTYPE USBCAN_ERR_ILLCHANNEL USBCAN_ERR_CANNOTINIT USBCAN_ERRCMD _ 176 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS 2 4 1 3 Static Help Methods of Class USBcanServers GetCanStatusMessage Syntax C public static String USBcanServer GetCanStatusMessage short wCanStatus p Syntax Visual Basic Public Shared Function USBcanServer GetCanStatusMessage _ ByVal wCanStatus p As Short As String Usability CAN_INIT as of Version 3 01 and higher Description Displays the CAN status as string If several bits are set in CAN status code respective status strings are separated by commas Parameter wCanStatus_p CAN Status Code ref USBCAN API Function UcanGetStatus Return Value String with respective CAN Status SYS TEC electronic GmbH 2015 L 487e_29 177 USB C
32. supply SYS TEC electronic GmbH 2015 L 487e_29 33 USB CANmodul 1 6 Termination resistor for CAN bus Please note that there always has to be connected two termination resistors with value 120 Ohms if you are using an USB CANmodul with a high speed CAN transceiver These has to be connected to both ends of the CAN bus CAN_H 7 CAN Bus 120 Ohm ue CAN L es termination bus begin resistor at 2 bus end Figure 15 termination resistors on CAN bus Note When using a special version of the device featuring a low speed CAN transceiver e g TJA1054 etc no terminating resistor must be used because it is already integrated in the device On USB CANmodul2 USB CANmodul8 USB CANmodul16 and Multiport CAN to USB a termination resistor with 120 Ohms is already build in for each CAN channel You can enable or disable it by closing a jumper USB CANmodul2 or by switching a switch on front panel USB CANmodul8 USB CANmodul16 and Multiport CAN to USB The default state of the termination resistors is disabled If you decide to enable the termination resistor change the appropriate switch to ON or close the appropriate jumper refer to Figure 12 JP200 for CAN channel 0 JP300 for CAN channel 1 The current state of the termination resistor can be indirectly read back by software only on USB CANmodul by calling function UcanReadCanPort or by showing in Control Panel Application USB CANmodul Control refer to
33. the function UcaninitHardware or UcanInitHardwareEx the software changes into the state HW_INIT Functions like UcanReadCanMsg or UcanWriteCanMsg return this error message while in HW_INIT state With the function UcaninitCan the software changes into CAN_INIT state In this state it is possible to read and transmit CAN messages SYS TEC electronic GmbH 2015 L 487e 29 123 USB CANmodul USBCAN_ERR_DISCONNECT Value Ox0E Description This error code occurs if a function from USBCAN library was called for an USB CANmodul that was plugged off from the computer recently USBCAN_ERR_NOHWCLASS Value Ox0F Description This error code is deprecated and is not used any more USBCAN_ERR_ILLCHANNEL Value 0x10 Description This error code is returned if an extended function of the USBCAN library was called with parameter bChannel_p USBCAN_CHANNEL_CH1 but USB CANmodul GW 001 GW 002 or USB CANmodul1 was used USBCAN_ERR_ILLHWTYPE Value 0x12 Description This error code occurs if an extended function of the USBCAN library was called for a Hardware which does not support the feature USBCAN_ERRCMD_NOTEQU Value 0x40 Description This error code occurs during communication between the PC and anUSB CANmodul The PC sends a command to the USB CANmodul then the module executes the command and returns a response to the PC This error message returns if the answer does not correspond to the command USBCAN
34. to receive CAN messages Return with the library function UcanDeinitCan into the state HW_INIT and with the library function UcanDeinitHardware into the state DLL_INIT It is possible to close the application program only after this sequence is completed SYS TEC electronic GmbH 2015 L 487e 29 45 USB CANmodul Note Make sure to return to the state DLL_INIT before closing the application program DLL loaded ix UcanDeinitHardware UcaninitHardware yd UcanDeinitCan R M UcaninitCan DLL unloaded Figure 18 Software State Diagram The number of functions differs in different software states For example the function UcanWriteCanMsg causes an error at the state DLL_INIT Table 12 shows the different functions within each state If multiple USB CANmoduls are used in one application these states have to be considered for each USB CANmodul that is used If the first USB CANmodul is in the state CAN_INIT the second one can still be in the DLL_INIT state 46 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS State Functions obsolete new sysWORXX G3 sysWORXX G4 GW 001 GW 002 multi single multi single channel channel channel channel DLL_INIT UcanSetDebugMode X x x xX x x UcanGetVersion X x x x x x UcanGetVersionEx X x x x x xX UcanlnitHwConnectControl X x x x x xX Ucanin
35. with all sysWORXX modules 140 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS 2 3 6 Using multiple CAN channels The USB CANmodul2 3204002 3204003 3204007 has 2 CAN channels and both the Multiport CAN to USB 3004006 and USB CANmodul16 have 16 CAN channels which are divided into 8 logical devices with 2 channels each In other words each logical device provides 2 CAN channels which need to get initialized In order to use all 16 channels each logical device has to get initialized with function UcaninitHardware and or UcanInitHardwareEx Furthermore both CAN channels of each logical device have to be initialized by function UcaninitCanEx2 The USB CANmodul8 behaves like USB CANmodul16 but includes only 4 logical devices and 8 CAN channels USB CANmodul2 has only one logical device and 2 CAN channels There are 3 constants to select a CAN channel Constant Value Meaning USBCAN CHANNEL CHO 0 first CAN channel USBCAN CHANNEL _CH1 1 second CAN channel USBCAN CHANNEL ANY 255 Any CAN channel USBCAN CHANNEL CAN 0 first CAN channel USBCAN CHANNEL_CAN2 1 second CAN channel Table 21 Constants for CAN channel selection Constant USBCAN_CHANNEL_ANY can only be used with function UcanReadCanMsgEx and or UcanGetMsgPending For the function UcanReadCanMsgEx it indicates that the function shall examine from which CAN channel the next CAN message is If this function re
36. with the function Ucan nitHardware or UcanInitHardwareEx CAN channel to read data from USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 Address pointing to a variable that contains the read input value following the successful return of this function see Table 19 Address pointing to a variable that contains the last written output value using UcanWriteCanPort or UcanWRiteCanPortEx following the successful return of this function This parameter may be NULL USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLPARAM USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e 29 115 USB CANmodul 2 3 2 4 Functions for the Expansion Port The following functions can only be used with the GW 002 XXX Multiport CAN to USB 3004006 and USB CANmodul2 3204002 3204003 They are an expansion for the use of the USB CANmodul with the expansion port If these functions are used with the GW 001 then the error code USBCAN_ERRCMD_ILLCMD will be returned In order to use these functions the file USBCANUP H must be included in addition to the USBCAN32 H header file Note These functions are also applicable to for USB CANmodul1 But as the USB CANmodul1 does not feature an Expansion Port these functions are ignored and the functions return with error
37. 0kBit USBCAN_BAUDEX_500kBit USBCAN_BAUDEX_250kBit USBCAN_BAUDEX_125kBit USBCAN_BAUDEX_100kBit USBCAN_BAUDEX_5OkBit USBCAN_BAUDEX_20kBit USBCAN_BAUDEX_10kBit 0x00020354 0x00030254 0x00050354 0x000B0354 0x00170354 0x00171466 0x002F 1466 0x00771466 0x80771466 CAN baud rate 1 MBit sec CAN baud rate 800 kBit sec CAN baud rate 500 kBit sec CAN baud rate 250 kBit sec CAN baud rate 125 kBit sec CAN baud rate 100 kBit sec CAN baud rate 50 kBit sec CAN baud rate 20 kBit sec CAN baud rate 10 kBit sec The following values have a sample point between 85 and 90 USBCAN_BAUDEX_SP2_1MBit USBCAN_BAUDEX_SP2_800kBit USBCAN_BAUDEX_SP2_500kBit USBCAN_BAUDEX_SP2_250kBit USBCAN_BAUDEX_SP2_125kBit USBCAN_BAUDEX_SP2_100kBit USBCAN_BAUDEX_SP2_50kBit USBCAN_BAUDEX_SP2_20kBit USBCAN_BAUDEX_SP2_10kBit 130 0x0002074 1 0x00030731 0x00050741 Ox000B0741 0x00170741 0x001D1741 0x003B1741 0x00771772 0x80771772 SYS TEC electronic GmbH 2015 CAN Baudrate 1 MBit sec CAN Baudrate 800 kBit sec CAN Baudrate 500 kBit sec CAN Baudrate 250 kBit sec CAN Baudrate 125 kBit sec CAN Baudrate 100 kBit sec CAN Baudrate 50 kBit sec CAN Baudrate 20 kBit sec CAN Baudrate 10 kBit sec L 487e_29 Configuration of baud rates other than the values given above is possible The register structure for extended baud rate configuration is given below Software Support for Windows OS
38. 0x01 The CAN interface is initialized successfully Parameter bChannel_p returns the CAN channel that was initialized USBGAN EVENT_RECEIVE iii 0x02 A CAN message is received Parameter bChannel_p returns the CAN channel that was received last by the hardware USBCAN EVENT STATUS nar a age te ne DR M nie 0x03 The error status at the USB CANmodul has changed Parameter bChannel_p returns the CAN channel which CAN error state has been changed USBCAN EVENT _DEINITOCAN ccccccseeessecccccccceccececaceeeeeceecececeeecaeaeueneeeeceeeeeeeeeneaea 0x04 The CAN interface is shut down Parameter bChannel_p returns the CAN channel that is being shut down USBCAN_EVENT_DEINITHW icnn a n a a a a 0x05 The USB CANmodul is shut down Parameter bChannel_p has no meaning here USBCAN_EVENT_CONNECT iii 0x06 A new USB CANmodul is connected Parameter dwParam_p has no meaning here USBCAN_EVENT_DISCONNECT sieurs 0x07 An USB CANmodul is disconnected Parameter dwParam_p has no meaning here USBCAN_EVENT_FATALDISCON 0x08 An USB CANmodul in either HW_INIT or CAN_INIT state is disconnected from the computer Data loss is possible The parameter dwParam p contains the USB CAN handle of the disconnected module The handle can no longer be used Note The callback functions should not call the functions of the USBCAN library directly This can lead to undesired results The best method for using the callback functions is to wait for an ev
39. 23 ye ce USBCAN_ERR_HWINUSE 121 Hee USBCAN_ERR_ILLCHANNEL 124 UcanInitCanEx USBCAN_ERR_ILLHANDLE 122 UcaninitCanEx2 USBCAN_ERR_ILLHW 122 UcaninitHardware USBCAN_ERR_ILLHWTYPE 124 UcaninitHardwareEx USBCAN_ERR_ILLPARAM 122 UcaninitHardwareEx2 USBCAN ERR ILLVERSION 122 UcaninitHwConnectControl USBCAN ERR IOFAILED 123 UcaninitHwConnectControlEx USBCAN_ERR_MAXINSTANCES 123 UcanReadeanMsg UcanReadCanMsgEx USBCAN ERR MAXMODULES 121 UcanReadCanPort USBCAN_ERR_NOHWCLASS 124 UcanReadCanPortEx USBCAN_ERR_RESOURCE 121 UcanReadCyclicCanMsg USBCAN_ERR_TIMEOUT 123 UcanReadUserPort USBCAN_ERRCMD_ALREADYINIT 125 UcanReadUserPortEx USBCAN_ERRCMD_EEPROM 125 UcanResetCan USBCAN_ERRCMD_ILLBDR 125 132 fees USBCAN_ERRCMD_ILLCMD 111 116 125 UcanSetAcceptanceEx USBCAN_ERRCMD_ILLIDX 126 UcanSetBaudrate USBCAN_ERRCMD_ILLSUBCMD 125 UcanSetBaudrateEx USBCAN_ERRCMD_NOTEQU 124 UcanSetDebugMode USBCAN_ERRCMD_NOTINIT 125 UcanSetDeviceNr USBCAN_ERRCMD_REGTST 124 UcanSetTxTimeout USBCAN_ERRCMD_RUNNING 126 UcanWriteCanMsg USBCAN_SUCCESSFUL 121 UcanW riteganMsgEx USBCAN_WARN_DLL_RXOVERRUN 126 Ce USBCAN_WARN_FW_RXOVERRUN 127 UcanWriteUserPort USBCAN_WARN_FW_TXOVERRUN 127 USBCAN_WARN_NODATA 126 Funktion USBCAN_WARN_NULL_PTR 127 UcanDotNET DLL USBCAN_WARN_SYS_RXOVERRUN 126 Checkls_G3 USBCAN_WARN_TXLIMIT 127 Checkls_G4 Checkls_sysWORXX Error Codes 121 CheckSupportCyclicMsg CheckSupportRbCanPort Expansion Port 31 116 118 119 120 CheckSupportRbUserPort CheckSupportTermR
40. 29 Software Support for Windows OS Constant Value Meaning USBCAN_ CYCLE FLAG START 0x80000000 When this flag is set the automatic transmission will be started otherwise it will be stopped FLAG _ SEQUMODE 0x40000000 When this flag is set the sequential mode is processed otherwise the parallel mode is processed FLAG _NOECHO 0x00010000 When this flag is set the sent cyclic CAN messages are not received back using transmit echo FLAG LOCK 0 until 0x00000001 When same of these flags are set _ FLAG LOCK 15 0x00008000 the appropriate CAN message from the set is not sent to the CAN bus locked state Table 18 Constants for the flags parameter in function UcanEnableCyclicCanMsg 2 3 2 3 Functions for the CAN Port The following functions can only be used with the GW 002 XXX Multiport CAN to USB and USB CANmodul2 not applicable for GW 001 They are an expansion for using the USB CANmodul with a low speed CAN transceiver e g GW 002 010 GW 002 020 GW 002 030 If these functions are used with the GW 001 variant then the error code USBCAN_ERRCMD_ILLCMD will be returned Use of these functions with the GW 002 82C251 high speed CAN transceiver or USB CANmodul1 has no effect However no error message will be returned either In order to be able to use these functions the header file USBCANLS H must be included in addition to the USBCAN32 H header file SY
41. 4 ConnectEvent 191 UCAN_CANPORT_ERR 114 DeinitCanEvent 190 UCAN_CANPORT_STB 114 DeinitHwEvent 191 UCAN_CANPORT_TRM 114 DisconnectEvent 191 USBCAN_BAUDEX_USE_BTRO1 132 eco Ue USBCAN_CHANNEL_ANY 141 InitHwEvent 187 USBCAN CHANNEL CAN 141 eistisEvent jes USBCAN_CHANNEL_CHO 141 USBCAN library USBCAN CHANNEL _CH1 141 USBCAN EVENT CONNECT 146 USBCAN_CYCLIC_FLAG LOCK XX 111 USBCAN_EVENT_DEINITCAN 146 USBCAN_CYCLIC_FLAG_NOECHO 111 USBCAN_EVENT_DEINITHW 146 USBCAN_CYCLIC_FLAG_SEQUMODE 111 USBCAN_EVENT_DISCONNECT 146 USBCAN_CYCLIC_FLAG_START 111 USBCAN_EVENT_FATALDISCON 146 USBCAN MSG FF ECHO 94 100 USBOAN EVENT INITHW 146 UPOAN MSG EEE gt U Pl _FF USBCAN_EVENT_ RECEIVE 146 DSBCANMSG_FE AIR 94 USBCAN_EVENT_STATUS 146 USBCAN_MSG_FF_STD 94 J T USBCAN_PENDING_FLAG_RX_DLL 103 callback function54 55 59 61 86 127 USBCAN_PENDING_FLAG_RX_FW 103 141 146 USBCAN_PENDING_FLAG_TX_DLL 103 USBCAN_PENDING_FLAG_TX_FW 103 Callback Function USBCAN_RESET_ALL 74 USBCAN library USBCAN_RESET_FIRMWARE 75 UcanCallbackFkt 144 USBCAN_RESET_NO_CANCTRL 74 UcanCallbackFktEx 145 USBCAN_RESET_NO_RXBUFFER_CH 75 UcanConnectControlFkt 142 USBCAN RESET NO RXBUFFER DLL 75 ou BE USBCAN_RESET NO RXBUFFER FW 75 USBCAN_RESET_NO_RXBUFFER_SYS 75 CAN Messages Filter 138 USBCAN_RESET_NO_RXCOUNTER 74 USBCAN_RESET_NO_STATUS 74 CAN port 30 42 112 113 114 USBCAN_RESET_NO_TXBUFFER_CH 74 USBCAN_RESET_NO_TXBUFFER_DLL 75 CAN Supply Voltage 29 USBCAN_RESET_NO_TXBUFFER_FW 75 USBCAN_RESET_NO
42. 7e_29 Software Support for Windows OS UcanGetMsgCountinfoEx Syntax UCANRET PUBLIC UcanGetMsgCountInfoEx tUcanHandle UcanHandle p BYTE bChannel p tUcanMsgCountInfo pMsgCountInfo p Usability CAN INIT version 2 16 and higher Description Reads the counters for transmitted and received CAN messages of a specific CAN channel from the device Parameter UcanHandle_p USB CAN handle that was returned by UcaninitHardware or UcanInitHardwareEx bChannel_p CAN channel to read the counters from USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 pMsgCountinfo_p Pointer to a structure of type tUcanMsgCountinfo where the counters are to be stored to Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLPARAM USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD Structure tUcanMsgCountinfo is described with function UcanGetMsgCountinfo SYS TEC electronic GmbH 2015 L 487e 29 85 USB CANmodul UcanGetStatus Syntax UCANRET PUBLIC UcanGetStatus tUcanHandle UcanHandle p ESCATUSS ic LUGE Pstatus Pp Usability HW_INIT CAN_INIT Description This function returns the error status from the USB CANmodul If an error occurred on the USB CANmodul the red status LED starts blinking and a status message i
43. 7e_29 133 USB CANmodul 2 3 4 3 Baud Rate Configuration for Fourth Generation USB CANmodul As of driver version V5 00 a new device revision is supported Fourth Generation USB CANmodul ab rev G4 Due to discontinue of components changes had to be executed for the setting of baud rates However the software was altered in order the baud rates set above can still be used for the new device revision Should other settings still become necessary these settings must be executed as follows Due to compatibility reasons the pre defined values BTRO and BTR1 from section 2 3 4 1 can still be used for fourth generation USB CANmoduls If for BTRO and BTR1 the value USBCAN BAUD USE BTREX is being set the pre defined values of section 2 3 4 2 for the dwBaudrate can be used for fourth generation USB CANmoduls as well However the correct pre defined values for the fourth generation are as follows USBCAN_BAUDEX_G4_1MBit 0x40180001 CAN Baud rate 1 MBit s USBCAN_BAUDEX_G4_800kBit 0x401B0001 CAN Baud rate 800 kBit s USBCAN_BAUDEX_G4_500kBit 0x401C0002 CAN Baud rate 500 kBit s USBCAN_BAUDEX_G4_250kBit 0x401C0005 CAN Baud rate 250 kBit s USBCAN_BAUDEX_G4_125kBit 0x401C000B CAN Baud rate 125 kBit s USBCAN_BAUDEX_G4_100kBit 0x412F000B CAN Baud rate 100 kBit s USBCAN_BAUDEX_G4_50kBit 0x412F0017 CAN Baud rate 50 kBit s USBCAN_BAUDEX_G4_20kBit 0x412F003B CAN Baud rate 20 kBit s USBCAN_BAUDEX_G4_10kBit Ox412F0077 CAN B
44. 91 Description This warning message is returned by the function UcanWriteCanMsgEx if it was called to transmit more than one CAN message but a part of them could not be stored to the transmit buffer within USBCAN library because the buffer is full The parameter pdwCount_p includes the number of CAN messages which could be stored successfully to the transmit buffer SYS TEC electronic GmbH 2015 L 487e 29 127 USB CANmodul 2 3 4 Baud Rate Configuration 2 3 4 1 Baud Rate Configuration for GW 001 and GW 002 The baud rate configuration for USB CANmodul GW 001 and GW 002 is transferred to the function UcaninitCan and UcaninitCanEx2 as parameter bBTRO p and bBTR1 p The configuration can also be changed later by calling the function UcanSetBaudrate resp UcanSetBaudrateEx The following values are recommended USBCAN_BAUD_10kBit Ox672f CAN baud rate 10 kBit sec USBCAN_BAUD_20kBit Ox532f CAN baud rate 20 kBit sec USBCAN_BAUD_50kBit 0x472f CAN baud rate 50 kBit sec USBCAN_BAUD_100kBit 0x432f CAN baud rate 100 kBit sec USBCAN BAUD 125kBit Ox031c CAN baud rate 125 kBit sec USBCAN_BAUD_250kBit Ox011c CAN baud rate 250 kBit sec USBCAN_BAUD_500kBit Ox001c CAN baud rate 500 kBit sec USBCAN BAUD 800kBit 0x0016 CAN baud rate 800 kBit sec USBCAN_BAUD_1MBit 0x0014 CAN baud rate 1 MBit sec Example tUcanHandle UcanHandle UCANRET bRet initializes the hardware bRet UcanInitHardwar
45. AN message structure like shown in upper example 96 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS UcanReadCanMsgEx Syntax UCANRET PUBLIC UcanReadCanMsgEx tUcanHandle UcanHandle p BARS pbChannel p tCanMsgStruct pCanMsg p DWORD pdwCount_p Usability CAN_INIT version 3 00 and higher Description Reads a CAN message from the buffer of a specific CAN channel If the buffer contains no CAN messages this function returns a warning If a buffer overrun occurred this function returns a valid CAN message and a warning This function may be used alternatively for function UcanReadCanMsg Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx bChannel_p CAN channel to read data from USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 If USBCAN_CHANNEL_ANY is given the function will write the number of the CAN channel that received CAN messages to this parameter pCanMsg_p Address to a CAN message structure This address must not be NULL pdwCount_p Address to a variable that specifies the maximum number of CAN messages to be read This function writes the actual number of CAN messages that were read from the device to this variable If this parameter is set to NULL only one CAN message is read from the device The structure tCanMsgStruct is described in function UcanReadCanMsg SYS T
46. ANmodul GetBaudrateMessage Syntax C public static String USBcanServer GetBaudrateMessage byte bBTRO p byte bBTRI p public static String USBcanServer GetBaudrateMessage short wBTR_p Syntax Visual Basic Public Shared Function USBcanServer GetBaudrateMessage _ ByVal bBTRO p As Byte ByVal bBTR1 p As Byte As String Public Shared Function USBcanServer GetBaudrateMessage _ ByVal wBTR p As Short As String Usability CAN_INIT as of Version 3 01 and higher Description Displays the baud rate as string for stated BTR registry value This function can be applied to the baud rate values for the older USB CANmoduls GW 001 und GW 002 The sysWORXX USB CANmoduls are compatible with the known baud rate values described in section 2 3 4 Parameter bBTRO p Baud Rate Registry 0 BTRO bBTR1_p Baud Rate Registry 1 BTR1 wBTR _p Combined Baud Rate Registry Bit15 to Bit8 BTRO Bit7 to Bito BTR1 Return Value String with respective CAN Baud Rate 178 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS GetBaudrateExMessage Syntax C public static String USBcanServer GetBaudrateExMessage int dwBTR_p Syntax Visual Basic Public Shared Function USBcanServer GetBaudrateExMessage _ By Weill CHAR AS Integer AS Sicie sine Usability CAN INIT as of Version 3 01 and higher Description Displays the baud rate as string fort he indicated BTR registry value This
47. Arg p Usability DLL_INIT HW_INIT CAN_INIT version 3 00 and above Description Initializes the supervision for recently connected USB CANmoduls If a new module is connected to the PC the callback function that is indicated in the parameter will be called This callback function is also called if a module is disconnected from the PC Unlike function UcaninitHwConnectControl this function has an additional parameter which is also passed to the callback function This parameter can be used to handle user specific information such as the used CAN instance for example Attention This function must not be used simultaneously with function UcaninitHwConnectControl within the same application Parameter foConnectControlFkt_p Address to the callback function that has to be called if a new USB CANmodul is connected or disconnected This address must not be NULL pCallbackArg_p User specific parameter that is passed to the callback function as well The callback function must have the following format see section 2 3 7 void PUBLIC UcanConnectControlFktEx DWORD dwEvent p DWORD dwParam p VOILE pArg p Return Value Error code of the function USBCAN_SUCCESSFUL USBCAN_WARN_NULL_PTR SYS TEC electronic GmbH 2015 L 487e 29 55 USB CANmodul UcanDeinitHwConnectControl Syntax UCANRET PUBLIC UcanDeinitHwConnectControl void Usability DLL_INIT HW_INIT CAN_INI
48. BCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD _ 78 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS UcanGetHardwarelnfo Syntax UCANRET PUBLIC UcanGetHardwarelnfo tUcanHandle UcanHandle p tUcanHardwareInfo pHwinfo p Usability HW_INIT CAN_INIT Description This function returns the hardware information of an USB CANmodul This function is especially useful if an USB CANmodul has been initialized with the device number USBCAN_ANY_MODULE Afterwards the hardware information contains the device number of the initialized USB CANmodul Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx pHwinfo_p Address to the hardware information structure see description below Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHW typedef struct BYTE m bDeviceNr Device number tUcanHandle m UcanHandle USB CAN handle DWORD m dwReserved reserved BYTE m_bBTRO Baud rate register 0 BYTE m_bBTRI Baud rate register 1 BYTE m_bOCR Output control register DWORD m dwAMR Acceptance mask register DWORD m_dwACR Acceptance code register BYTE m_bMode CAN controller mode see tUcanMode DWORD m_dwSerialNr Serial number of the USB CANmoduls tUcanHardwarelInfo S
49. Boolean Ex p AS ByVal pHwInfo UcanDotNE ByRef fDoInit T USBcanServer tUcanHardwareInfoEx _ ialize As Boolean ByRef fTryNex E D As Boolean SYS TEC electronic GmbH 2015 L 487e 29 155 USB CANmodul Parameter dwindex_p flsUsed_p pHwinfoEx_p fDolInitialize_p fTryNext_p Ongoing index which is incremented by the value 1 for each found USB CANmodul The value is O for the first call of this callback function This flag is TRUE when the found USB CANmodul is currently exclusively used by another application This parameter only can be TRUE if the function UcanEnumerateHardware was called with the parameter fEnumUsedDevs_p TRUE An USB CANmodul cannot be used by the own application when it is exclusively used by another application Pointer to an instance of the structure of type tUcanHardwarelnfoEx holding the hardware information of the found USB CANmodul see page 81 The callback handler has to overhand to this parameter whether the found USB CANmodul has to be initialized by the method EnumerateHardware The callback handler has to overhand to this parameter whether a further UBS CANmodul has to be scanned or not Example 1 VB NET Dim FoundModules As UcanDotNET USBcanServer find all USB CANmoduls which are not used by other applikationens FoundModules UcanDotNET USBcanServer EnumerateHardware _ 0 amp HFF _ no limits for the device number 0 amp H
50. C electronic GmbH 2015 L 487e_29 Software Support for Windows OS 2 3 Description of the USBCAN library The USBCAN library is a function library for application programs At Windows 2000 XP or higher it is a Dynamic Linked Library DLL with the file name USBCAN32 DLL It serves as an interface between the system driver layer and an application program The USBCAN Library for the USB CANmodul enables easy access to the USB CAN system driver functions It administers the opened USB CANmodul and translates the USB data into CAN messages Add the file USBCAN32 LIB to your project for linking the USBCAN32 DLL to your own Microsoft Visual C C project Starting the application program automatically loads the DLL If the USBCAN32 LIB is not linked to the project or you are using another environment e g Borland C Builder load the DLL manually with the Windows function LoadLibrary and add the library functions with the function GetProcAdress refer to the demo application DemoGW 006 There was a NET wrapper DLL implemented for Microsoft NET applications described in section 2 4 The PUBLIC calling convention of the DLL functions provides a standardized interface to the user This standard interface ensures that users of other programming languages than C C Pascal etc are able to use these functions Within this manual the DLL is called USBCAN library because the API functions also called USBCAN API are also im
51. CAN Channel which is to be used USBCAN_CHANNEL_CHO for CAN Channel 0 USBCAN_CHANNEL_CH1 for CAN Channel 1 pwRecvdMsgCount_p pointer to variable for receive message counter pwSentMsgCount_p pointer to variable for transmit message counter Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLCMD USBCAN_WARN_NOTEQU 170 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS GetMsgPending Syntax C public byte USBcanServer GetMsgPending byte bChannel p int dwFlags p ref int pdwPendingCount p Syntax Visual Basic Public Function USBcanServer GetMsgPending _ ByVal bChannel p As Byte _ ByVal dwFlags p As Integer _ ByRef pdwPendingCount p As Integer As Byte Usability CAN_INIT ab Version 3 06 ab sysWORXX Description This method calculates the number of CAN messages that remain in the buffers of single software levels The parameter dwFlags_p indicates wich buffers should be tested Should several buffers have tob e checked then the number of received CAN messages are added to each other and written to the variable referenced by pdwPendingCount_p Parameter bChannel_p CAN CHANNEL USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 USBCAN_CHANNEL_ANY for both channels dwFlags_p Indicates which buffers should be tested re
52. CAN_CANERR_TXMSGLOST When the CAN message could be sent later then firmware leaves this special state This feature is to prevent that transmit CAN messages of a channel blocks transmit CAN messages of the other channel caused by not connected remote CAN device or any physical problems on CAN bus Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx bChannel_p CAN channel for setting the timeout USBCAN_CHANNEL_CHO for channel 0 USBCAN_CHANNEL_CH1 for channel 1 dwTxTimeout_p Transmission Timeout in milliseconds The value 0 switches off the timeout control Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD _ 72 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS UcanResetCan Syntax UCANRET PUBLIC UcanResetCan tUcanHandle UcanHandle p Usability HW_INIT CAN_INIT Description Resets the CAN controller in the USB CANmodul and erases the CAN message buffer This function needs to be called if a BUSOFF event occurred Starting at version 2 17 a CAN status error readable via UcanGetStatus is also cleared Parameter UcanHandle_p USB CAN handle received with the function UcaninitH
53. CANmodul Parameter UcanHandle_p dwAMR_p dwACR _p Return value Error code of the function USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx Acceptance Mask Register see section 2 3 5 Acceptance Code Register see section 2 3 5 USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD _ 92 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS UcanSetAcceptanceEx Syntax UCANRET PUBLIC UcanSetAcceptanceEx tUcanHandle UcanHandle p BYTE bChannel p DWORD dwAMR p DWORD dwACR p Usability CAN INIT version 3 00 and higher Description Changes the acceptance Mask Register of a specific CAN channel of the USB CANmodul This function may be used alternatively for function UcanSetAcceptance Parameter UcanHandle_p USB CAN handle received with the function Ucan nitHardware or UcanInitHardwareEx bChannel_p CAN channel that is to be changed USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 dwAMR_p Acceptance Mask Register see section 2 3 5 dwACR_p Acceptance Code Register see section 2 3 5 Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHAND
54. EC electronic GmbH 2015 L 487e 29 97 USB CANmodul Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_WARN_NODATA USBCAN_WARN_SYS_RXOVERRUN USBCAN_WARN_DLL_RXOVERRUN USBCAN_WARN_FW_RXOVERRUN Example t ca tCab UCAN BYTE nHandle UcanHandle MsgStruct RxCanMsg 16 RET bRet bChannel DWORD dwCount whil e 1 read up to 16 CAN messages bChannel USBCAN CHANNEL ANY dwCount sizeof RxCanMsg sizeof tCabMsgStruct bRet UcanReadCanMsgEx UcanHandle amp bChannel amp RxCanMsg amp dwCount No error print CAN message if USBCAN CHECK VALID RXMSG bRet PrintCanMessages amp RxCanMsg 0 dwCount if USBCAN CHECK WARNING bRet PrintWarning bRet No warning Print error else if USBCAN CHECK WARNING bRet PrintError bRet break else break 98 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS Note In order to avoid receive buffer overflows it is recommended to call function UcanReadCanMsg cyclically e g in a loop as long as a valid CAN message was received A valid CAN message was read even if a warning was returned except USBCAN_WARN_NODATA You can use the macro USBCAN_CHECK_VALID_RXCANMSG for checkin
55. ELL 0x00000001 Checks the number of messages of receive buffer within USBCAN library FLAG RX FW 0x00000004 Checks the number of messages of receive buffer within module firmware FLAG TX DEL 0x00000010 Checks the number of messages of transmit buffer within USBCAN library FLAG_TX_FW 0x00000040 Checks the number of messages of transmit buffer within module firmware Table 17 Constants for the flags parameter in function UcanGetMsgPending SYS TEC electronic GmbH 2015 L 487e 29 103 USB CANmodul Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHANDLE USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHW USBCAN_ERR_ILLHWTYPE USBCAN_ERR_ILLCHANNEL USBCAN_ERR_CANNOTINIT USBCAN_ERRCMD _ Note After function UcanGetMsgPending returned to the application the number of the CAN messages can already be changed within the several software parts When the application calls this function too often the performance can spiral downward 104 SYS TEC electronic GmbH 2015 L 487e 29 UcanGetCanErrorCounter Syntax Software Support for Windows OS UCANRET PUBLIC UcanGetCanErrorCounter tUcanHandle BAALE DWORD DWORD Usability UcanHandle_p bChannel p pdwTxCount p pdwRxCount p CAN_INIT version 3 06 and higher only sysWORXX modules Description Returns the current error counters from CAN controller This values are direct
56. ERR Error error signal low active high level TRM Termination termination resistor high active low level Table 4 Signals available for low speed CAN port Note It is only possible to read the state of the termination resistor by software using USB CANmodul2 The signals STB and EN of low speed USB CANmoduls of 4 generation cannot be separately switched They are both interconnected at the TJA1054 The standard levels are set so that the transceivers function in normal operating mode Thus operation with the PCANview tool is possible immediately The Error signal is not evaluated Functions for setting the operating modes and for reading the Error signal are supported by the USBCAN library and are described in the section on software support refer to section 2 Please refer to the data sheet for the CAN transceiver in question when setting the operating mode The AU5790 does not have an error output An additional pin header connector in 2 54 mm pitch male or female is provided for support of additional CAN transceivers such as the B10011S Resistors with 1 KOhm are populated at pins RTL or RTH when using the TJA1054 When using the AU5790 device a 9 1 kOhm resistor at space Rt is used and a 220 pF capacitor at Cu This CAN port connector has the following pinout Signal Pin Pin Signal STB 1 2 EN ERR 3 4 SPLIT CAN_RX 5 6 CAN_TX CAN_5V 7 8 CAN_GND INH 9 10 CAN_LX CA
57. ET PUBLIC UcanInitHardwareEx tUcanHandle pUcanHandle p BYTE bDeviceNr p tCallbackFktEx fpCallbackFktEx p void pCallbackArg p Usability DLL_INIT version 3 00 and higher Description Initializes an USB CANmodul The software changes into the state HW_INIT From this point other functions as they are defined in Table 12 can be called If the function was executed successfully the function transfers an USB CAN handle to the variable oUcabHandle_p Other functions have to be called with this handle Unlike function UcaninitHardware this function has an additional parameter which is also passed to the callback function Parameter pUcanHandle_p Pointer to the variable for the USB CAN Handle This pointer may not be NULL bDeviceNr_p Device number of the USB CANmodul 0 254 The value USBCAN_ANY_MODULE 255 makes sure that the first allocated USB CANmodul is used foCallbackFkt_p Address to the callback function of this USB CANmodul This value can be NULL The callback function will not be called if corresponding events appear This address can also be same as one that is already used from other USB CANmoduls because the callback function contains the associated USB CAN Handle pCallbackArg_p User specific parameter that is passed to the callback function as well The callback function must have the following format see section 2 3 7 void PUBLIC UcanCallbackFktEx tUcanHandle UcanHandle p
58. FFFFFFF _ no limits for the serial number 0 amp HFFFFFFF no limits for the produkt code MyEnumDelegateCallback Example 2 VB NET Dim FoundModules As UcanDotNET USBcanServer find all USB CANmoduls of type USB CANmodull G3 modules which are used by other applications too FoundModules UcanDotNET USBcanServer EnumerateHardware _ UcanDotNET USBcanServer eUcanProductCode USBCAN PRODCODE PID BASIC _ UcanDotNET USBcanServer eUcanProductCode USBCAN PRODCODE PID BASIC _ MyEnumDelegateCallback _ True 156 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS Example 3 VB NET Dim FoundModules As UcanDotNET USBcanServer Dim dwSerialNr As Integer find all logical modules of type USB CANmodul116 G3 dwSerialNr 123456 lt serial number from sticker at the back FoundModules UcanDotNET USBcanServer EnumerateHardware _ 0 amp HFF _ keine Einschr nkung der Ger tenummer dwSerialNr 1000 1 dwSerialNr 1000 8 UcanDotNET USBcanServer eUcanProductCode USBCAN PRODCOD D E PID USBCAN16 UcanDotNET USBcanServer eUcanProductCode USBCAN PRODCODE P ID_USBCAN16 SYS TEC electronic GmbH 2015 L 487e_29 157 USB CANmodul InitHardware Syntax C public byte USBcanServer InitHardware byte bDevic Nr p USBCAN ANY MODULE public byte USBcanServer InitHardware int dwSerialNr p Sy
59. GW 002 with on board high speed CAN transceivers 82C251 a termination resistor of 120 Ohms at both ends of the CAN cable between CAN_L pin 2 and CAN_H pin 7 is required to ensure proper signal transmission When using a special version of the device featuring a low speed CAN transceiver e g TJA1054 etc no terminating resistor must be used because it is already integrated in the device It is necessary to use shielded cables if the CAN bus extension exceeds 3 meters SYS TEC electronic GmbH 2015 L 487e_29 17 USB CANmodul 1 1 7 Starting PCANView USBCAN The included program PCANView USBCAN is a CAN bus monitor for Windows e Start the utility program using the Windows Start button and browse to Programs gt USB CANmodul Utilities gt PCANView USBCAN It is recommended that you drag the PCANView USBCAN icon onto the desktop of your PC This enables easy start of this utility program by double clicking on the icon e The USB CANmodul settings window will appear Figure 5 Device Nr Baudrate listen only high res timer Your Partner for log tx echo Distributed Automation devices of 3rd or 4th generation BTR Ext 00020741 logical devices with two channels CAN Channel CAN Channel Cancel Dialog Box with Hardware Configuration e Select the baud rate of your CAN network in the Baudrate box and the Device Number The entry any selects the USB CANmodul that is found
60. INSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERRCMD _ 166 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS ReadCanMsg Syntax C public byte USBcanServer ReadCanMsg ref byte pbChannel p Toi ECanMsgstruct pCanMsg p Tei int jerchwCowumte 9 0 Syntax Visual Basic Public Function USBcanServer ReadCanMsg ByRef pbChannel p As Byte ByRef pCanMsgStruct_p As tCanMsgStruct Optional BRST chyYCoume gt As Integer 0 AS Byes Usability CAN_INIT version 3 01 and higher Description Reads one or more CAN messages from the buffer of the specified CAN channel Parameter pbChannel_p Pointer to a variable containing the CAN Channel to read from USBCAN_CHANNEL_CHO for CAN Channel 0 USBCAN_CHANNEL_CH1 for CAN Channel 1 If USBCAN_CHANNEL_ANY is given then this function writes the CAN channel to this variable where the message was read from pCanMsg_p Address to a CAN message structure This address must not be NULL pdwCount_p Address to a variable that specifies the maximum number of CAN messages to be read This function writes the actual number of CAN messages that were read from the device to this variable Structure tCanMsgStruct is described with function UcanReadCanMsg Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_IL
61. InfoCh0_p Pointer to information structure used for CAN channel 0 This parameter may be set to NULL pCanInfoCh1_p Pointer to information structure used for CAN channel 1 This parameter may be set to NULL Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHW typedef struct DWORD m dwSize number of Bytes of this structure tUcanHandle m UcanHandle USB CAN Handle BYTE m bDeviceNr device number DWORD m dwSerialNr serial number DWORD m_dwFwVersionEx Firmware Version DWORD m_dwReserved reserved DWORD m dwProductCode Hardware Type s Table 15 tUcanHardwareInfoEx SYS TEC electronic GmbH 2015 L 487e_29 81 USB CANmodul typedef struct DWORD m dwSize size of this structure in bytes BYTE m_bMode CAN mode see tUcanMode BYTE m bBTRO Bus Timing Register 0 BYTE m bBTR1 Bus Timing Register 1 BYTE m bOCR Output Control Register DWORD m_dwAMR Acceptance Mask Register DWORD m_dwACR Acceptance Code Register DWORD m dwBaudrate Baudrate Register for Multport USB CANmodull und USB CANmodul2 BOOL m fCanIsInit is TRUE when CAN channel was initialised WORD m_wCanStatus last CAN state see UcanGetStatus tUcanChannelInfo The 32 Bit value in m_dwProductCode of structure tUcanHardwarelnfoEx specifies the Hardware Type
62. Introduction References to Hardware and Software changes In this section you will find references to new functions in the hardware and software of the USB CANmodul Software Version 4 17 Bugfix The old window position of PCANView USBCAN has also been set on a second monitor if this second monitor has not been plugged Bugfix Context Menu Change parameters within hardware tab sheet of UBS CANmodul Control did not function Bugfix In tab sheet Debug of USB CANmodul Control the browse dialogue could not be used to enter a directory for the Debug Log file under Windows 7 Bugfix Under Windows XP the USB CANmodul Control could not be initiated from the system control Notice execute as was displayed Bugfix If an application crashed e g a protection fault which initiated an USB CANmodul this USB CANmodul could not be re initialized by any application on the computer New feature LabView Demo for LabView 2011 Software Version 4 18 Bugfix An access violation appeared in USBCAN32 DLL resp USBCAN64 DLL if an application was initiated with a Windows profile without administrator rights Bugfix The bus off handling was changed for all sysWORXX USB CANmoduls Bugfix Das automatische Firmware Update der sysWORXX USB CANmodul funktionierte in V4 17 nicht Driver tested under Windows 8 32 Bit und 64 Bit and under Windows Server 2012 64 Bit No problems discovered Software Version 5 00 New featur
63. Known issues 5 Known issues Using VMware under Windows OS as host there can cause problems when connecting the USB CANmodul to the guest OS Until now we have detected problems on Renesas USB 3 0 ports Furthermore the establishing of the connect can fail when using the USB CANnetwork driver on the host OS With USB CANmoduls of third generation USB CANmodul1 until revision 4 USB CANmodul2 until revision 2 USB CANmodul8 and USB CANmodul16 a CAN message cannot be aborted which was set to the CAN controller for sending as long as there is no other CAN device which sends the acknowledge to the CAN bus The only way to abort the transmission is to disconnect the module from powers supply This problem is not present on the newer USB CANmoduls of fourth generation With this modules the transmission can be aborted by calling the API function UcanResetCan or UcanResetCanEx with deleted flag USBCAN_RESET_NO_CANCTRL SYS TEC electronic GmbH 2015 L 487e_29 199 USB CANmodul 6 Index Acceptance Filter 138 Constant kUcanModeListenOnly 70 ACR 138 kUcanModeNormal 70 kUcanModeTxEcho 70 AMR 138 kVerTypeCpl 51 API Functions 48 kVerTypeNetDrv 51 kVerTypeSysDrv 51 Baud Rate 3 kVerTypeSysL2 51 kVerTypeSysL3 51 Baud Rate Configuration 128 kVerTypeSysL4 51 A kVerTypeSysL5 51 Borland C Builder 45 kVerTypeSysLd 51 Callback Event kVerTypeUserDIl 51 UcanDotNET DLL kVerTypeUserLib 51 CanMsgReceivedEvent 187 UCAN_CANPORT_EN 11
64. L see section 2 3 3 All standard single instance functions are applicable for Multiport CAN to USB 3004006 as well but do not provide the possibility to access other CAN channels than CAN 0 If channel other than CANO is used the function returns with error code USBCAN_ERR_ILLCHANNEL see section 2 3 3 48 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS 2 3 2 1 General functions UcanSetDebugMode Syntax BOOL PUBLIC UcanSetDebugMode DWORD dwDbgLevel p BIC pszFilePathName p DWORD dwFlags p Usability DLL_INIT HW_INIT CAN_INIT since version 3 11 Description This function enables the creation of a debug log file out of the USBCAN library If this feature has already been activated via the USB CANmodul Control the content of the old log file will be copied to the new file Further debug information will be appended to the new file Parameter dwDbgLevel_p Bit mask which enables the activation of debug information to be written into the debug log file This Bit mask has the same meaning as the LOG Level of the USB CANmodul Control and therefore is not referred to in detail pszFilePathName_p Path leading to a text based file which is written by the USBCAN library with debug information This parameter may be set to NULL In this case only the new value of parameter dwDbgLevel_p will be set dwFlags_p Additional flag parameter Value 0 will create a new debug log file If the fi
65. LE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e 29 93 USB CANmodul UcanReadCanMsg Syntax UCANRET PUBLIC UcanReadCanMsg tUcanHandle UcanHandle p tCanMsgStruct pCanMsg p Usability CAN INIT Description Reads a CAN message from the buffer If the buffer contains no CAN messages this function returns a warning If a buffer overrun occurred this function returns a valid CAN message and a warning Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx pCanMsg_p Address to a CAN message structure This address must not be NULL typedef struct DWORD m dwID CAN identifier BYTE m_bFF CAN frame format BYTE m bDLC CAN data length code BYTE m_bData 8 CAN data DWORD m dwTime Receipt time in lms or in 100s refer to Table 14 tCanMsgStruct The CAN frame format is a bit mask that specifies the format of the CAN message The following table lists all valid values Constant Value Description USBCAN MSG FF_STD 0x00 CAN2 0A message with 11 bit CAN ID USBCAN_MSG_FF_ECHO 0x20 transmit echo Is only received if mode kUcanModeTxEcho was enabled at initialization time USBCAN MSG FF_RTR 0x40 CAN Remote Frame USBCAN_MSG_FF
66. LPARAM USBCAN_WARN_NODATA USBCAN_WARN_SYS_RXOVERRUN USBCAN_WARN_DLL_RXOVERRUN SYS TEC electronic GmbH 2015 L 487e 29 167 USB CANmodul WriteCanMsg Syntax C public byte USBcanServer WriteCanMsg byte bChannel p IS ieCeimMMscSiciwere PEMS jo teft int chyCoume jo 0 2 Syntax Visual Basic Public Function USBcanServer WriteCanMsg _ ByVal pb hannel jo As Byte ByRet pCanMsgsStruct p As t anMsgstruct Optinal ByRef dwCount_p As Integer As Byte Usability CAN_INIT version 3 01 and higher Description Transmits one or more CAN messages through the specified CAN channel of the device Parameter bChannel_p CAN Channel which is to be used USBCAN_CHANNEL_CHO for CAN Channel 0 USBCAN_CHANNEL_CH1 for CAN Channel 1 pCanMsg_p Address to a CAN message structure This address must not be NULL dwCount_p After return this variable holds the number of CAN messages which was successfully stored to the transmit buffer This value may be less than the number of elements within the array of CAN messages if not all CAN messages could be stored to the transmit buffer In that case the function returns the warning USBCAN_WARN_TX_LIMIT Structure tCanMsgStruct is described with function UcanWriteCanMsg Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_ILLPARAM USBCAN_ERR_DLL_TXFULL 168 SYS TEC electronic GmbH 2015
67. LVERSION Value 0x04 Description This error message returns if the firmware version of the USB CANmodul is not compatible to the software version of the USBCAN library In this case install the USB CAN driver again USBCAN_ERR_ILLHW Value 0x05 Description This error message returns if an USB CANmodul with the device number x is not found If the function UcaninitHardware or UcaninitHardwareEx has been called with the device number USBCAN_ANY_MODULE and the error code appears it indicates that no module is connected to the PC or all connected modules are already in use USBCAN_ERR_ILLHANDLE Value 0x06 Description This error message returns if a function received an incorrect USB CAN handle The function first checks which USB CANmodul is initialized to this handle This error occurs if no module has been initialized to this handle USBCAN_ERR_ILLPARAM Value 0x07 Description This error message returns if a wrong parameter is transferred to this function For example the value NULL has been handed over to a pointer variable instead of a valid address USBCAN_ERR_BUSY 122 Value 0x08 Description This error message can occur if several threads are accessing an USB CANmodul within a single application After the other threads have finished their tasks the function may be called again SYS TEC electronic GmbH 2015 L 487e_ 29 Software Support for Windows OS USBCAN_ERR_TIMEOUT Value 0x09 Descri
68. N Library In this case an unknown sub command was called instead of a main command e g for the cyclic CAN message feature SYS TEC electronic GmbH 2015 L 487e_29 125 USB CANmodul USBCAN_ERRCMD_ILLIDX Value 0x4B Description An internal error occurred in USBCAN Library In this case an invalid index for a list was delivered to the firmware e g for the cyclic CAN message feature USBCAN_ERRCMD_RUNNING Value 0x4C Description The caller tries to define a new list of cyclic CAN messages but this feature was already started For defining a new list it is necessary to switch off the feature beforehand USBCAN_WARN_NODATA Value 0x80 Description If the function UcanReadCanMsg returns with this warning it is an indication that the receive buffer contains no CAN messages USBCAN_WARN_SYS_RXOVERRUN Value 0x81 Description If an overrun in the receive buffer on the USB CAN system driver occurred the USBCAN library is informed about this event The function UcanReadCanMsg returns this warning and a valid CAN message The warning indicates that CAN messages are lost However it does not indicate the position of the lost CAN messages USBCAN_WARN_DLL_RXOVERRUN 126 Value 0x82 Description The USBCAN library automatically requests CAN messages from the USB CANmodul and stores the messages into a buffer of the DLL If more CAN messages are received than the DLL buffer size allows this error message re
69. NRET bRet initializes the hardware bRet UcanInitHardware amp UcanHandle 0 NULL initializes the CAN interface filters 11 bit CAN messages with ID 0x300 to Ox3ff RTR unimportant bRet UcanInitCan UcanHandle HIBYTE USBCAN BAUD 1MBit LOBYTE USBCAN BAUD 1MBit USBCAN SET AMR FALSE OxOff 1 USBCAN SET ACR FALSE 0x300 0 an an Error print error if bRet USBCAN SUCCESSFUL PrintError bRet If according to example 1 the CAN controller receives a CAN message with 29 bit identifier then it is filtered with the same configuration However AMR and ACR are interpreted differently Here CAN messages with 29 bit identifiers from 0x0C000000 to OxOFFFFFFF are received too Example 2 tUcanHandle UcanHandle UCANRET bRet initializes the hardware bRet UcanInitHardware amp UcanHandle 0 NULL initializes the CAN interface filters 11 bit CAN messages with ID 0x600 to Ox67F RTR Frames unimportant bRet UcanInitCan UcanHandle HIBYTE USBCAN BAUD 1MBit LOBYTE USBCAN BAUD 1MBit USBCAN CALCULATE AMR FALSE 0x600 0x67F FALSE FALSE USBCAN CALCULATE ACR FALSE 0x600 0x67F FALSE FALSE 1j E Yes error Print error if bRet USBCAN SUCCESSFU PrintError bRet wa Filter parameters for RTR frames and the first two data bytes are ignored
70. N_HX 11 12 CANVBAT RTH 13 14 RTL Table 5 CAN Port Pin Assignment for External Transceiver on the GW 002 30 SYS TEC electronic GmbH 2015 L 487e 29 Getting Started 1 5 Expansion Port The USB CANmodul features an 8 bit port for functional expansion which can be used to add digital inputs e g push buttons and digital outputs e g LEDs to the device An additional 2 5 pin header connector in 2 54 mm pitch male or female is provided on the USB CANmodul The connector has the following pinout Signal Pin Pin _ Signal PBO 1 2 PB1 PB2 3 4 PB3 PB4 5 6 PB5 PB6 7 8 PB7 GND 9 10 Vcc Output Table 6 Expansion Port Pin Assignment on the GW 002 and USB CANmodul2 The microcontroller s port pins are connected directly to the expansion port Make sure that external circuitry connected to this port does not exceed the maximum load tolerance of the corresponding port pins The port pins can be configured to be used as inputs or outputs The 5V supply voltage DCS5V is turned on only after the CAN interface in the USB CANmodul is initialized following the function call of UcaninitCan or UcaninitCanEx External circuitry supplied by this voltage should not draw more than 2mA current in order to not destroy the microcontroller Please do not hesitate to contact us for additional hardware and software implementation support The following figure depicts the positions of the connectors and socket
71. Oxff 50 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS UcanGetVersionEx Syntax DWORD PUBLIC UcanGetVersionEx tUcanVersionType Vertes jo 7 Usability DLL_INIT HW_INIT CAN_INIT version 2 16 and higher only Description This function returns the version numbers of the individual software modules Parameter VerType_p Type of version information shows from which software module the version is to be returned Table 13 lists all possible values for this parameter The format of the version information differs from that of the UcanGetVersion function VerType p Value Meaning kVerTypeUserDIl 0x0001 Returns the version of the file USBCAN library kVerTypeUserLib kVerTypeSysDrv 0x0002 Returns the version of the file USBCAN SYS device driver kVerTypeNetDrv 0x0004 Returns the version of the file UCANNET SYS network driver kVerTypeSysLd 0x0005 Returns the version of the file USBCANLD SYS firmware loader of USB CANmodul GW 001 kVerTypeSysL2 0x0006 Returns the version of the file USBCANL2 SYS firmware loader of USB CANmodul GW 002 kVerTypeSysL3 0x0007 Returns the version of the file USBCANL3 SYS firmware loader of Multiport CAN to USB G3 kVerTypeSysL4 0x0008 Returns the version of the file USBCANL4 SYS firmware loader of USB CANmodul1 G3 3204000 3204001 kVerTypeSysL5 0x0009 Returns the version of the file USBCANL5 SYS firmwa
72. PE USBCAN_ERR_ILLCHANNEL USBCAN_ERR_CANNOTINIT USBCAN_ERRCMD _ 172 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS SetTxTimeout Syntax C public byte USBcanServer SetTxTimeout byte bChannel p int dwTxTimeout p Syntax Visual Basic POIL Puncrtion USE nerve Sic Use insyoune ByVal bChannel p As Byte _ ByVal dwTxTimeout p As Integer As Byte Usability CAN_INIT as of Version 3 10 and higher only for multi channel modules Description This method configures the transmission timeout for CAN messages in the firmware of the multi channel modules For further information ref UcanSetTxTimeout on page 72 Parameter bChannel_p CAN Channel for which timeout shall apply USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 dwTxTimeout_p Send Timeout in milli seconds The value 0 switches the Timeout control off again Return Value Error Code of Function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e 29 173 USB CANmodul 2 4 1 2 Methods for Automatic Sending DefineCyclicCanMsg Syntax C public byte USBcanServer DefineCyclicCanMsg byte bChannel p ref tCanMsgStruct pCanMsgList_p S
73. S TEC electronic GmbH 2015 L 487e_29 111 USB CANmodul UcanWriteCanPort Syntax UCANRET PUBLIC UcanWriteCanPort tUcanHandle UcanHandle p BYTE bValue_p Usability HW_INIT CAN_INIT version 2 15 or higher Description Writes a value to the CAN port interface Thus additional signals such as Standby STB and Enable EN on a low speed CAN transceiver can be controlled Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx bOutValue_p New output value for the CAN port interface see Table 19 Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD _ Note Following initialization of the USB CANmodul with the function UcaninitCan these signals are already set for immediate operation of the USB CANmodul Since software version 3 00 the last saved output values are restored after power on on the sysWORXX modules 112 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS UcanWriteCanPortEx Syntax UCANRET PUBLIC UcanWriteCanPortEx tUcanHandle UcanHandle p BYTE bChannel p BYTE bOutValue bp Usability HW_INIT CAN_INIT version 3 00 and higher Description Writes a value to the CAN port interface
74. SB CANmodul The software changes into the state CAN_INIT Now it is possible to transmit and receive CAN messages Table 12 shows the possible functions in this state Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx bBTRO p Baud rate register 0 refer to section 2 3 4 bBTR1_p Baud rate register 1 refer to section 2 3 4 dwAMR_p Acceptance Mask Register refer to section 2 3 5 dwACR p Acceptance Code Register refer to section 2 3 5 Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_RESOURCE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHW USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD_ 68 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS UcaninitCanEx Syntax UCANRET PUBLIC UcanInitCanEx tUcanHandle UcanHandle p tUcanInitCanParam pinitCanParam p Usability HW_INIT version 2 16 or higher Parameter UcanHandle_p USB CAN handle that was received with the function UcanInitHardware or UcanInitHardwareEx plnitCanParam_p Pointer to an initialization structure typedef struct DWORD m dwSize Size of this structure in bytes BYTE m bMode CAN Transmission Mode see able below BYTE m_bBTRO Baud rate register 0 of the SJA1000 BYTE m_bBTR1 Ba
75. T Description This function finishes the supervision of the recently connected or disconnected USB CANmoduls This function must be called after the function UcaninitHwConnectControl or UcaninitHwConnectControlEx was called within an application and before closing this application Return value Error code of the function USBCAN_SUCCESSFUL 56 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS UcanEnumerateHardware Syntax DWORD PUBLIC UcanEnumerateHardware tUcanEnumCallback fpEnumCallback p void pCallbackArg p BOOL fEnumUsedDevs p BYTE bDeviceNrLow p BYTE bDeviceNrHigh p DWORD dwSerialNrLow p DWORD dwSerialNrHigh p DWORD dwProductCodeLow p DWORD dwProductCodeHigh p Usability DLL_INIT version 5 04 and above Description This function scans all USB CANmoduls connected at the host and calls a callback function for each found module The amount of the USB CANmoduls to be found can be limited by filter parameters Within the callback function the user can decide whether the found USB CANmodul should be automatically initialized by the DLL In this case the module changes to the state HW_INIT Parameter foEnumCallback_p pCallbackArg_p fEnumUsedDevs_p bDeviceNrLow_p bDeviceNrHigh_p dwSerialNrLow_p dwSerialNrHigh_p dwProductCodeLow_p dwProductCodeHigh_p Address to the callback function which is called for each found USB CANmodul
76. ULL bool renumUsscdDevs 1 talse e Syntax Visual Basic Public Shared Function USBcanServer EnumerateHardware ByVal bDeviceNrLow_p As Byte _ ByVal bDeviceNrHigh p As Byte ByVal dwSerialNrLow p As Integer ByVal dwSerialNrHigh p As Integer _ ByVal dwProductCodeLow_p As Integer _ ByVal dwProductCodeHigh p As Integer _ Optional ByVal fpCallback_p As EnumDelegateCallback Nothing Optional ByVal fEnumUsedDevs p As Boolean False As USBcanServer Public Shared Function USBcanServer EnumerateHardware _ ByVal bDeviceNrLow p As Byte ByVal bDeviceNrHigh p As Byte _ Optional ByVal fpCallback_p As EnumDelegateCallback Nothing Optional ByVal fEnumUsedDevs p As Boolean False As USBcanServer Public Shared Function USBcanServer EnumerateHardware _ ByVal dwProductCodeLow p As Integer _ ByVal dwProductCodeHigh p As Integer _ Optional ByVal fpCallback_p As EnumDelegateCallback Nothing Optional ByVal fEnumUsedDevs p As Boolean False As USBcanServer Usability DLL_INIT version 5 08 and higher 154 SYS TEC electronic GmbH 2015 L 487e_29 Description Software Support for Windows OS This method scans all USB CANmoduls connected at the host and calls a callback handler for each found module The amount of the USB CANmoduls to be found can be limited by filter parameters Within the call should be automatically in HW_INIT Parameter bDeviceNrLo
77. X Modules 131 Generic structure of one bit on the CAN DUS eccceeeesseeeeeeseeeeeeeeeentaeeeeeeeaaes 131 Format of the increased baud rate register for fourth generation modules 134 Calculation of Bit Timing for Fourth Generation Modules 135 SYS TEC electronic GmbH 2015 L 487e 29 USB CANmodul Table 1 Table 2 Table 3 Table 4 Table 5 Table 6 Table 7 Table 8 Table 9 Table 10 Table 11 Table 12 Table 13 Table 14 Table 15 Table 16 Table 17 Table 18 Table 19 Table 20 Table 21 Table 22 States of the LEDs on the USB CANmodul GW 001 GW 002 27 States of the LEDs on the sysWORXX modules 28 Pinout of the CAN DB 9 PIug iii 29 Signals available for low speed CAN port 30 CAN Port Pin Assignment for External Transceiver on the GW 002 30 Expansion Port Pin Assignment on the GW 002 and USB CANmodul2 31 Expansion Port Signal Properties on GW 002 cceeeceeeeeeeeeeeeeeeeeeneeeeeeeeeeeeeeeee 31 Expansion Port Signal Properties on USB CANmodul2 G3 32 Properties of port expansion on USB CANmodul2 G4 o ccccccccccceeeeeeteetteeeeeeeeeeeeeees 33 recommended cable parameters 34 Software File StruiGturre res 25 tennis E a nr bees das Dido ata Mn tie 41 Software State Functions ttn t
78. YS TEC electronic GmbH 2015 L 487e_29 79 USB CANmodul Note The parameters m bMode and m dwSerialNr are only available with the software version 2 16 and higher Example UCANRET bRet tUcanHandle UcanHandle tUcanHardwarelInfo Hwlnfo _TCHAR szDeviceNr 24 initialize USB CANmodul bRet UcanInitHardware amp UcanHandle mo error if bRet USBCAN SUCCESSFUL get hardware information USBCAN ANY MODULE UcanGetHardwareInfo UcanHandle amp HwInfo change the device number into a string _stprintf szDeviceNr _T device number 3d HwInfo m bDeviceNr 80 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS UcanGetHardwarelnfoEx2 Syntax UCANRET PUBLIC UcanGetHardwareInfoEx2 tUcanHandle UcanHandle p tUcanHardwareInfoEx pHwInfoEx p tUcanChannelInfo peanimroehO Dy tUcanChannelInfo pCeniInEioChil D 2 Usability HW_INIT CAN_INIT version 3 00 and higher Description This function returns the extended hardware information of an USB CANmodul For the Multiport CAN to USB 3004006 USB CANmodul1 and USB CANmodul2 the hardware information of each CAN channel is returned separately Parameter UcanHandle_p USB CAN handle received with the function Ucan nitHardware or UcanInitHardwareEx pHwiInfoEx_p Pointer to extended hardware information structure see description below pCan
79. _DEINITHW 5 144 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS UcanCallbackFktEx Syntax void PUBLIC UcanCallbackFktEx tUcanHandle UcanHandle p DWORD dwEvent p BYTE bChannel p void pArg p Description This callback function informs the application program if an event occurred on an initialized device This callback function is registered with the USBCAN library by function UcanInitHardwareEx and may have a different name within the application Parameter UcanHandle_p USB CAN handle of the USB CANmodul where the event occurred This handle is returned with the function Ucan nitHardwareEx bEvent_p Event which occurred USBCAN_EVENT_INITHW 0 USBCAN_EVENT_INITCAN 1 USBCAN_EVENT_RECEIVE 2 USBCAN_EVENT_STATUS 3 USBCAN_EVENT_DEINITCAN 4 USBCAN_EVENT_DEINITHW 5 bChannel_p CAN channel which released the event USBCAN_CHANNEL_CHO 0 USBCAN_CHANNEL_CH1 1 USBCAN_CHANNEL_ANY 255 pArg_p Additional user parameter which was handed over to function UcanInitHwConnectControlEx as parameter pCallbackArg_p All callback functions have to be initialized before being called by the USBCAN library SYS TEC electronic GmbH 2015 L 487e 29 145 USB CANmodul The events have the following meaning USBCAN_EVENT_INITHW iris 0x00 The USB CANmodul is initialized successfully Parameter bChannel_p has no meaning here USBCAN_EVENT_INITCANZ ceta oaa eat eraa ml aeda iaeaea aaan i
80. _ERRCMD_REGTST 124 Value 0x41 Description The software tests the CAN controller on the USB CANmodul when the CAN interface is initialized Several registers of the CAN controller are checked This error message returns if an error appears during this register test SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS USBCAN_ERRCMD_ILLCMD Value 0x42 Description This error message returns if the USB CANmodul receives a non defined command This error shows a version conflict between the firmware in the USB CANmodul and the USBCAN library USBCAN_ERRCMD_EEPROM Value 0x43 Description The USB CANmodul has a serial EEPROM This EEPROM contains the device number and the serial number If an error occurs while reading these values this error message is returned USBCAN_ERRCMD_ILLBDR Value 0x47 Description The Multiport CAN to USB 3004006 USB CAnmodul1 3204000 3204001 or USB CANmodul2 3204002 3204003 has been initialized with an invalid baud rate BTRO und BTR1 USBCAN_ERRCMD_NOTINIT Value 0x48 Description It was tried to access a CAN channel of Multiport CAN to USB 3004006 or USB CANmodul2 3204002 3204003 that was not initialized USBCAN_ERRCMD_ALREADYINIT Value 0x49 Description The accessed CAN channel of Multiport CAN to USB 3004006 or USB CANmodul2 3204002 3204003 was already initialized USBCAN_ERRCMD_ILLSUBCMD Value Ox4A Description An internal error occurred in USBCA
81. _EXT 0x80 CAN2 0B message with 29 bit CAN ID Table 16 Constants for the CAN frame format 94 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_WARN_NODATA USBCAN_WARN_SYS_RXOVERRUN USBCAN_WARN_DLL_RXOVERRUN USBCAN_WARN_FW_RXOVERRUN Example tUcanHandle UcanHandle tCabMsgStruct CanMsg UCANRET bRet while 1 read CAN message bRet UcanReadCanMsg UcanHandle No error Print CAN message if USBCAN CHECK VALID RXCANMSG PrintCanMsg amp CanMsg E amp CanMsg bRet if USBCAN CHECK WARNING bRet PrintWarning bRet No warning Print error else if USBCAN CHECK ERROR bRet PrintError bRet break else break SYS TEC electronic GmbH 2015 L 487e_29 95 USB CANmodul Note In order to avoid receive buffer overflows it is recommended to call function UcanReadCanMsg cyclically e g in a loop as long as a valid CAN message was received A valid CAN message was read even if a warning was returned except USBCAN_WARN_NODATA You can use the macro USBCAN CHECK VALID RXCANMSG for checking whether a valid CAN message was stored to the C
82. _TXCOUNTER 74 CAN transceiver 30 USBCAN_RESET_ONLY_ALL_BUFF 76 CAN frame format 94 USBCAN_RESET_ONLY_ALL_COUNTER 76 USBCAN_RESET_ONLY_CANCTRL 75 CAN Status USBCAN_RESET_ONLY_RX_BUFF 75 USBCAN_CANERR_BUSHEAVY 87 USBCAN_RESET_ONLY_RX_BUFF_GW002 USBCAN_CANERR_BUSLIGHT 87 76 USBCAN_CANERR_BUSOFF 87 USBCAN_RESET_ONLY_RXBUFFER_FW 75 USBCAN_CANERR_OK 87 USBCAN_RESET_ONLY_RXCHANNEL_BUFF USBCAN_CANERR_OVERRUN 87 75 USBCAN_CANERR_QOVERRUN 87 USBCAN_RESET_ONLY_STATUS 75 USBCAN_CANERR_QXMTFULL 87 USBCAN_RESET_ONLY_TX_BUFF 75 USBCAN_CANERR_REGTEST 87 USBCAN_RESET_ONLY_TXBUFFER_FW 75 USBCAN_CANERR_TXMSGLOST 72 87 USBCAN_RESET_ONLY_TXCHANNEL_BUFF USBCAN_CANERR_XMTFULL 87 75 200 SYS TEC electronic GmbH 2015 L 487e 29 debug information 25 197 ResetCan SetAcceptance Demo Program 3 11 SetBaudrate Shutdown DEMO API 45 WriteCanMsg USBCAN library DEMOCYCLICMSG 45 UcanConfigUserPort UcanDefineCyclicCanMsg DEMOGWO006 45 UcanDeinitCan UcanDeinitCanEx DLL 3 11 45 UcanDeinitHardware UcanDeinitHwConnectControl EEPROM 3 UcanEnableCyclicCanMsg UcanEnumerateHardware Eigenschaft UcanGetCanErrorCounter UcanDotNET DLL UcanGetFwVersion IsCanOlnitialized 192 UcanGetHardwarelnfoEx2 IsCan1Initialized 193 UcanGetHardwarInfo IsHardwarelnitialized 192 UcanGetModuleTime UcanGetMsgCountinfo Error Code UcanGetMsgCountinfoEx USBCAN_ERR_BUSY 122 UcanGetMsgPending USBCAN_ERR_CANNOTINIT1 123 UcanGetStatus USBCAN_ERR_DISCONNECT 124 UcanGetStatusEx USBCAN_ERR DLL TXFULL 1
83. al 12V 20 source at VCC the CAN transceiver s supply voltage CANVBAT can drop below 8V In this case recognition of the standby mode cannot be guaranteed We recommend using the GW 002 xx1 version in 12V systems This version is specifically designed for an external 12V voltage It has no extra circuitry for supply voltage reduction hence the CAN transceivers standby mode recognition will function The USB CANmodul in the GW 002 xx1 version can also operate at 24V 20 Implementation in 24V systems is possible but not recommended Use the GW 002 xx2 instead SYS TEC electronic GmbH 2015 L 487e 29 USB CANmodul 1 4 CAN port with Low Speed CAN Transceiver The high speed CAN transceiver Philips 82C251 is implemented in the standard configuration of the device As an alternative other CAN transceiver can be populated on the USB CANmodul In this case only the behavior on the CAN bus changes not the behavior in relation to the software From the software point of view e g using the included PCANView any transceiver can be used The optional low speed transceivers TJA1054 or the single wire transceiver AU5790 have multiple signals for setting the operating mode of the transceivers and displaying the operating state The following signals are supported Signal Name Meaning Type Default value EN Enable turn on signal high active high level STB Standby turn off signal low active high level
84. alue from the expansion port This function may be used alternatively for function UcanReadUserPort Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx pbinValue_p Address pointing to a variable that contains the read input value following the successful return of this function This variable then contains the state of the 8 bit expansion port Each bit in this parameter corresponds to matching pin on the expansion port pbLastOutEn_p Address pointing to a variable that contains the configuration data following the successful return of this function configuration that was previously done with UcanConfigUserPort This parameter may be NULL pbLastOutVal_p Address pointing to a variable that contains the last output value following the successful return of this function output value that was written with UcanWriteUserPort This parameter may be NULL Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLPARAM USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD_ 120 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS 2 3 3 Error Codes of the Functions The functions of the USBCAN library return an error code with the type of UCANRET Each return value represents an error The on
85. and message filters if desired Click on the OK button to enable these settings In the menu Transmit gt New you can define a new CAN report Enter a 0 in the field the CAN report will only be sent if it has been selected in the lower field of the main window and the SPACE key was hit e The PCANView USBCAN main window will appear SYS TEC electronic GmbH 2015 L 487e_29 19 USB CANmodul Client Transmit Help i 7 Bi 2 RTRPer RTR Cnt 02 00 00 00 00 00 00 00 08 OF 00 00 00 00 00 00 12 00 00 00 00 00 00 00 00 Connected to USBCAN 1 CHO hr 1 MBit sec ee lOverruns 0 QXmtFull 0 Figure 7 PCANView USBCAN Main Window This screen is divided into two sections Receive and Transmit e Receive monitors CAN signals that are received from a node e Transmit monitors CAN signals sent from the host PC to the CAN network via the USB CANmodul Note The tool PCANView is not suitable for sending precisely timed CAN messages to the CAN bus by using the USB CANmodul Since Software version V4 09 in PCANView it is possible to configure cyclic CAN messages which are automatically sent by the firmware of the USB CANmodul This feature can be used for instance when precisely timed CAN messages have to be sent to the CAN bus e g SYNC messages For this purpose the system menu of PCANView includes a command SYSTEC cyclic CAN messages see Figure 8 A dialog box opens up where all cy
86. ange is 0 to 16 A previously defined set of CAN messages will only be deleted by specifying the number of 0 CAN messages Refer to the function UcanWriteCanMsg for the definition of the structure tCanMsgStruct Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHANDLE USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHW USBCAN_ERR_ILLHWTYPE USBCAN_ERR_ILLCHANNEL USBCAN_ERRCMD _ 108 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS UcanReadCyclicCanMsg Syntax UCANRET PUBLIC UcanReadCyclicCanMsg tUcanHandle UcanHandle p BATE bChannel p tCanMsgStruct pCanMsgList p DWORD pdwCount_p Usability HW_INIT CAN_INIT version 3 06 and higher only sysWORXX modules Description The function reads back the set of CAN messages which was previously defined for automatic transmission of cyclic CAN messages Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcaniInitHardwareEx bChannel_p CAN channel to transmit to USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 pCanMsgList_p Address to an array of type tCanMsgStruct receiving the set of CAN messages for automatic transmission This parameter must not be NULL pdwCount_p Address to a variable of type DWORD where the function should copy to the number of defined CAN messages within the set Refer to the function UcanWriteCanMsg f
87. ardware or UcaninitHardwareEx Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD _ SYS TEC electronic GmbH 2015 L 487e 29 73 USB CANmodul UcanResetCanEx Syntax UCANRET PUBLIC UcanResetCanEx tUcanHandle UcanHandle p BYTE bChannel p DWORD dwResetFlags p Usability HW_INIT CAN_INIT version 3 00 and higher Description Resets parametered global features of features of a separate CAN channel of an USB CANmodul see function UcanResetCan For GW 001 GW 002 and USB CANmodul1 only features of CAN channel 0 can be reset Parameter UcanHandle_p USB CAN handle received with the function Ucan nitHardware or UcanInitHardwareEx bChannel_p CAN channel that is to be reset USBCAN_CHANNEL_CHO for channel 0 USBCAN_CHANNEL_CH1 for channel 1 dwResetFlags_p The flags of this parameter specify what components are to be reset see list below The logical combination of different flags is possible USBCANSRESETS ALL sie en niece ee eet are 0x00000000 Reset all components However the firmware is not reset completely USBCAN_RESET_NO_STATUS 0x00000001 Skip reset of the CAN error status not supported for GW 001 and or GW 002 USBCAN_RESET NO CANCTRL i
88. are returns to the state DLL_INIT Parameter bChannel_p CAN channel which needs to be de initialized USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 USBCAN_CHANNEL_ ALL for both CAN channel fShutDownHardware_p If true the hardware will be de initialized Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE SYS TEC electronic GmbH 2015 L 487e 29 159 USB CANmodul InitCan Syntax C public USBcanServer InitCan byte bChannel p USBCAN CHANNEL CHO short wBTR_p USBCAN BAUD 1MBit ae ae int dwBaudrate p USBCAN BAUDEX USE BTRO1 dwAMR p USBCAN AMR ALL dwACR p USBCAN ACR AL byte bwode p tUcanMode kUcanModeNormal byte bOCR p USBCAN OCR DEFAULT Syntax Visual Basic Publie Pungtiga TnmitCan Ooticnel Byvel bChanmnel 9 AS Byte _ USBCAN CHANNEL CHO Optional ByVal wBTR p As Short USBCAN BAUD 1MBit Optional ByVal dwBaudrate p As Integer USBCAN_BAUDEX_USE_BTRO1 _ Optional ByVal dwAMR p As Integer Optional ByVal dwACR_p As Integer USBCAN AMR ALL USBCAN ACR ALL OQpieiomell ByVal bMode p AS Byte _ tUcanMode kUcanModeNormal _ Optional ByVal bOCR_p As Integer USBCAN OCR DERAULT As Byte Usability HW_INIT version 3 01 and higher Description Initializes a specific CAN channel of a device With GW 001 and GW 002 only cha
89. ariant has built in a high speed CAN transceiver There are variants with build in low speep CAN transceivers at the first CAN channel e g ordering number 3204019 Here always the second CAN channel has a build in high speed CAN transceiver There is Expansion Port for connecting digital inputs or outputs like the GW 002 does have too With order number 3204007 you will get an USB CANmodul2 including an Expansion Port which is described in section 1 5 1 8 4 The USB CANmodul8 and USB CANmodul16 Both USB CANmodul8 ordering number 3404000 and USB CANmodul16 ordering number 3404001 are identical to the Multiport CAN to USB but are shipped with a table case The USB CANmodul16 consists of two circuit cards of the same type like is built in on USB CANmodul8 SYS TEC electronic GmbH 2015 L 487e_ 29 39 USB CANmodul 1 8 5 The USB CANmodul2 IP65 A variant of USB CANmodul2 is available in an IP65 metal housing with article number 3104000 However no low speed variants are featured 40 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS 2 Software Support for Windows OS 2 1 File Structure If during the installation of the USB CANmodul utilities no other target directory is given then all files will be installed in the folder C Programs SYSTEC electronic USB CANmodul Utility Disk The contents of this folder are given in Table 11 Some folders are created depending on selected installation optio
90. assigned by the user and are stored in an EEPROM The functions for data exchange with the USB CAN application are available through a DLL Dynamic Linked Library The enclosed demo program shows the easy handling of the DLL API functions SYS TEC electronic GmbH 2015 L 487e 29 USB CANmodul This manual refers to the following USB CANmodul versions Order number Features GW 001 Obsolete but software support for compatibility reasons Galvanic isolation configurable via Jumper No Software support since Windows driver version V4 00 This hardware is only supported until driver version V4 18r2 GW 002 Obsolete but software support for compatibility reasons More compact housing 102x54x30 LxBxH in mm protection class IP40 supports DIN rail mounting USB CANmodul with galvanic isolated available under separate order number Thus it is no longer needed to open the housing and to supply power via CAN bus CAN ground CAN GND and CAN shield CAN SHLD not connected internally Various CAN transceivers available optionally for low speed CAN or single wire CAN special PCB pads and socket connector for assembly of special CAN transceivers External power supply of up to 30V possible depending on the CAN transceiver used Micro controller s 8 bit user port I O with TTL level provides for customer specific extensions Further CAN transceivers adaptable via plug in slot on board This ha
91. ate process lasts for longer time Please do not unplug the module from USB port until the update process has been finished New feature The USB CANmodul Control shows the module type of USB CANmodul2 of 4th generation in hardware tab sheet Software Version 5 04 Software changed Driver support for GW 001 and GW 002 removed For these obsolete devices the version V4 18r2 is recommended The simultaneous use of these modules with the modules of 3rd and 4th generation is impossible New feature API function UcanSetDeviceNr implemented in USBCAN32 DLL and USBCAN64 DLL for easy way to change the device number from customer applications New feature API function UcanEnumerateHardware implemented in USBCAN32 DLL and USBCAN64 DLL for enumeration of connected USB CANmoduls on a host New feature API function UcanInitHardwareEx2 implemented in USBCAN32 DLL and USBCAN64 DLL for initializing an USB CANmodul by its serial number Software changed API function UcanSetDebugMode has to be called in UNICODE format 8 SYS TEC electronic GmbH 2015 L 487e 29 Introduction Software Version 5 05 New feature New methods implemented in UcanDotNET server USBCAN_CALCULATE_AMR and USBCAN_CALCULATE_ACR with the same functionality as the macros defined in USBCAN32 H Software changed Signals EN and STB of AU5790 at the single wire USB CANmodul2 can be separately switched on off by using the API function UcanWriteCanPo
92. aud rate 10 kBit s These pre defined values cannot be used for the older sysWORXX USB CANmoduls Other values as defined above can be set by the user ref section 2 3 4 4 Following the format of the increased baud rate register is explained Bit 31 30 29 28 27 26 25 24 0 1 SJW 23 22 21 20 19 18 17 16 TS2 TS1 15 14 13 12 11 10 9 8 BRP 7 6 5 4 3 2 1 Bit 0 BRP Figure 26 Format of the increased baud rate register for fourth generation modules BPR Baud rate Prescaler defines the relation of parts between internal clock of the micro controller and the clock of the CAN bus SJW Synchronization Jump Width defines the compensation of the phase shift between the system clock and the different CAN controllers plugged to the CAN bus TS1 TS2 Phase Segment defines the number of clock cycles on the CAN bus for one bit and the position of Sample Points 134 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS NOMINAL BIT TIME SYNC_SEG BIT SEGMENT 1 BS1 BIT SEGMENT 2 BS2 1 xt tes tase 1 SAMPLE POINT TRANSMIT POINT NominalBitTime NominalBitTime 1xty tgs tgso with tgs1 ta X TS1 3 0 1 taso ty X TS2 2 0 1 ty BRP 9 0 1 x tbcux where ty refers to the Time quantum t eux time period of the APB clock BaudRate Figure 27 Calculation of Bit Timing for Fourth Generation Modules Source RM0033 Refere
93. clic CAN messages can be configured see Figure 9 Use button Add to add a new cyclic CAN message With button Edit a previously marked cyclic CAN message can be edited Each sysWORXX USB CANmodul supports up to 16 cyclic CAN messages Choose option parallel if the cycle time of each CAN message should refer to itself see Figure 19 With option sequential the cycle time of each CAN message refers to its subsequent CAN message see Figure 20 20 SYS TEC electronic GmbH 2015 L 487e 29 Getting Started 7B PCANView USBCAN V5 9 r5 Wiederherstellen Verschieben Gr e ndern Minimieren Maximieren Schlie en SYSTEC cyclic CAN messages SYSTEC Write CAN Trace File Transmit E Connected to USBCAN 1 CHO hr 500 KBit sec oe Overruns 0 iQXmtFull 0 Figure 8 Figure 9 precisely timed CAN messages in PCANView USBCAN Date Period 1000 Remote Frame 500 ox Abbrechen configuration of cyclic CAN messages in PCANView USBCAN Since Software version V5 09 the tool PCANView USBCAN can write a CAN Trace File To start this feature the command SYSTEC Write CAN Trace File has to be clicked SYS TEC electronic GmbH 2015 L 487e 29 21 USB CANmodul within the system menu of the tools refer to Figure 8 If the feature is activated then a check is displayed before the command within the system menu All CAN messages are stored to the CAN Trace Fil
94. code USBCAN_SUCCESSFUL 116 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS UcanConfigUserPort Syntax UCANRET PUBLIC UcanConfigUserPort tUcanHandle UcanHandle p BARR bOutEn p Usability HW_INIT CAN INIT version 2 16 or higher Description Configures the expansion port refer to section 1 5 Each individual pin of the 8 bit port can be used as an input or an output The logical value O of a bit in the parameter bOutputEnable p defines the corresponding pin on the expansion port to function as an input and a logical 1 defines it as an output Parameter UcanHandle_p USB CAN handle received with the function Ucan nitHardware or UcanInitHardwareEx bOutEn_p Configuring the 8 bit port as input or output Bit X 0 Pin X input Bit Y 1 PinY output Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD_ Note After connecting the USB CANmodul to the PC all expansion port pins are configured as inputs Since software version 3 00 the last saved configuration is restored after power on on sys WORXX modules SYS TEC electronic GmbH 2015 L 487e 29 117 USB CANmodul UcanWriteUserPort Syntax UCANRET PUBLIC UcanWriteUserPort tUcanHandl
95. d 6 0 for ARMv4l and x86 Scope of Delivery Assembled and tested device Systems Manual Software tools demos in source driver software USB cable type A to type B approximately 1 5 meters SYS TEC electronic GmbH 2015 L 487e 29 11 USB CANmodul 1 Getting Started What you will learn in this Getting Started section e Installing the USB CANmodul e Software installation e Connecting the USB CANmodul to the host PC e Connecting the USB CANmodul to a CAN network e using PCANView USBCAN 1 1 Installation 1 1 1 Installation of the USB CANmodul under Windows OS Ensure that the individual components are not damaged The contents of the USB CANmodul are e USB CANmodul e Installation CD ROM with electronic version of this Systems Manual and all software and drivers e USB cable 1 1 2 Software Installation Note Since driver version V3 00 the operating systems Windows 98 and ME are not supported The support of Windows 2000 is no longer guaranteed Installation and operation of the USB CANmodul requires a host PC with a USB port that is running Microsoft Windows 2000 XP and Vista since driver version 4 00 The USB CANmodul will not work under Windows NT because there is no USB support in this operating system Note Make sure to install the software before the USB CANmodul is connected to the PC Make sure that you are logged in Windows OS with admin rights We provide driver updates f
96. d transmit buffers in all software parts and reset of the reception and transmit message counters USBCAN_RESET_ONLY_ALL_COUNTER 0 eee ii sees eeaeeneaeee Ox0000FFF3 Reset of all reception and transmit counters Important If the constants USBCAN RESET NO should be combined a logical OR has to be used Example dwFalgs USBCAN RESET NO COUNTER ALL USBCAN RESET NO BUFFER ALL If the constants USBCAN RESER ONLY has to be combined a logical AND has to be used Example dwFalgs USBCAN RESET ONLY RX BUFF amp USBCAN RESET ONLY STATUS For GW 002 the constant USBCAN RESET ONLY _RX_BUFF_GW02 has to be used instead of USBCAN RESET ONLY RX BUFF But in this case the transmit buffer in module firmware will be reset too Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERRCMD _ USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT 76 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS UcanDeinitCan Syntax UCANRET PUBLIC UcanDeinitCan tUcanHandle UcanHandle p Usability CAN_INIT Description Shuts down the CAN interface of an USB CANmodul This function sets the operating voltage of the CAN controlle
97. debug information by changing the LOG Level can help to increase performance again But note that in this case important information could be missing in the log file Furthermore the debug log file may increase in size Activate the feature Check max LOG file size This way USBCAN32 DLL will monitor the file size of the debug log file If it is exceeded the previous older debug outputs will be deleted from the debug log file Default setting of the maximum debug file size is 10240 Kbytes means 10 Mbytes Since version V3 11 of USBCAN library an application can call the function UcanSetDebugMode for subsequent activation of the feature Refer to section 2 3 2 1 for more information With the Check Box Show Dbg Info you can set if a dialogue box should be opened upon initiating an application and for activated debug read outs reminding of activated debug read outs This ist o avoid that debug read outs remain continuously activated without being noted filling the main board with log files 1 1 9 Activation of the network driver The network driver UCANNET SYS was developed for connecting several applications to one physical USB CANmodul Therefore the kernel mode driver creates a virtual CAN network for each physical module to which several applications can connect to All CAN messages that are sent by an application are not only sent to the physical CAN bus but also to all the other connected applications Received CAN m
98. ded hardware information bRet UcanGetHardwareInfoEx2 UcanHandle amp HwiInfoEx NULL NULL if bRet USBCAN SUCCESSFUL TRACE product code 0x 04X n HwInfoEx gt m_dwProductCode amp USBCAN PRODCODE MASK PID check whether two CAN channels are supported if USBCAN CHECK SUPPORT TWO CHANNEL amp HwInfoEx SYS TEC electronic GmbH 2015 L 487e_29 83 USB CANmodul UcanGetMsgCountinfo Syntax UCANR tUcanHandle tUcanMsgCountInfo Usability CAN_INIT version 3 00 and higher Description ET PUBLIC UcanGetMsgCountInfo UcanHandle p pMsgCountInfo p Reads the counters for transmitted and received CAN messages from the device Parameter UcanHandle_p pMsgCountinfo_p UcanInitHardwareEx Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERRCMD USBCAN_ERR_ILLHW USBCAN_ERR_ILLPARAM USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT typedef struct WORD m_wSentMsgCount tUcanMsgCountInfo 84 Counter for transmitted CAN messages WORD m_wRecvdMsgCount Counter for received CAN messages SYS TEC electronic GmbH 2015 USB CAN handle that was returned by UcaninitHardware or Pointer to a structure of type tUcanMsgCountinfo where the counters are to be stored to L 48
99. dules pinitInfo p gt m fTryNext TRUE else do not find further modules pinitInfo p gt m fTryNext FALSE 150 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS 2 4 Class library for NET programming languages In order to use the USBCAN32 DLL with NET programming languages such as Visual basic NET Managed C and C a Wrapper class UcanDotNET USBcanServer was developed in VB NET This class lies in the dynamic link library DLL named UCANDOTNET DLL In order to include the DLL into own projects the following steps under Visual Studio NET become necessary go to menu gt Projects and click on entry Add reference the dialog window Add reference appears Click on Browse button and select the UCANDOTNET DLL Press OK to confirm Sample for creating an object of class USBcanServer in Visual Basic NET Dim WithEvents m USBcan As UcanDotNET USBcanServer Note The Wrapper class is included as source code That means it can be changed by user expanding new features of the USBCAN32 DLL or improving the Wrapper SYS TEC electronic GmbH 2015 L 487e_29 151 USB CANmodul 24 1 Methods of class USBcanServer 2 4 1 1 General methods GetFwVersion Syntax C public int USBcanServer GetFwVersion Syntax Visual Basic Public USBcanServer GetFwVersion as Integer Usability HW_INIT version 3 01 and higher Descripti
100. e amp UcanHandle 0 NULL initializes the CAN interface bRet UcanInitCan UcanHandle HIBYTE USBCAN BAUD 1MBit BTRO for 1MBit s LOBYTE USBCAN BAUD 1MBit BIR for I1MBit s OxFFFFFFFF AMR all messages received 0x00000000 BCR Error print error if bRet USBCAN SUCCESSFUL PrintError bRet Configuration of other baud rates is also possible The structure of the BTRO and BTR1 registers is described below Refer to the SJA1000 Data Sheet for detailed description 128 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 SJW BPR Figure 21 Structure of baud rate register BTRO Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 SAM TSEG2 TSEG1 Figure 22 Structure of baud rate register BTR1 BPR Baudrate Prescaler specifies the ratio between system clock of the SJA1000 and the bus clock on the CAN bus SJW Synchronization Jump Width specifies the compensation of the phase shift between the system clock and the different CAN controllers connected to the CAN bus SAM Sampling specifies the number of sample points used for reading the bits on the CAN bus If SAM 1 three sample points are used otherwise only one sample point is used TSEG Time Segment specifies the number of clock cycles of one bit on the CAN bus as well XTAL as the
101. e Support for new hardware USB CANmodul1 fourth generation Bugfix At times the USB CANmodul Control did not display all connected modules That was the case when simultaneously USB CANmoduls worked either with the standard driver or the network driver Bugfix While read out of EEPROM the EEPROMs content from address 0x0000 to OxOOFF was mirrored every 256 bytes Additionally read out and write performance was increased SYS TEC electronic GmbH 2015 L 487e 29 USB CANmodul Software Version 5 01 New feature Support of new hardware USB CANmodul2 fourth generation Bugfix Fourth generation USB CANmodul could lose CAN reports receive site if many CAN reports appeared in close succession over CAN bus Bugfix Endless firmware update on USB CANmodul8 and 16 Software Version 5 02 New feature For fourth generation USB CANmoduls the time stamp for reception messages can be adjusted on 100us New feature If a fourth generation USB CANmodul is plugged the first time on another USB Port kernel drivers are not being installed again Bugfix User specific CAN bit rates could not be set on fourth generation of USB CANmoduls Bugfix If a multitude of 4 CAN reports were sent all at the same time via a fourth generation USB CANmodul this was executed with a delay to the CAN Bus Software Version 5 03 Software changed Forced firmware update is necessary for the 4th generation of USB CANmoduls The upd
102. e which are received within this time The CAN Trace File is stored as binary file with the default file extension ucantrc The company SYS TEC electronic GmbH provides a NET tool for conversion of the binary CAN Trace File into a text file This conversion tool is provided as source code when the USB CANmodul Utility Disk is completely installed So the customer is able to adapt other formats of the output file There are no copyrights or license rights for this tool The source code and the project files for Microsoft Visual Studio 2008 can be found in following subfolder of the installation path of the USB CANmdoul Utility Disk at the hard disk Examples ConvertUcanTrace Within the subfolder bin of the installation path the tool is provided as binary executable A CAN Trace File created by the tool PCANView USBCAN can be converted into a txt file by calling the following command line ConvertUcanTrace exe lt input file gt lt output file gt options Example ConvertUcanTrace exe pcanview 20150206 122846 ucantrc To display a detailed help of the converter tool call the following command line ConvertUcanTrace exe help Please note that the file UcanDotNet dll for the x86 platform has to be stored into the current working directory of the converter tool too The tool is compiled for the Microsoft NET Framework 3 5 But it can be adapted for each other NET Framework version by the customer 22 SYS
103. e UcanHandle p BYTE bOutValue p Usability HW_INIT CAN_INIT version 2 16 or higher Description Writes a value to the expansion port In order to write to output lines the corresponding bits resp port pins must be configured as outputs using the UcanConfigUserPort function Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx bOutValue_p New output value for the expansion port outputs Each bit in this parameter corresponds to matching pin on the expansion port Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD_ Note For GW 002 the supply voltage for the expansion port pin 10 refer to Table 6 is connected only after the function UcaninitCan is called After the USB CANmodul has been connected to the PC all expansion port pins are configured as inputs No time critical switching procedures can be performed with this function using the expansion port since the reaction time is influenced by multiple factors Since software version 3 00 the last saved configuration of the outputs is restored after power on on sysWORXX modules 118 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS UcanReadUserPort Syntax
104. e_29 131 USB CANmodul The following mathematical connections apply tmcko 1 48MHz tmcki 1 24MHz tcsc tuckx BRP 1 tsYNCSEG 1 tcsc tpRs tcsc PROPAG 1 tPHs1 tcsc PHASE1 1 tpHs2 tcsc PHASE2 1 teit tsyncsec ters tPHs1 tpHs2 Example for 125 kBit s PROPAG 3 PHASE1 5 PHASE2 4 BPR 23 CLK 0 tesc tucko 24 tsYNCSEG 1 tsal tprs tcsc 4 tPHs1 tcsc 6 tPHs2 tcsc 5 tBit tsyncsec ters tPHs1 teHse2 1 tei 125 kBit sec system clock CLK 0 system clock CLK 1 bus clock 500 ns 500 ns 2000 ns 3000 ns 2500 ns 8000 ns time of one bit on CAN bus Note For compatibility reasons constant USBCAN BAUDEX USE BTRO1 was defined If this constant is used for baud rate configuration of sysWORXX modules the BTRO and BTR1 registers become available for configuration In this case only the baud rates given in this manual are available Configuration of user specific baud rates is not possible error code USBCAN ERRCMD ILLBDR 132 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS Example 1 tUcanHandle UcanHandle UCANRET bRet tUcanInitCanParam InitParam preset init parameters
105. eckSupportRbCanPort Syntax C public static bool USBcanServer CheckSupportRbCanPort tUcanHardwareInfoEx HwInfoEx p Syntax Visual Basic Public Shared Function USBcanServer CheckSupportRbCanPort _ ByVal HwInfoEx p As tUcanHardwareInfoEx As Boolean Parameter HwInfoEx_p Hardware information structure read with method GetHardwarelnfo Return Value Displays true if the USB CANmodul has a back readable CAN port ref section 1 4 Note If this method displays true that does not mean it is equipped with a low speed CAN transceiver SYS TEC electronic GmbH 2015 L 487e 29 185 USB CANmodul CheckSupportUcannet Syntax C public static bool USBcanServer CheckSupportUcannet tUcanHardwareInfoEx HwInfoEx p Syntax Visual Basic Public Shared Function USBcanServer CheckSupportUcannet _ ByVal HwInfoEx p As tUcanHardwareInfoEx As Boolean Parameter HwInfoEx_p Hardware information structure read with method GetHardwarelnfo Return Value Displays true if the USB CANmodul can be used with the USB CANnetwork driver 186 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS 2 4 2 Event of class USBcanServer Class USBcanServer passes the callback events of the USBCAN32 DLL to the application as NET events Note The callback events should not call the methods of class USBcanServer directly This could lead to undesirable ef
106. ee Table 4 for HW_INIT and CAN_INIT is no longer possible Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcaninitHardwareEx Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_ILLHW Note This function has to be called before closing the application otherwise other applications are no longer able to access this specific USB CANmodul SYS TEC electronic GmbH 2015 L 487e 29 65 USB CANmodul UcanGetModuleTime Syntax UCANRET PUBLIC UcanGetModuleTime tUcanHandle UcanHandle p DWORD pdwTime p Usability HW_INIT CAN_INIT version 3 01 or higher Description This function reads the current time stamp from the device Parameter UcanHandle_p USB CAN handle that was returned by UcaninitHardware or UcanInitHardwareEx pdwTime_p Pointer to a variable where the time stamp is to be stored to Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHW USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_TIMEOUT USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERRCMD _ Note The execution of this function as well as the transfer of the time stamp needs run time In other words after this function has returned successfully the time stamp might be out dated The accuracy o
107. eeeeeeaaeeeeeeneeaaes 16 1 1 6 Connection to a CAN Network 17 1 1 7 Starting PCANView USBCAN ie 18 1 1 8 Creating a debug file from DLL 25 1 1 9 Activation of the network driver 26 1 2 Status LEDs on the USB CANmodul ccccceeceeeeeeeeeeeeeeteeeeecaeeeeeeeeeeetnaeeeees 27 1 3 CAN Supply Voltage iii 29 1 4 CAN port with Low Speed CAN Transceiver ccccceceeeteeeeeceeeeeeeeeeeeteaeeeee 30 1 5 EXPANSION Port dune nn essueeebuees Eii datent dada nd diner 31 1 6 Termination resistor for CAN bus ccccceeeeeeeeeeeeeeeeeceeeeeeeeeeeesaaeeseceeeteeaeees 34 1 7 Order Options ss rar tnt nn nan UE A ah ie ablated 35 1 8 The new sysWORXX USB CANModUIS 37 1 8 1 The Multiport CAN to USB iii 37 1 8 2 The USB CANMOdUI sise 38 1 8 3 The USB CANMOdUl2 arinina iiaiai a a rt eat ares 39 1 8 4 The USB CANmodul8 and USB CANmodul16 39 1 8 5 The USB CANmodul2 IP65 ue 40 2 Software Support for Windows OS is 41 2 1 Elle STUCI E desiran eese re aeee EER Re ERARE ENAREN ER KEER ince 41 2 2 Tools for the USB CANmodul ss 42 2 2 1 USB CANmodul Control iii 42 2 2 2 PCANView USBCAN for Windows 2 ccceecceeseteeeeeeeeeeeeeaeeeeeaaeeseeeeeeteneees 43 2 3 Description of the USBCAN library 45 2 3 1 Attributes of the USBCAN library
108. eeeeeneees OxFFFFFFFF Complete reset of the device firmware There are the following predefined combinations USBCAN_RESET_ONLY_STATUS iii Ox0000FFFE Reset of the CAN error status only USBCAN RESET ONLY CANCTRE tose cecctativcrsiccegcces reecgeddecesniageeseeeesdeareeetetinegsaceid anne Ox0000FFFD Only resets the CAN controller of the USB CANmodul This has to be done after each bus off state because the CAN controller cannot leave this state automatically USBCAN_RESET_ONLY_RXBUFFER_FW 0 ccccceeeceeeeeeeeceeeeeeeeeeeeceeeeeaeeeeeeeseeeees Ox0000F7FF Only resets the receive buffer within the firmware of the USB CANmodul USBCAN_RESET ONLY _TXBUFFER_FW iii 0x0000FF7F Only resets the transmit buffer within the firmware of the USB CANmodul USBCAN_RESET ONLY _RXCHANNEL_BUFF ins Ox0000FEFF Reset of the receive buffer of only one CAN channel USBCAN_RESET ONLY _TXCHANNEL_BUFF ins Ox0000FFEF Reset of the transmit buffer of only one CAN cannel USBCAN_RESET ONLY _RX_BUFF ire Ox0000F0F7 Reset of the receive buffers in all software parts and reset of the receive message counter USBCAN_RESET ONLY TX _BUFF iii 0x0000FF0B Reset of the transmit buffers in all software parts and reset of the transmit message counter SYS TEC electronic GmbH 2015 L 487e 29 75 USB CANmodul USBCAN_RESET_ONLY_ALL_BUFF iii 0x0000F003 Reset off all message buffers receive an
109. eger As 1mteger Description Converts the Version Code to the Release Version Parameter dwVersion_p Version code displaqyed by methods GetHardwarelnfo GetUserDllVersion or GetFwVersion Return Value Converted Release Version Checkls_sysWORXX Syntax C public static bool USBcanServer CheckIs sysWORXX tUcanHardwareInfoEx HwInfoEx p Syntax Visual Basic Public Shared Function USBcanServer CheckIs sysWORXX _ ByVal HwInfoEx p As tUcanHardwareInfoEx As Boolean Parameter HwInfoEx_p Hardware information structure read with method GetHardwarelnfo Return Value Displays true if USB CANmodul is a sysWORXX module SYS TEC electronic GmbH 2015 L 487e 29 181 USB CANmodul Checkls_G3 Syntax C puolie static bool US Cains Cray esta Clie C kale ES tUcanHardwareInfoEx HwInfoEx p Syntax Visual Basic PURE CSE nc ess Onm UC Gains Craioxtan Checks G3 ByVal HwInfoEx p As tUcanHardwareInfoEx As Boolean Parameter HwInfoEx_p Hardware information structure read with method GetHardwarelnfo Return Value Displays true if the USB CANmodul is a module of the third generation G3 Checkls_G4 Syntax C public static bool USBcanServer CheckIs G4 tUcanHardwareInfoEx HwInfoEx p Syntax Visual Basic Public Shared Function USBcanServer CheckIs G4 _ ByVal HwInfoEx p As tUcanHardwareInfoEx As Boolean Parameter HwInfoEx_p Ha
110. ent in the main program e g with the Win32 function WaitForMultipleObjects and then to call the DLL functions from there after the event has occurred The callback functions only set the corresponding event i e with the Win32 function SetEvent 146 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS Example tUcanHandle UcanHandle g tCanMsgStruct CanRxMsg g void main void UCANRET bRet initilizes the first callback function bRet UcanInitHwConnectControl UcanConnectControlFkt if bRet USBCAN SUCCESSFUL wait for event e g with WaitForMultipleObjects function react to events accordingly case INIT open USB CANmodul with USBCAN ANY MODULI initialize second callback function bRet UcanInitHardware amp UcanHandle g USBCAN ANY MODULE UcanCallbackFkt GI and initialize CAN interface bRet UcanInitCan UcanHandle g 0x00 0x14 OxFFFFFFFFL 0x00000000L case RECV read CAN message bRet UcanReadCanMsg UcanHandle g amp CanRxMsg g SYS TEC electronic GmbH 2015 L 487e_29 147 USB CANmodul void PUBLIC UcanConnectControlFkt BYTE bEvent p DWORD dwParam p UCANRET bRet which event did occur switch bEvent_p new USB CANmodul connected case USBCAN EVENT CONNECT Send signal to main function so that the USB CAN
111. ersion 3 09 dwACR_p 31 30 a 21 20 19 N 16 15 14 LE 8 7 6 pie 0 y dwAMR_p 31 30 h 21 20 19 Jn 16 15 14 8 7 6 wha 0 y CAN Identifier 10 9 on 0 Not in use d Extended Frame 29 Bit Identifier for all sySWORXX modules until firmware version 3 09 dwACR_p 31 30 a 3 2 1 0 y dwAMR_p 31 30 i 3 2 1 0 y CAN Identifier 28 27 ts 0 Not in use The macros USBCAN_SET_AMR extended can id rtr and USBCAN_ SET _AMR extended can_ id rtr as well as USBCAN CALCULATE _AMR extendeda from_id to_id rtr_ only rtr too und USBCAN_CALCULATE_ACR extended from id to_id rtr_only rtr_too can be used to calculate the filter values The parameter extended indicates if the parameters can_id from_id and to_id specify a 29 bit message TRUE or an 11 bit message FALSE The parameter can_id shows the filter value as CAN identifier The parameters from_id and to_id specify the filter range for CAN identifiers The parameters rtr rtr_only and rtr_too can be used to filter RTR frames These parameters can be TRUE 1 or FALSE 0 If the parameter rtr_only is TRUE then only RTR Frames are received and parameter rtr_too is ignored Otherwise also RTR Frames are received if rtr_too is set to TRUE SYS TEC electronic GmbH 2015 L 487e 29 139 USB CANmodul Example 1 tUcanHandle UcanHandle UCA
112. es immediately without restarting the operating system The USB CANmodul takes advantage of this communication standard and provides an easy to use portal from a host PC to a CAN network Connecting the USB CANmodul to the host PC is simple The included USB cable supports the two types of USB connectors type A and type B The type A plug connects to the host computer or an upstream hub Type B plug connects downstream to the USB CANmodul The USB interface enables data transfer with a rate of up to 12 MBit s With a uniform connector for all device types the system is absolutely user friendly Once the USB CANmodul is connected to the host PC the operating system reads the configuration data and automatically loads the device driver All CAN messages are transferred transparently through the USB Bus CAN Baud Rates of up to 1 MBit s are supported The transmitted and received CAN messages are buffered by the USB CANmodul The device supports CAN messages according to CAN 2 0A and 2 0B specifications 11 and 29 Bit identifiers Connection to the CAN bus meets the CiA Standard DS 102 DB 9 and features optional optical isolation of the CAN signals Drivers for Linux LabView contributed Windows 2000 XP Vista 7 and 8 as well as Linux are provided for the USB CANmodul The USB configuration tool for Windows enables connectivity and management of more than one device on the USB bus This USB network is configured using device numbers which are
113. eseeaeeseeseeaaeueeseeaeneeeeees 152 2 4 1 2 Methods for Automatic Sending cccccceeeeceeeeceeeeeeneeeeeeneeeesaaeesesieeeeseneees 174 2 4 1 3 Static Help Methods of Class USBcanServers ccccceceeseeeeeeceeeeeeteeeeteneees 177 2 4 2 Event of class USBcanServer iii iii dernieres 187 2 4 3 Properties of Class USBcanServer ccccceeeeeeeeeeeeeeeeeeeeseaeeeesaaeeseeaeeeeeeaeees 192 3 Software support for Linux OS issssssnnnnnenennenes 194 4 Software support for Windows CE OS 196 4 1 Installation of the driver under Windows CE 196 4 2 API functions under Windows CE iii iii 197 4 3 Logging debug information cccccceeeeeeecneeeeeeeeeennaeeeeeeeeeaaeeeeeeeeenaaeeeeeeneeaaes 197 5 KMOWIDVISSUCS iio icccectewatcecvactec ets ucacdenasaasenechetuvencscsnsdeucnastavsucducsbascacednuvneecusranane 199 6 UN OX eins savsctcewssaasaceleuveccecasguvcuedaangtwbensyvedscenusinewccncedhssuuseusstcusdnuvesnscansesvweadeusdeus 200 SYS TEC electronic GmbH 2015 L 487e 29 Contents Index of Figures and Tables Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 Figure 17 Figure 18 Figure 19 Figure 20 Figure 21 Figure 22 Figure 23 Figure 24 Figure 25 Figure 26 Figure 27 Installation of the driver at Windows Vista 14 Device Manager with the USB CANmodul
114. esistor File Structure 41 CheckSupportTwoChannel CheckSupportUcannet Function CheckSupportUserPort UcanDotNET DLL ConvertToMajorVer GetFwVersion 152 ConvertToMinorVer GetHardwarelnfo 163 ConvertToReleaseVer GetMsgCountinfo 170 DefineCyclicCanMsg GetStatus 164 EnableCyclicCanMsg GetUserDIIVersion 153 EnumerateHardware InitCan 160 GetBaudrateExMessage InitHardware 158 GetBaudrateMessage ReadCanMsg 167 GetCanErrorCounter GetCanStatusMessage SYS TEC electronic GmbH 2015 L 487e 29 Index 77 78 56 51 71 59 54 55 97 162 166 165 159 168 117 108 197 197 65 197 110 57 105 53 81 79 66 84 85 103 86 88 50 197 68 69 141 141 61 63 197 197 141 114 115 109 119 120 73 74 92 93 89 90 49 67 72 100 101 112 113 118 182 182 181 183 185 185 184 183 186 184 180 180 181 174 176 154 179 178 172 177 201 USB CANmodul GetMsgPending ReadCyclicCanMsg SetTxTimeout Hot Plug and Play Installation Introduction IP65 Jumper LabView LED LIB Macro USBCAN library 171 175 173 12 196 40 10 11 10 45 USBCAN_CHECK_SUPPORT_CYCLIC MSG 82 USBCAN_CHECK_SUPPORT_RBCAN PORT 83 USBCAN_CHECK_SUPPORT_RBUSER_ PORT 83 USBCAN_CHECK_SUPPORT_TERM_RESISTOR 83 USBCAN_CHECK_SUPPORT_TWO_CHANNEL 83 USBCAN_CHECK_SUPPORT_USER_PORT 83 Multiport CAN to USB network driver Order Options PCANView Scope of Delivery Serial Number S
115. essages are passed on to all applications The network driver can only be activated for sysWORXX USB CANmoduls but not for the older modules GW 001 and GW 002 To activate the network driver for an USB CANmodul open the USB CANmodul Control from the Control Panel Mark that module within the hardware list that you want to use for the network driver Push the button Change to open the dialog box shown in Figure 4 Tick the box use USB CANnetwork driver and confirm with OK After pushing the button Apply or OK in the main window of the USB CANmodul Control the USB CANmodul automatically reconnects to the host PC This results in exchanging the kernel mode driver Now you can use several applications with this USB CANmodul 26 SYS TEC electronic GmbH 2015 L 487e_29 Getting Started 1 2 Status LEDs on the USB CANmodul The state of each CAN channel on the USB CANmodul is displayed via 2 resp 3 LEDs In order to distinguish the states different blinking cycles were defined respectively approx 10 Hz 1 1 on cycle 1 PRI UU LULU y off approx 2 Hz 1 1 on cycle 2 kl y off approx 4 Hz 3 1 on RE sr cycle off Not to scale A description of the power and status LEDs is shown in the table below USB CANmodul LED green LED red Description connected Power Status no off Off No voltage is supplied to the device yes on Blinking cycle 1 Device logs in to the hos
116. f this time stamp depends on many factors and is unpredictable on non real time operating systems The base time of the time stamp is 1 millisecond Since firmware versiob V5 09 a standard USB CANmodul of fourth generation G4 returns the time stamp in multiple of 100 microseconds if the flag kUcanModeHighResTimer was set with the initialization of the CAN interface refer to Table 14 66 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS UcanSetDeviceNr Syntax UCANRET PUBLIC UcanSetDeviceNr tUcanHandle UcanHandle p BYTE bDeviceNr p Usability HW_INIT CAN_INIT version 5 04 and higher Description This function writes a new device number to the USB CANmodul Parameter UcanHandle_p USB CAN handle that was returned by UcaninitHardware or UcaninitHardwareEx bDeviceNr p New device number Valid values are 0 to 254 Return code Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHW USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_TIMEOUT USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERRCMD _ SYS TEC electronic GmbH 2015 L 487e_29 67 USB CANmodul UcaninitCan Syntax UCANRET PUBLIC UcanInitCan tUcanHandle UcanHandle p BYTE bBTRO p BYTE bBTR1 p DWORD dwAMR p DWORD dwACR p Usability HW_INIT Description Initializes the CAN interface of an U
117. fects The best method is to wait for an event in a thread e g with method WaitHandle WaitAny and call the method of class USBcanServer after the occurrence of the event The callback events only set the respective signal e g with method AutoResetEvent Set CanMsgReceivedEvent Syntax C public event USBcanServer CanMsgReceivedEvent byte behannel p Syntax Visual Basic Public Event USBcanServer CanMsgReceivedEvent _ ByVal bChannel p As Byte Description A new CAN message was received Parameter bChannel_p CAN Channel that received the message USBCAN_CHANNEL_CHO for CAN Channel 0 USBCAN_CHANNEL_CH1 for CAN Channel 1 InitHwEvent Syntax C public event USBcanServer InitHwEvent Syntax Visual Basic Public Event USBcanServer InitHwEvent Description Device was initialized SYS TEC electronic GmbH 2015 L 487e 29 187 USB CANmodul InitCanEvent Syntax C public event USBcanServer InitCankEvent byte bChannel p Syntax Visual Basic Public Event USBcanServer InitCanEvent _ ByVal bChannel p As Byte Description Specified CAN channel was initialized Parameter bChannel_p CAN Channel that was initialized USBCAN_CHANNEL_CHO for CAN Channel 0 USBCAN_CHANNEL_CH1 for CAN Channel 1 StatusEvent Syntax C public event USBcanServer StatusEvent byte bChannel p Syntax Visual Basic Public Event USBcanServer Statu
118. fer to Table 17 Each flag can be combined pdwPendingCount_p Reference to the variable which is supposed to receive the number of CAN messages in the buffer Return Value Error Code of Function USBCAN_SUCCESSFUL USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHANDLE USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHW USBCAN_ERR_ILLHWTYPE USBCAN_ERR_ILLCHANNEL USBCAN_ERR_CANNOTINIT USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e 29 171 USB CANmodul GetCanErrorCounter Syntax C public byte USBcanServer GetCanErrorCounter byte bChannel p ref int pdwTxErrorCounter p ref int pdwRxErrorCounter p Syntax Visual Basic Public Function USBcanServer GetCanErrorCounter _ ByVal bChannel p As Byte _ ByRef pdwTxErrorCounter p As Integer _ ByRef pdwRxErrorCounter p As Integer As Byte Usability CAN_INIT as of Version 3 06 and higher as of sysWORXX Description Reads the current count within the CAN Controller These values are directly read by the hardware Parameter bChannel_p CAN CHANNEL USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 pdwTxErrorCounter_p Reference to a variable which is supposed to receive outbound messages pdwAxErrorCounter_p Reference to a variable which is supposed to receive inbound messages Return Value Error Code of Function USBCAN_SUCCESSFUL USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHANDLE USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHW USBCAN_ERR_ILLHWTY
119. first by Windows e f user is selected in the baud rate field then the values for registers BTRO and BTR1 of the SJA1000 can be entered directly The SJA1000 operates with a 16 MHz clock speed Refer to the SJA1000 manual for calculation of values for other baud rates e When using a sysWORXX USB CANmodul please enter the user specific baud rate into field BTR Ext also see Section 2 3 4 and select the CAN channel you want to use e When using the Multiport CAN to USB 3004006 USB CANmodul2 3204002 3204003 USB CANmodul8 3404000 or USB CANmodul16 3404001 please set which channel is to be used 18 SYS TEC electronic GmbH 2015 L 487e 29 Getting Started e Only for new fourth generation USB CANmoduls a high resolution time stamp for CAN reports can be set via high res timer The column Period in PCANView has a resolution of 100s instead 1ms for the standard variant e Click on the OK button to enable these settings e A new window PCANView Connect to net will appear If applicable enter the message filter for the CAN controller and confirm with OK PCANView Available nets Name Hardware Baudrate _ _ USBCAN 1 CHO hr SYS TEC USB CANmodul 1 MBit sec Message filter ete From ooo Hex To FF Hex o cel e Figure 6 Dialog Box Message Filter Configuration e In this message box you can select Standard 11 bit or Extended 29 bit CAN identifier
120. for all instances n If this parameter is set the dialog box to configure the message filter will be skipped see Figure 6 In this case all CAN messages will always be received t With lt timeout gt the send timeout is set from which a multi channel USB CANmodul dismisses all subsequent CAN reports in ordert o avoid a block of another CAN channel also refer to function UcanSetTxTimeout The standard value is 0 no Timeout r As of V5 00 this parameter indicates that the high resolution time stamp ist o be used The column Period then has a resolution of 100us instead 1ms for the standard variant Example PCANView exe d1 b1000 n The following command allows for starting more than one instance of PCANView from a batch file To run the batch file it is not necessary to wait until the previous PCANView instance is closed start PCANView exe d1 b1000 n x20 y35 start PCANView exe d2 b1000 n x600 y460 SYS TEC electronic GmbH 2015 L 487e_29 23 USB CANmodul Note If PCANView is called with the command line parameters described as above not all settings in the INI file are in effect 24 SYS TEC electronic GmbH 2015 L 487e_29 Getting Started 1 1 8 Creating a debug file from DLL If problems with the software drivers should occur there is a possibility to create a debug log file from USBCAN32 DLL You should always send this log file to our support email address so that we
121. function can only be applied to the baud rate value of sysWORXX USB CANmoduls Parameter dwBTR bp 32 bit Baud Rate Registry Return Value String with respective CAN Baud Rate SYS TEC electronic GmbH 2015 L 487e_29 179 USB CANmodul ConvertToMajorVer Syntax C public static int USBcanServer ConvertToMajorVer int dwVersion p Syntax Visual Basic Public Shared Function USBcanServer ConvertToMajorVer _ ByVal dwVersion p As Integer As Integer Description Converts the version code to major version Parameter dwVersion_p Version code displayed by methods GetHardwarelnfo GetUserDIlVersion or GetFwVersion Return Value Converted Major Version ConvertToMinorVer Syntax C public static int USBcanServer ConvertToMinorVer int dwVersion p Syntax Visual Basic Public Shared Function USBcanServer ConvertToMinorVer _ ByVal dwVersion p As Integer As Integer Description Conbverts the Version Code to Minor Version Parameter dwVersion_p Version code displayed by methods GetHardwarelnfo GetUserDIlVersion or GetFwVersion Return value Converted Minor Version 180 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS ConvertToReleaseVer Syntax C public static int USBcanServer ConvertToReleaseVer int dwVersion p Syntax Visual Basic Public Shared Function USBcanServer ConvertToReleaseVer _ ByWell chiveses iol As Int
122. g whether a valid CAN message was stored to the CAN message structure like shown in upper example Since software version 3 05 the size of the receive buffer maximum number of CAN messages is configurable see function UcanInitCanEx and structure t caninitCanParam SYS TEC electronic GmbH 2015 L 487e_29 99 USB CANmodul UcanWriteCanMsg Syntax UCANRET PUBLIC UcanWriteCanMsg tUcanHandle UcanHandle p tCanMsgStruct pCanMsg p Usability CAN_INIT Description Transmits a CAN message through the USB CANmodul Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx pCanMsg_p Address to a CAN message structure This address must not be NULL typedef struct DWORD m dwID CAN identifier BYTE m bFF CAN frame format BYTE m bDLC CAN data length code BYTE m_bData 8 CAN data DWORD m dwTime has no meaning in this function tCanMsgStruct The meaning of CAN frame format is given with function UcanReadCanMsg For transmission of CAN messages bit USBCAN_MSG_FF_ECHO has no meaning Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_ILLPARAM USBCAN_ERR_DLL_TXFULL USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_WARN_FW_TXOVERRUN 100 SYS TEC electronic GmbH 2015 L 487e 29 UcanWriteCanMsgEx Syntax Software Support for W
123. hich is to be configured USBCAN_CHANNEL_CHO for CAN Channel 0 USBCAN_CHANNEL_CH1 for CAN Channel 1 WBTR_p Baud rate register BTRO as high byte Baud rate register BTR1 as low byte dwBaudrate_p Baud rate register of Multiport CAN to USB 3004006 or USB CANmodul1 2 Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e 29 165 USB CANmodul SetAcceptance Syntax C public byte USBcans rver SetAcceptance byte bChannel p USBCAN CHANNEL CHO int dwAMR p int dwACR p Syntax Visual Basic Public Function USB Optional ByVal Optional ByVal Optional ByVal As Byte Usability CAN_INIT version 3 01 and Description USBCAN AMR ALL USBCAN ACR ALL CENSErver SeLACCEpLance _ bChannel p As Byte USBCAN CHANNEL CHO dwAMR p As Integer USBCAN AMR ALL dwACR p AS lnteger USBCAN ACR ALL higher This function is used to change the acceptance filter values for a specific CAN channel on a device Parameter bChannel_p dwAMR_p dwACR_p Return value Error code of the function CAN Channel which is to be configured USBCAN_CHANNEL_CHO for CAN Channel 0 USBCAN_CHANNEL_CH1 for CAN Channel 1 Acceptance filter mask see section 2 3 5 Acceptance filter code USBCAN_SUCCESSFUL USBCAN_ERR_MAX
124. ice number 0 0 no limitation of serial number 0 0 no limitation of Product Code Example 2 DWORD dwFoundModules find all USB CANmoduls of typ USB CANmodull G3 dwFoundModules UcanEnumerateHardware AppEnumCallback NULL FALSE 0 0 no limitation of device number 0 0 no limitation of serial number USBCAN PRODCODE PID BASIC USBCAN PRODCODE PID BASIC Example 3 DWORD dwFoundModules DWORD dwSerialNr find all logical modules of an USB CANmodull6 G3 dwSerialNr 123456 lt serial number at the sticker at the device case dwFoundModules UcanEnumerateHardware AppEnumCallback NULL FALSE 0 0 no limitation of device number dwSerialNr 1000 1 dwSerialNr 1000 8 USBCAN PRODCODE PID _USBCAN16 USBCAN PRODCODE PID USBCAN16 58 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS UcaninitHardware Syntax UCANRET PUBLIC UcanInitHardware tUcanHandle pUcanHandle p BYTE loDewilesiNie 18 tCallbackFkt fpCallbackFkt_p Usability DLL_INIT Description Initializes an USB CANmodul The software changes into the state HW_INIT From this point other functions as they are defined in Table 12 can be called If the function was executed successfully the function transfers an USB CAN handle to the variable pUcabHandle_p Other functions have to be called with this handle Parameter pUcanHandle_p P
125. identifiers e Length data length code of the message ranges from 0 to 8 e Data values of the messages data bytes up to 8 or the text Remote request if a remote frame shall be sent e Period period of time between the last two message sent Note lf at creation of the message the period was set to 0 the text Wait is shown In this case the message can only be transmitted manually using the lt Space gt bar Or the message is sent automatically after a matching remote frame has been received e Count number of messages sent with this identifier no remote frames since last user reset e Trigger reason for the last transmission of the message Manual manual transmission by the user pressing the lt Space gt bar e Time period of time has passed for periodical sending e RTR remote frame has been received Note Both sections are sorted by the CAN identifiers That means no chronology is displayed In order to edit the Transmit list the following menu commands are available e Transmit gt New Create a new transmit message The editor window for the new message is shown e Transmit gt Delete Delete the currently selected message from the transmit list e Transmit gt Edit Edit the currently selected message e Transmit gt Clear all Delete the entire transmit list e Client gt Reset Reset the message counters and reset the connected USB CANmodul Deletes the receive list 44 SYS TE
126. indows OS UCANRET PUBLIC UcanWriteCanMsgEx tUcanHandle BAR tCanMsgStruct DWORD Usability UcanHandle p bChannel p pCanMsg p pdwCount_p CAN_INIT version 3 00 and higher Description Transmits one or more CAN messages through the specified CAN channel of the USB CANmodul This function may be used alternatively for function UcanWriteCanMsg Parameter UcanHandle_p pCanMsg_p bChannel_p pdwCount_p USB CAN handle received with the function Ucan nitHardware or UcaninitHardwareEx Address to a CAN message structure This address must not be NULL CAN channel to read data from USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 Address to a variable that specifies the maximum number of CAN messages to be transmitted After calling this function writes the actual number of CAN messages that were sent to this variable If this parameter is set to NULL only one CAN message will be transmitted The structure tCanMsgStruct is described with function UcanWriteCanMsg Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_ILLPARAM USBCAN_ERR_DLL_TXFULL USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_WARN_FW_TXOVERRUN USBCAN_WARN_TXLIMIT SYS TEC electronic GmbH 2015 L 487e 29 101 USB CANmodul Note If this function is called for transmitting more than o
127. isual Basic Public Function USBcanServer ReadCyclicCanMsg _ ByVal bChannel p As Byte _ ByRet pCanMsglist p As t anMsgStruct Gorional syke chConme AS Integer 0 As Et Usability HW_INIT CAN_INIT as of Version 3 06 and higher as of sysWORXX Description Reads back the list of CAN messages from the USB CANmodul which were prior defined for the automatic sending Parameter bChannel_p CAN Channel from which shall be read back USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 pCanMsgList_p Reference to a list of CAN messages as array of type tCanMsgStruct with max 16 entries to where the list of cyclic CAN messages should be copied dwCount_p Reference to a variable to where this method writes the number of cyclic CAN messages within the list Return Value Error Code of Function USBCAN_SUCCESSFUL USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHANDLE USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHW USBCAN_ERR_ILLHWTYPE USBCAN_ERR_ILLCHANNEL USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e 29 175 USB CANmodul EnableCyclicCanMsg Syntax C public byte USBcanServer EnableCyclicCanMsg byte bChannel p int dwFlags p Syntax Visual Basic Public Function USBcanServer EnableCyclicCanMsg _ ByVal bChannel p As Byte _ ByVal dwFlags p As Integer As Byte Usability CAN_INIT as of Version 3 06 and higher as of sysWORXX Description With this function the
128. itHwConnectControlEx X x x x x x UcanEnumerateHardware X x xX X x X UcaninitHardware X x x x xX xX UcanlnitHardwareEx X x x x xX xX UcanlnitHardwareEx2 X x xX xX X xX UcanDeinitHwConnectControl X X X X X x HW_INIT UcanGetFwVersion X X X X X X UcanGetHardwarelnfo X X X X X X UcanGetModuleTime X X X X X X UcanSetDeviceNr X X X X X X UcanGetHardwarelnfoEx2 XHO XHO X XHO x XHO UcanGetStatus X X CHO X CHO X UcanGetStatusEx XHO XHO X XHO X XHO UcanResetCan X X CHO X CHO X UcanResetCanEx XHO XHO X XHO x XHO UcaninitCan X X CHO X CHO X UcaninitCanEx X X CHO X CHO X UcaninitCanEx2 XHO XHO X XHO x XHO UcanWriteCanPort X CHO CHO UcanWriteCanPortEx XHO X X UcanReadCanPort X CHO CHO UcanReadCanPortEx XHO X X UcanConfigUserPort X X X UcanWriteUserPort X X X UcanReadUserPort X X X UcanReadUserPortEx X X X UcanDefineCyclicCanMsg X XHO X XHO UcanReadCyclicCanMsg X XHO X XHO UcanDeinitHardware X X X X X X CAN_INIT UcanSetTxTimeout X X 3 UcanSetBaudrate X X CHO X CHO X UcanSetBaudrateEx XHO XHO X XHO x XHO UcanSetAcceptance X X CHO X CHO X UcanSetAcceptanceEx XHO XHO X XHO x XHO UcanReadCanMsg X X CHO X CHO X UcanReadCanMsgEx XHO XHO X XHO x XHO UcanWriteCanMsg X X CHO X CHO X UcanWriteCanMsgEx XHO XHO X XHO x XHO UcanGetMsgCountinfo X CHO X CHO X UcanGetMsgCountInfoEx XHO X XHO X XHO UcanEnableCyclicCanMsg
129. l protection circuitry and further testing if cables to the product s connectors are longer than 3 m It is required to use shielded CAN cables The USB CANmodul fulfills the norms of the European Union s Directive for Electro Magnetic Conformity only in accordance to the descriptions and rules of usage indicated in this hardware manual particularly in respect to the described steps for putting the device into operation Implementation of SYSTEC products into target devices as well as user modifications and extensions of SYSTEC products is subject to renewed establishment of conformity to and certification of Electro Magnetic Directives Only after doing so the devices are allowed to be put into circulation SYS TEC electronic GmbH 2015 L 487e 29 1 USB CANmodul 2 SYS TEC electronic GmbH 2015 L 487e 29 Introduction Introduction Unveiled in 1995 the Universal Serial Bus USB connectivity standard provides a simple and convenient way to connect various peripheral devices to a host PC It will replace a wide variety of serial and parallel connections The USB standard allows up to 127 devices to be connected to the PC without using multiple connector types without interrupt conflicts IRQs hardware address adjustments jumpers or channel changes DMA USB provides powerful true hot plug and play capability i e dynamic attach and recognition for new devices It allows the user to work with those devic
130. le referring to parameter pszFilePathName_p does already exist the old content will be deleted upon opening Value 1 though will append all new debug information to an existing file Return value If FALSE returns the debug log file could not be created A possible reason could be that the directory path which is set by the parameter pszFilePathName_p does not exist Example set debug mode for USBCAN API UcanSetDebugMode 0xEOCOOBO03L default Debug Level _T C MyAppPath MyApp log 0 no append mode SYS TEC electronic GmbH 2015 L 487e 29 49 USB CANmodul UcanGetVersion Syntax DWORD PUBLIC UcanGetVersion void Usability DLL_INIT HW_INIT CAN_INIT Description This function returns the software version number of the USBCAN library It is overage an should not be used in current projects Use the function UcanGetVersionEx instead of Parameter none Return value Software version number as DWORD with the following format Bit O to 7 least significant digits of the version number in binary format Bit 8 to 15 most significant digits of the version number in binary format Bit 16 to 30 reserved Bit 31 1 customer specific version Example DWORD dwVersion _TCHAR szVersion 8 get version number dwVersion UcanGetVersion convert into a string _stprintf szVersion T V ed 2d dwVersion amp Oxff00 gt gt 8 dwVersion amp
131. le wire CAN transceiver AU5790 3204017 Galvanic isolation available with order no 3204003 3204018 Micro controller s 8 bit user port I O with TTL level provides 3204019 for customer specific extensions with order no 3204007 3304003 3304005 USB CANmodul2 Revision 2 R2 same as above but includes better EMC behaviour USB CANmodul2 Revision 3 R3 fourth Generation Redesign with new 32 Bit micro controller 2 CAN channels Power supply USB cable Highspeed CAN transceiver 82C251 or Lowspeed CAN Transceiver TJA1054 resp Single Wire CAN transceiver AU5790 Galvanically isolated Customer specific extensions via a free 8 Bit Port on the micro controller only with 3204007 SYS TEC electronic GmbH 2015 L 487e_29 USB CANmodul Order number Features 3404000 USB CANmodul8 3304000 8 CAN channels independently utilizable Table case Contains 4 logical devices with 2 channels each Fast 32 bit MCU enhanced firmware External power supply with 230VAC 500mA inlet connector for non heating devices Galvanic isolation of the CAN channels 3404001 USB CANmodul16 16 CAN channels independently utilizable Table case Contains 8 logical devices with 2 channels each Fast 32 bit MCU enhanced firmware External power supply with 230VAC 500mA inlet connector for non heating devices Galvanic isolation of the CAN channels SYS TEC electronic GmbH 2015 L 487e_29
132. ls Serial Nr DevNr Device Type Fimware Version drv ME V5 09 r56 n 000255774 1 USB CANmodul2 ogger V5 09 r20 Show Firmware Update Info dialog f firmware update disabled and firmware version is older E Manual firmware update Figure 3 USB CANmodul Control Tool e Select highlight one of the modules shown in the hardware list and then click on the Change button Note The device number of USB CANmoduls grayed out in the list cannot be changed because they are used by other applications 16 SYS TEC electronic GmbH 2015 L 487e 29 Getting Started serial number 1156023 a device number i v T use USB C Nnetwork driver always write firmware to flash after each USB connect Figure 4 Device Number Selection Dialog Box e Enter a new device number in the input field or modify the device number using the Up or Down button Click OK to exit this window e The new device number will only take affect and gets downloaded into the device after clicking the Apply or OK button 1 1 6 Connection to a CAN Network The USB CANmodul provides a DB 9 plug for connection to the CAN network The pin assignment on this connector is in accordance to the CiA CAN in Automation specification Connect your CAN network to this connector with an appropriate CAN bus cable The pinout is described in Table 3 on page 29 Note When using the standard version of the
133. ls EN and STB are outputs and the signal ERR is an input For more information refer to section 1 4 42 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS 2 2 2 PCANView USBCAN for Windows The Windows utility PCANView USBCAN can be used to display CAN messages transmitted via the CAN bus After execution of the tool a dialog box is shown for configuring the hardware parameters refer to Figure 5 The device number of the logical USB CANmodul has to be filled in to the edit field Device Nr This device number was previously programmed with the Windows Control Panel symbol USB CANmodul Control refer to section 1 1 5 Within the drop down box Baudrate the baud rate on CAN bus can be selected The option listen only configures the CAN controller for only receiving CAN messages This also means that no acknowledge will be sent back to the sending remote CAN device For a logical USB CANmodul including two CAN channels the channel has to be selected which should be used by the tool After applying the settings by clicking to the OK button a dialog box is shows like displayed in Figure 6 The filter setting depends on the CAN message format you wish to receive CAN identifier with 11 bits standard frame CAN Spec 2 0A or CAN identifier with 29 bits extended frame CAN Spec 2 0B Please choose one of both possibilities and enter the range of the CAN messages which has to be shown on recei
134. ltage 3 2 3 4 V Table 8 Expansion Port Signal Properties on USB CANmodul2 G3 32 SYS TEC electronic GmbH 2015 Getting Started Symbol Parameter Bedingung min typ max Einheit Vin Input High Voltage 2 0 5 5 V Vil Input Low Voltage 0 3 0 8 V VoH Output High Voltage lout 8 mA 2 9 V VoL Output Low Voltage lout 8 mA 0 4 V Cin Input Pin Capacitance 5 pF lout Output Current 8 0 mA Vcc Supply Voltage 3 2 3 4 V Table 9 Properties of port expansion on USB CANmodul2 G4 A user circuit of the Expansion Port depends on the necessity to which level the hardware of USB CANmodul has to be protected against destruction You find an example of a user circuit without protection in the next figure default high Sl rae 8 bit Port Extension 1 Button GND Button default low GND Figure 14 simple example circuit for Expansion Port Please note that if Vcc is used as power supply for your circuit the total current of an USB device may not exceed 500 mA during plug in the total current actually may not exceed 100 mA If bus powered USB hubs are used there could be problems even below 500 mA Some USB hubs share its power supply with the number of available USB ports Please note that there could also be problems below 500 mA if other USB devices are connected to these ports Thus we advise to implement a galvanic decoupled circuit that has its own power
135. ly exception is the function UcanReadCanMsg which can also return warnings The warning USBCAN_WARN_NODATA indicates that no CAN messages are in the buffer Other warnings show the calling function that an event has occurred but a valid CAN message is transferred All possible return codes for the functions of the USBCAN library are listed below USBCAN_SUCCESSFUL Value 0x00 Description This message returns if the function is executed successfully USBCAN_ERR_RESOURCE Value 0x01 Description This error message returns if one resource could not be generated In this case the term resource means memory and handles provided by Windows USBCAN_ERR_MAXMODULES Value 0x02 Description An application has tried to open more than 64 USB CANmoduls The standard version of the USBCAN library only supports up to 64 USB CANmoduls at the same time under Windows CE only 9 This error also appears if several applications try to access more than 64 USB CANmoduls For example application 1 has opened 60 modules application 2 has opened 4 modules and application 3 wants to open a module Application 3 receives this error message USBCAN_ERR_HWINUSE Value 0x03 Description An application tries to initialize an USB CANmodul with the device number x If this module has already been initialized by its own or by another application this error message is returned SYS TEC electronic GmbH 2015 L 487e 29 121 USB CANmodul USBCAN_ERR_IL
136. ly read from the hardware Parameter UcanHandle_p bChannel_p pdwTxCount_p pdwRxCount_p Return value Error code of the function USB CAN handle received with the function UcaninitHardware or UcaninitHardware Ex CAN channel to read data from USBCAN CHANNEL _CHO for CAN channel 0 USBCAN CHANNEL _ CH for CAN channel 1 Address to a DWORD variable After calling this function writes the current state of the transmit error counter to this variable This parameter must not be NULL Address to a DWORD variable After calling this function writes the current state of the receive error counter to this variable This parameter must not be NULL USBCAN_SUCCESSFUL USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHANDLE USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHW USBCAN_ERR_ILLHWTYPE USBCAN_ERR_ILLCHANNEL USBCAN_ERR_CANNOTINIT USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e 29 105 USB CANmodul 2 3 2 2 Functions for automatic transmission The following functions can only be used for the new sysWORXX modules not for GW 001 and GW 002 They are used to automatic transmission of cyclic CAN messages by the module firmware This results a better cycle time as a Windows PC application could realize Note The accuracy of the cycle time also depends on the configured CAN baud rate A jitter of 10 milliseconds is a result of using a CAN baud rate of 10 kbit per sec There is a maximum of 16 CAN messages which
137. mbH 2015 L 487e 29 USB CANmodul Technical Data e CAN interface Meets the CiA DS 102 Standard and ISO 11898 2 3 Optically isolated voltage supply available as option GW 001 only 2 jumpers for configuration of the CAN voltage supply optically isolated via CAN bus or via USB bus Connection to the CAN bus via DB 9 plug Supports CAN frame format according to specifications for CAN 2 0A and 2 0B 11 and 29 bit CAN identifier Standard version with Philips PCA82C251 CAN transceiver other variants available on request i e low speed and single wire transceivers Further CAN transceivers 820252 TJA1054 TJA1041 AU5790 GW 002 only Connector for adapting other CAN transceivers by user e g B10011S optional power supply via CAN bus depending on CAN transceiver see ordering number intermediate buffer for 768 CAN messages fix value in each direction on the USB CANmodul intermediate buffer for 4096 messages in each direction on the PC changeable since software version 3 05 e USB interface USB connector type B in accordance to the USB standard Power supply through the USB bus max 200mA in operating mode for GW 001 GW 002 USB CANmodul1 and USB CANmodul2 Transmission type Bulk 12MBit s e Power green and status LED red for GW 001 and GW 002 e Power yellow status LED red and traffic LED green for all sysWORXX USB CANmoduls e 8 bit expansion port only GW 002 3204002 and 3204003 e Ope
138. modul can now f f Le wi break be initialized th SetEvent INIT USB CANmodul disconnected case USBCAN _ break EVENT DISCONNECT void PUBLIC UcanCallbackFkt tUcanHandle UcanHandle p BYTE bEvent p what event appeared switch bEvent p CAN messag case USBCAN signal JT ie Wi break changes error s case USBCAN signal ie wi break received EVENT RECEIVE EVENT that the CAN message can be read th SetEvent RECV tatus STATUS that the CAN status can be read th SetEvent STATUS 148 SYS TEC electronic GmbH 2015 L 487e_29 UcanEnumCallback Software Support for Windows OS Syntax void PUBLIC UcanEnumCallback DWORD dwindex p BOOL ELSUSEC Or tUcanHardwareInfoEx pHwInfoEx p tUcanHardwarelnitIinfo plnitinfo p void pArg p Description This callback function is called from the context of the function UcanEnumerateHardware when a connected USB CANmodul is found which matches to the filter parameters passed to UcanEnumerateHardware It may have a different name within the application Parameter dwindex_p flsUsed_p pHwinfoEx _p plnitInfo_p PArg_p Ongoing index which is incremented by the value 1 for each found USB CANmodul The value is O for the first call of this callback functio
139. n This flag is TRUE when the found USB CANmodul is currently exclusively used by another application This parameter only can be TRUE if the function UcanEnumerateHardware was called with the parameter fEnumUsedDevs_p TRUE An USB CANmodul cannot be used by the own application when it is exclusively used by another application Pointer to an instance of the structure of type tUcanHardwarelnfoEx holding the hardware information of the found USB CANmodul see page 81 Pointer to an instance of the structure of type tUcanHardwarelnitinfo This structure controls the further process of the function UcanEnumerateHardware This structure is detailed explained below The user has to fill out this structure before returning from the callback function Additional user parameter which was handed over to function UcanEnumerateHardware by parameter pCallbackArg_p typedef struct _tUcanHardwareInitInfo DWORD m_dwSize size of this structure in bytes BOOL m_fDoInitialize set to TRUE to auto initialize the found module tUcanHandle m_pUcanHandle Pointer to a variable of type tUcanHandle to receive the USB CAN Handle of the found module tCallbackFktEx m_fpCallbackFktEx Pointer to e callback handler tCallbackFktEx for the found module void m pCallbackArg user defined parameter for the callback handler of type tCallbackFktEx BOOL m_fTryNext set to TRUE if UcanEnumerateHardware
140. n value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERRCMD _ 162 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS GetHardwarelnfo Syntax C public byte USBcanServer GetHardwarelnfo ref tUcanHardwareInfoEx pHwInfo p ref tUcanChanneliInfo pCanInfoCh0 p ref tUcanChanneliInfo pCaniInfoChl p Syntax Visual Basic Public Function USBcanServer GetHardwareInfo _ ByRef pHwinfo p As tUcanHardwareInfoEx _ ByRef pCanInfoCh0 p As tUcanChanneliInfo _ ByRef pCanInfoChl p As tUcanChannelInfo As Byte Usability HW_INIT CAN_INIT version 3 01 and higher Description Returns the extended hardware information of a device With Multiport CAN to USB 3004006 and USB CANmodul2 3204002 3204003 the information for both CAN channels is returned separately Parameter pHwInfo_p Pointer to structure where the extended hardware information is to be stored see function UcanGetHardwarelnfoEx2 pCanInfoCh0_p Pointer to structure where the information of CAN channel 0 is to be stored pCaninfoCh1_p Pointer to structure where the information of CAN channel 1 is to be stored Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_ILLPARAM SYS TEC electronic GmbH 2015 L 487e 29 163 USB CANmodul GetStatus Synta
141. nce Manual STM32F205xx Following mathematic correlations apply tPCLK 1 24MHz ta tecik BRP 1 tact on CAN Bus tsYNCSEG 1 ty test ty TS1 1 tase ty TS2 1 tait tsyncsec tes1 tBs2 Time for one bit on CAN Bus Example for 125 kBit s TS1 15 TS2 6 BPR 7 tg tpcik 8 333 3 ns tsYNCSEG 1 tg 333 3 ns tes ta 16 5333 3 ns tee tq 7 2333 3 ns tBit tsyncseac tBs1 tBs2 8000 ns 1 teit 125 kBit s SYS TEC electronic GmbH 2015 L 487e_29 135 USB CANmodul Example will not function for older sysWORXX USB CANmoduls as well as not for GW 001 and GW 002 tUcanHandle UcanHandle UCANRET bRet tUcanInitCanParam InitParam Initialisierungsparameter ausf llen memset amp InitParam 0 sizeof InitParam InitParam m dwSize sizeof InitParam InitParam m bMode kUcanModeNormal InitParam m bBTRO HIBYTE USBCAN BAUD USE BTREX InitParam m bBTR1 LOBYTE USBCAN BAUD USE BTREX InitParam m bOCR USBCAN OCR DEFAULT InitParam m dwAMR USBCAN AMR ALL InitParam m dwACR USBCAN ACR ALL InitParam m dwBaudrate USBCAN BAUDEX G4 250kBit InitParam m wNrOfRxBufferEntries USBCAN DEFAULT BUFFER ENTRIES InitParam m wNrOfTxBufferEntries USBCAN DEFAULT BUFFER ENTRIES CAN Kanal initialisieren bRet UcanInitCanEx2 UcanHandle USBCAN CHANNEL CHO
142. nctions if the extended API functions are used Access violations will occur during runtime otherwise Also note that the callback functions are declared as PUBLIC which is defined as __stdcall in Microsoft Visual Studio UcanConnectControlFkt Syntax void PUBLIC UcanConnectControlFkt BARE bEvent p DWORD dwParam p Description This callback function informs the application program if a new USB CANmodul is connected to the PC or a connected USB CANmodul has been disconnected This callback function is registered with the USBCAN library by function UcaninitHwConnectControl and may have a different name within the application Parameter bEvent p Event which occurred USBCAN EVENT CONNECT 6 USBCAN EVENT _DISCONNECT 7 USBCAN_EVENT_FATALDISCON 8 dwParam_p Additional parameter If bEvent_p 8 then the parameter is returned from the USB CAN Handle of the disconnected module No messages are received from this module and no messages can be sent The corresponding USB CAN Handle is invalid in other instances the parameter is 0 142 SYS TEC electronic GmbH 2015 L 487e 29 UcanConnectControlFktEx Syntax Software Support for Windows OS void PUBLIC UcanConnectControlFktEx DWORD DWORD void Description dwEvent p dwParam p pArg p This callback function informs the application program if a new device is connected to the PC ora connected device has been disconnected This
143. ndows Vista 1 1 3 Updating an Existing Installation Follow the steps below if you have an existing USB CANmodul installation and just want to update the driver 14 Start your computer Open the Windows Explorer Go to path lt CD ROM gt Products USB CANmodul_ xxxxxx Software SO 387 Execute file SO 387 exe which will start the setup tool Follow the setup instructions to install the USB CANmodul software and click Finish at the end of the process Connect the USB CANmodul to your computer using the included USB cable SYS TEC electronic GmbH 2015 L 487e 29 Getting Started 1 1 4 Verifying the Device Installation Verification of correct device installation on your host PC can be done by following the steps listed below e Open the System Control from the start menu of Windows e Click the symbol System Under Vista this symbol can be found in the Classic View Under Windows 7 it may be necessary to re adjust the View By mode top right corner of the window to Large Icons or Small Icons e Choose the tab Device Manager at the top In Windows 2000 XP and Vista the device manager is located in the Hardware register card e Click on the pull down menu Universal Serial Bus Controller resp USB Controller resp USB CAN Hardware If the device Systec USB CANmodul device driver or Systec USB CANmodul network driver is shown in the list the new USB device has been detected prope
144. ne CAN messages then the return code has also to be checked for the warning USBCAN_WARN_TXLIMIT Receiving this return value only a part of the CAN messages was stored to the transmit buffer in USBCAN32 DLL The variable which is referenced by the parameter pdwCount_p gets the number of successfully stored CAN messages The part which was not stored to the transmit buffer has to be tried to be sent again by the application Otherwise they will be lost You can use the macro USBCAN_CHECK_TX_NOTALL for checking the return value whether some CAN messages could not be copied to the transmit buffer see lower example The macro USBCAN CHECK TX SUCCESS checks whether all CAN messages could be stored to the transmit buffer while the macro USBCAN_CHECK_TX_OK checks whether one CAN message at least was stored to the transmit buffer Example tUcanHandle UcanHandle tCabMsgStruct TxCanMsg 10 UCANRET bRet DWORD dwCount transmit up to 10 CAN messages dwCount sizeof TxCanMsg sizeof tCabMsgStruct bRet UcanWriteCanMsgEx UcanHandle USBCAN CHANNEL CHO amp TxCanMsg amp dwCount Check whether no error occurred Le USBCAN CHECK TX OK bRet check whether a part of the array was not sent if USBCAN CHECK TX NOTALL bRet check whether there was another warning else if USBCAN CHECK WARNING bRet PrintWarning bRet check wheher an error occur
145. nn rannent neee 47 Constants for the type of version information 51 Constants for CAN transmission mode 70 Constants for Product Code Hardware Type ccceseseeeeeeeeeeeeeeeeenneeeeeeenaeeeeneea 82 Constants for the CAN frame format 94 Constants for the flags parameter in function UcanGetMsgPending 103 Constants for the flags parameter in function UcanEnableCyclicCanMsg 111 Constants for low speed CAN portReturn value 114 Examples for non listed bit rates 137 Constants for CAN channel selection 141 tested Windows CE versions and CPU types cccceececeeeesteeeeeteeeeeeeeeeeneeeeeseeaees 196 SYS TEC electronic GmbH 2015 L 487e 29 Preface Preface This USB CANmodul Systems Manual describes the board s design and function Precise specifications for the on board microcontrollers can be found in the enclosed microcontroller Data Sheet User s Manual In this manual and in the attached schematics low active signals are denoted by a in front of the signal name i e RD A 0 indicates a logic zero or low level signal while a 1 represents a logic one or high level signal Declaration of Electro Magnetic Conformity for the SYS TEC USB CANmodul The USB CANmodul is a tested and ready to use interface device and must only be used as such Note The USB CANmodul should not be operated without additiona
146. nnel 0 is available Parameter bChannel_p wBTR _p dwBaudrate p dwAMR_p dwACR _p bMode _p bOCR p 160 CAN channel to beinitialized USBCAN CHANNEL _CHDO for CAN channel 0 USBCAN CHANNEL _CH1 for CAN channel 1 Baud rate register BTRO as high byte Baud rate register BTR1 as low byte Baud rate register of Multiport CAN to USB and USB CANmodul1 2 Acceptance filter mask see section 2 3 5 Acceptance filter code Transmission mode of CAN channel Output Control Register SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_RESOURCE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e_29 161 USB CANmodul ResetCan Syntax C public byte USBcanServer ResetCan byte pbChannel p Syntax Visual Basic Public Function USBcanServer ResetCan _ ByVal pbChannel p As Byte As Byte Usability HW_INIT CAN_INIT version 3 01 and higher Description Resets a CAN channel of a device see function UcanResetCan With GW 001 and GW 002 only CAN channel 0 is available Parameter bChannel_p CAN channel to be reset USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 dwFlags_p These flags indicate what has to be set back and what not These flags can be combined with each other Retur
147. ns during setup process Sub Folder Contents Bin Program files PCANView Contrib Files contributed by other companies Borland Delphi Delphi class with demo in source is removed LabView LabView driver with demo Examples Demo projects Demo MFC demo in source for GW 002 and MS Visual Studio 2003 or higher DemoGW006 MFC demo in source for an USB CANmodul including two CAN channels and MS Visual Studio 2003 or higher DemoCyclicMsg MFC demo in source for MS Visual Studio 2003 or higher and automatically transmitting of cyclic CAN messages using a sysWORXX USB CANmodul Include C header files for USBCAN32 DLL The demo applications for MS Visual Studio refers to these files Lib Common USBCAN32 DLL USBCAN64 DLLand import libraries for MS Visual Studio The demo applications refer to this import library UcanDotNET Wrapper DLL in source code for use with Microsoft NET projects USBcanDemoNET MS Visual Basic NET demo application in source code using the Wrapper DLL UcanDotNET dll Docu Manuals Drv Windows Kernel drivers Table 11 Software File Structure SYS TEC electronic GmbH 2015 L 487e 29 41 USB CANmodul 2 2 Tools for the USB CANmodul 2 2 1 USB CANmodul Control The USB CANmodul Control tool replaces the UCAN Config tool starting at version 2 18 This tool can be started either from the Control Panel or from the program group USB CANm
148. ntax Visual Basic Public Function USBcanServer InitHardware _ Optional ByVal bDeviceNr p As Byte _ USBCAN ANY MODULE As Byte Public Function USBcanServer InitHardware _ ByVal dwSerialNr p As Integer As Byte Usability 1 DLL_INIT version 3 01 and higher 2 DLL_INIT version 5 08 and higher Description Initializes the device with the corresponding device or serial number 1 2 1 2 Parameter bDeviceNr_p device number 0 254 Value USBCAN_ANY_MODULE 255 is used to indicate that the first available device shall be used dwSerialNr_p serial number The value can be found at the sticker at the ground of the case or at the back Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_HWINUSE USBCAN_ERR_ILLHW USBCAN_ERR_MAXMODULES USBCAN_ERR_RESOURCE USBCAN_ERR_ILLVERSION 158 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS Shutdown Syntax C public byte USBcanServer Shutdown int dwChannel p USBCAN CHANNEL ALL bool fShutDownHardware p true Syntax Visual Basic Public Function USBcanServer Shutdown Optional ByVal dwChannel p As Integer USBCAN CHANNEL ALL _ Optional ByVal fShutDownHardware p As Boolean _ True as Byte Usability HW_INIT version 3 01 and higher Description Shuts down an initialized device that was initialized with method nitHardware or InitCan The softw
149. nting to a variable that contains the read input value following the successful return of this function This variable then has the following meanings see also section 1 4 Constant Bit Description value UCAN_CANPORT_TRM 0x10 IN termination resistor UCAN_CANPORT_ERR 0x20 IN error signal of low speed CAN transceiver UCAN_CANPORT_STB 0x40 OUT stand by signal of low speed CAN transceiver UCAN_CANPORT_EN 0x80 OUT enable signal of low speed CAN transceiver Table 19 Constants for low speed CAN portReturn value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLPARAM USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD _ 114 SYS TEC electronic GmbH 2015 L 487e_29 UcanReadCanPortEx Syntax Software Support for Windows OS UCANRET PUBLIC UcanReadCanPortEx tUcanHandle BAR BARRA BARRA Usability UcanHandle p bChannel p pbinValue p pbLastOut_p HW_INIT CAN_INIT version 3 00 or higher Description Reads the current input value from the specified CAN channel This function may be used alternatively for function UcanReadCanPort Parameter UcanHandle_p bChannel_p pbinValue_p pbLastOut_p Return value Error code of the function USB CAN handle received
150. odul Utilities Figure 3 shows the tool after start up This tool can be used to modify the device number of the USB CANmoduls also refer to section 1 1 5 In addition this tool can also be used to manipulate the 8 bit port expansion refer to section 1 5 and the CAN port for low speed CAN transceivers refer to section 1 4 To do this you have to select the corresponding USB CANmodul from the list and then click on the Ports button Figure 17 shows the dialog box that will appear when choosing this option T User port PBO PB1 PB2 PB3 PB4 PB5 PBG PB DO 0 0 Output Enable Input Output STB RA TRM Enable Stand By Error Termination Resistor Update Input Figure 17 Dialog Box for Manipulating the Port Expansion and the CAN Port Initially all 8 signals are configured as inputs With the column OE the corresponding signal is switched to an output This activates the box for the output value in the OUT column If a signal is switched to a logical 1 in this column then the corresponding signal on the port expansion will be set to high With every modification the current state of the expansion port will be read again and shown in the IN column for the inputs To read the current input states without having to change an output click on the Update Input button The current state of the CAN port for the low speed CAN transceiver is displayed on the right side of the window The signa
151. of the USB CANmodul with the lower 16 bits Table 15 lists all possible values Constant Value Hardware Type USBCAN PRODCODE PID_GW001 0x1100 USB CANmodul of first generation G1 PID_GW002 0x1102 USB CANmodul of second generation G2 PID_ MULTIPORT 0x1103 Multiport CAN to USB of third generation sysWORXX G3 including 16 CAN channels PID_ BASIC 0x1104 USB CANmodul1 of third generation sysWORXX G3 including one CAN channel PID_ ADVANCED 0x1105 USB CANmodul2 of third generation sysWORXX G3 including 2 CAN channels PID_USBCANS 0x1107 USB CANmodul8 of third generation sysWORXX G3 including 8 CAN channels PID_USBCAN16 0x1109 USB CANmodul1i6 of third generation sysWORXX G3 including 16 CAN channels PID_ RESERVED3 0x1110 Resered PID_ ADVANCED G4 0x1121 USB CANmodul2 of fourth generation sysWORXX G4 including 2 CAN channels PID_BASIC_G4 0x1122 USB CANmoduli of fourth generation sysWORXX G4 including one CAN channel PID RESERVED 0x1144 Resered PID_ RESERVED2 0x1145 Resered rt Table 15 Constants for Product Code Hardware Type Use the following macros for getting information about the support of several new features USBCAN_ CHECK SUPPORT _CYCLIC MSG pHwindoEx This Macro checks whether the logical USB CANmodul supports the automatic transmission of cyclic CAN messages 82 SYS TEC electronic GmbH 2015 L
152. oftware Software state CAN_INIT DLL_INIT HW_INIT Status LED Structure 202 4 35 37 141 26 35 18 43 11 79 11 41 196 45 45 45 27 USBCAN library tCanMsgStruct tStatusStruct tUcanChannellnfo tUcanHardwarelnfo tUcanHardwarelnfoEx tUcanHardwarelnitInfo tUcaninitCanParam tUcanMsgCountinfo Technical Data termination resistor Traffic LED transmit echo Type A Plug Type B Plug UCANNET SYS USB USB Connectors USBCAN32 DLL USBCANDRV DLL USBCAN library USBCANLS H USB CANmodul Control USB CANmodul1 USB CANmodul16 USB CANmodul2 USB CANmodul2 IP65 USB CANmodul8 USBCANUP H Windows CE SYS TEC electronic GmbH 2015 94 100 86 82 79 81 149 69 84 10 17 30 34 27 70 3 26 3 3 45 196 45 197 111 42 5 35 6 5 35 36 141 40 6 116 196 L 487e_29 Index SYS TEC electronic GmbH 2015 L 487e 29 203 Suggestions for Improvement Document USB CANmodul Document number L 487e_29 Edition February 2015 How would you improve this manual Did you find any mistakes in this manual page Submitted by Customer number Name Company Address Return to SYS TEC electronic GmbH Am Windrad 2 D 08468 Heinsdorfergrund Germany Fax 49 0 3765 38600 4100 SYS TEC electronic GmbH 2015 L 487e 29
153. ointer to the variable for the USB CAN Handle This pointer may not be NULL bDeviceNr_p Device number of the USB CANmodul 0 254 The value USBCAN_ANY_MODULE 255 makes sure that the first allocated USB CANmodul is used foCallbackFkt_p Address to the callback function of this USB CANmodul This value can be NULL The callback function will not be called if corresponding events appear This address can also be same as one that is already used from other USB CANmoduls because the callback function contains the associated USB CAN Handle The callback function must have the following format see section 2 3 7 void PUBLIC UcanCallbackFkt tUcanHandle UcanHandle p BYTE bEvent_p SYS TEC electronic GmbH 2015 L 487e 29 59 USB CANmodul Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_HWINUSE USBCAN_ERR_ILLHW USBCAN_ERR_MAXMODULES USBCAN_ERR_RESOURCE USBCAN_ERR_ILLVERSION USBCAN_ERR_ILLPARAM USBCAN_ERR_IOFAILED USBCAN_ERR_BUSY USBCAN_ERR_TIMEOUT USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERRCMD Example UCANRI ET bRet tUcan Handle UcanHandle initializes an USB CANmodul without callback function bRet UcanInitHardware amp UcanHandle USBCAN ANY MODULE NULL 60 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS UcaninitHardwareEx Syntax UCANR
154. on Returns the firmware version number of the device Parameter none Return value Firmware version number as Integer with the following format Bit 0 7 Version Bit 8 15 Revision Bit 16 31 Release 152 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS GetUserDIIVersion Syntax C public int USBcanServer GetUserD1l1Version Syntax Visual Basic Public USBcanServer GetUserDllVersion as Integer Usability DLL_INIT HW_INIT CAN_INIT version 3 01 and higher Description Returns the version number of the USBCAN library Parameter none Return value Software version number as Integer with the following format Bit 0 7 Version Bit 8 15 Revision Bit 16 31 Release SYS TEC electronic GmbH 2015 L 487e_29 153 USB CANmodul EnumerateHardware Syntax C public USBcanServer USBcanServer EnumerateHardware byte bDeviceNrLow p byte bDeviceNrHigh p int dwSerialNrLow_p int dwSerialNrHigh p int dwProductCodeLow p int dwProductCodeHigh p EnumDelegateCallback fpCallback p NULL bool rrnumUsedDevs 9 praise public USBcanServer USBcanServer EnumerateHardware byte bDeviceNrLow p byte bDeviceNrHigh p EnumDelegateCallback fpCallback p NULL bool fEnumUsedDevs p false public USBcanServer USBcanServer EnumerateHardware int dwProductCodeLow p int dwProductCodeHigh p EnumDelegateCallback fpCallback p N
155. ontroller automatically filters messages in PeliCAN mode Single Filter Mode The configurations of the filter are transferred to the function UcaninitCan as parameter dwAMR_p and dwACF_p It is also possible to change these values later after calling the function UcaninitCan with the function UcanSetAcceptance The following mechanism is used for filtration AMR Bit ACR Bit Bit of the CAN ID 0 0 0 0 1 1 1 0 xX 1 1 x The corresponding bit of the CAN identifier has to be 0 The corresponding bit of the CAN identifier has to be 1 The corresponding bit of the CAN identifier can be either 0 or 1 These bits correspond to a Standard frame 11 bit identifier for GW 001 GW 002 as well as sysWORXX modules since firmware version 3 10 dwACR_p 31 30 21 20 19 16 15 14 7 6 y dwAMR_p 31 30 21 20 19 16 15 14 7 6 y CAN Identifier Data Byte 0 Data Byte 1 R 10 9 0 T free 7 6 7 6 R 138 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS b Extended frame 29 bit identifier for GW 001 GW 002 as well as sysWORXX modules since firmware version 3 10 dwACR_p 31 30 a 3 2 1 0 U dwAMR_p 31 30 3 2 1 0 U CAN Identifier free D N DAD 28 c Standard Frame 11 Bit Identifier for all sysWORXX modules until firmware v
156. or downloading under Software updates can be load from http Awww systec electronic com 12 SYS TEC electronic GmbH 2015 L 487e_29 Getting Started e Start your computer e Insert the USB CANmodul Utility CD ROM in your CD ROM drive e Open the Windows Explorer e Go to path lt CD ROM gt Products USB CANmodul_ xxxxxx Software SO 387 Execute file SO 387 exe which will start the setup tool e Click on OK to start the setup program The following window will appear eG Setup USB CANmodule Utility Disk 2 18 Welcome to the USB CANmodule Utility Disk V2 18 Setup Wizard This will install USB CAN module Utility Disk on your computer It is recommended that you close all other applications before continuing Click Next to continue or Cancel to exit Setup SYS TEC electronic GmbH August Bebel Str 29 D 07973 Grelz Germany Tel 49 3661 6279 0 wmww systec electronic com support systec electronic com A company of the PHYTEC Technology Holding AG Cancel e Click Next Accept the License Agreement in the next window and click Next again e In the next windows you select the destination location of the USB CANmodul software and the type of installation you wish to perform Full Installation is recommended e Follow the setup instructions to install the USB CANmodul software and click Finish at the end of the process e Connect the USB CANmodul to your computer using the incl
157. or the definition of the structure tCanMsgStruct Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHANDLE USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHW USBCAN_ERR_ILLHWTYPE USBCAN_ERR_ILLCHANNEL USBCAN_ERRCMD_ SYS TEC electronic GmbH 2015 L 487e 29 109 USB CANmodul UcanEnableCyclicCanMsg Syntax UCANRET PUBLIC UcanEnableCyclicCanMsg tUcanHandle UcanHandle p BYTE bChannel p DWORD dwFlags p Usability HW_INIT CAN_INIT version 3 06 and higher only sysWORXX modules Description This function specifies the mode of the automatic transmission and specifies whether the automatic transmission of a previous defined set of defined CAN messages should be enabled or disabled Additionally separate CAN messages of the set can be locked or unlocked Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx bChannel_p CAN channel USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 dwFlags_p Specifies flags containing the mode the enable state and the locking state refer to Table 18 These flags can be combined Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHANDLE USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHW USBCAN_ERR_ILLHWTYPE USBCAN_ERR_ILLCHANNEL USBCAN_ERR_CANNOTINIT USBCAN_ERRCMD _ 110 SYS TEC electronic GmbH 2015 L 487e
158. plemented for other platforms at which the library has another file name e g USBCANCE DLL under Windows CE or at which the library is not a DLL e g under Linux Folders lt SETUP_DIR gt DEMO API lt SETUP_DIR gt DEMOGWO006 and lt SETUP_DIR gt DEMOCYCLICMSG contains example programs written using MFC in Microsoft VisualC C 6 0 and 7 0 These example projects demonstrates the use of the DLL API functions 2 3 1 Attributes of the USBCAN library With USBCAN library it is possible to use 64 USB CANmoduls simultaneously with one application program as well as with several application programs using Windows CE only 9 modules However it is not possible to use one USB CANmodul with several application programs Three states within the software are generated for each USB CANmodul when using this DLL After starting the application program and loading the DLL the software is now in the DLL_INIT state Concurrently all required resources for the DLL have been created Calling the library function UcaninitHardware and or UcaninitHardwareEx causes the software to change into the HW_INIT state This state contains all resources required for communication with the USB CANmodul It is not possible to transmit or to receive CAN messages in this state If the application software calls the library function UcaninitCan UcaninitCanEx or UcanInitCanEx2 the state changes into CAN_INIT In this state it is possible to transmit or
159. position of the sample points m henik Baud Rate Prescaler BRP mre sEG1 ____ gt lei TSEG2 SYNCSEG a nominal bit time _ gt sample point s Possible values are BRP 000001 TSEG1 0101 and TSEG2 010 Figure 23 General structure of a single bit on the CAN bus source SJA1000 manual The following mathematical connections apply tcLk 1 16MHz system clock tscl 2 tcik BRP 1 bus clock tsyncsee 1 tsal ttsea1 tsa TSEG1 1 trsec2 tscl TSEG2 1 teit tsyncsec TSEG1 tTsEG2 time of one Bit on the CAN bus SYS TEC 129 electronic GmbH 2015 L 487e_29 USB CANmodul Example for 125 kBit s TSEG1 1 TSEG2 12 BPR 3 tsel 2 tcak 4 500 ns tsyncsea 1 tso 500 ns TSEG1 tsa 2 1000 ns tTsEG2 tsi 13 6500 ns tBit ISYNCSEG TSEG1 tTsEG2 8000 ns 1 teit 125 kBit sec 2 3 4 2 Baud Rate Configuration for sysWORXX Modules Note The configuration of the baud rate differs significantly between the older USB CANmodul versions GW 001 and GW 002 and the new sysWORXX modules For standardized baud rate values see section 2 3 4 the baud rate registers BTRO and BTR1 are as well applicable for the new sysWORXX modules Therefore set m_dwBaudrate to USBCAN BAUDEX USE BTRO1 The following default values are available for sysWORXX modules USBCAN_BAUDEX_1MBit USBCAN_BAUDEX_80
160. ption This error message occurs if the function transmits a command to the USB CANmodul but no answer is returned To solve this problem close the application disconnect the USB CANmodul and connect it again USBCAN_ERR_IOFAILED Value Ox0A Description This error message occurs if the communication to the USB CAN driver was interrupted This happens for example if the USB CANmodul is disconnected during the execution of a function USBCAN_ERR_DLL_TXFULL Value 0x0B Description The function UcanWriteCanMsg or UcanWriteCanMsgEx first checks if the transmit buffer within the USBCAN library has enough capacity to store new CAN messages If the buffer is full this error message returns The CAN message transferred to the function UcanWriteCanMsg or UcanWriteCanMsgEx will not be written into the transmission buffer in order to protect other CAN messages from overwriting Since software driver version 3 05 the size of the transmit buffer is configurable see function UcaninitCanEx and Struktur tUcaninitCanParam USBCAN ERR_MAXINSTANCES Value 0x0C Description In this software version a maximum amount of 64 applications are able to have access to the USBCAN library under Windows CE only 9 If more applications attempt access to the DLL this error message will occur In this case it is not possible to initialize an USB CANmodul USBCAN_ERR_CANNOTINIT Value 0x0D Description If an USB CANmodul is initialized with
161. r to 0 V After calling this function all CAN messages received from CAN bus are ignored and not transferred to the PC Parameter UcanHandle_p USB CAN handle received with the function Ucan nitHardware or UcanInitHardwareEx Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD _ SYS TEC electronic GmbH 2015 L 487e 29 77 USB CANmodul UcanDeinitCanEx Syntax UCANRET PUBLIC UcanDeinitCanEx tUcanHandle UcanHandle p BYTE bChannel p Usability CAN_INIT Description Shuts down a selective CAN interface of an USB CANmodul This function sets the operating voltage of the CAN controller to 0 V After calling this function all CAN messages received from CAN bus are ignored and not transferred to the PC Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx bChannel_p CAN channel that is to be shut down USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_CANNOTINIT USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLHW USBCAN_ERR_ILLCHANNEL USBCAN_ERR_DATA US
162. rating temperature 0 C 455 C for GW 001 and GW 002 e Operating temperature 15 C 85 C for all sysWORXX modules e Conforms to CE standard e Optional mounting accessories for DIN rail and wall assembly 10 SYS TEC electronic GmbH 2015 L 487e 29 Introduction Software Support Kernel Mode driver for Windows XP 32 bit edition since driver V4 00 64 bit edition too or higher tested up to Windows 8 USBCANLD SYS USBCANL2 SYS USBCANL3 SYS USBCANL4 SYS and USBCANL5 SYS USBCANL21 SYS and USBCAN22 SYS for automatic firmware download to the USB CANmodul USBCAN SYS supports the various functions of the USB CANmodul UCANNET SYS network driver realizes the use of an USB CANmodul by up to 6 applications User Mode driver for Windows XP 32 bit edition since driver V4 00 64 bit edition too or higher USBCAN DLL and USBCAN64 DLLfor easy use of the USB CANmodul functions Up to 64 CAN channels corresponds to i e 64 USB CANmoduli or 32 USB CANmodul2 Tools for Windows XP 32 bit edition since driver V4 00 64 bit edition too or higher USB CANmodul Control administration and configuration of more than one USB CANmodul by allocation of device numbers PCANView USBCAN CAN monitor program Demo programs in source Microsoft C C using MFC and Microsoft Visual Basic NET Contributor drivers for LabView 8 5 8 6 and 2011 Socket CAN driver for Linux Device driver and Demo for Windows CE 5 0 an
163. rdware information structure read with method GetHardwarelnfo Return Value Displays true if the USB CANmodul is a module of the fourth generation G4 182 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS CheckSupportCyclicMsg Syntax C public static bool USBcanServer CheckSupportCyclicMsg tUcanHardwareInfoEx HwInfoEx p Syntax Visual Basic Public Shared Function USBcanServer CheckSupportCyclicMsg ByVal HwInfoEx p As tUcanHardwareInfoEx As Boolean Parameter HwInfoEx_p Hardware information structure read with method GetHardwarelnfo Return Value Displays true if the USB CANmodul supports automatic sending of cyclic CAN messages CheckSupportTwoChannel Syntax C public static bool USBcanServer CheckSupportTwoChannel tUcanHardwareInfoEx HwInfoEx p Syntax Visual Basic Public Shared Function USBcanServer CheckSupportTwoChannel _ ByVal HwInfoEx p As tUcanHardwareInfoEx As Boolean Parameter HwInfoEx_p Hardware information structure read with method GetHardwarelnfo Return Value Displays true if the USB CANmodul as logic module possesses two CAN channels fit is for instance an USB CANmodul8 it comprises of 4 logic modules with 2 CAN channels each SYS TEC electronic GmbH 2015 L 487e 29 183 USB CANmodul CheckSupportTermResistor Syntax C public static bool USBcanServer CheckSupportTermResistor tUcanHardwa
164. rdware is only supported until driver version V4 18r2 3004006 Multiport CAN to USB with 16 CAN channels 19 rack mounted device Contains 8 logical devices with 2 channels each Fast 32 bit microcontroller External power supply with 230VAC 500mA inlet connector for non heating devices Galvanic isolation of the CAN channels SYS TEC electronic GmbH 2015 L 487e 29 Introduction Order number Features 3204000 USB CANmodul1 3204001 3304001 more compact enclosure with dimensions of 78x45x18 3304004 LxWxH in mm 3304002 Single CAN interface Fast 32 bit MCU enhanced firmware Power supply via USB current consumption max 110mA High speed CAN transceiver 82C251 Galvanic isolation available with order no 3204001 USB CANmodul1 Revision 2 R2 same as above but includes better EMC behaviour 120 ohm termination resistor can be set at PCB USB CANmodul1 Revision 3 R3 same as Revision 2 but with changed capacities USB CANmodul1 Revision 5 R5 fourth generation Redesign with new 32 Bit micro controller 1 CAN channel Power supply via USB cable Highspeed CAN transceiver 82C251 galvanically isolated 3204002 USB CANmodul2 3204003 3204007 Two CAN channels independently utilizable 3204008 Fast 32 bit MCU enhanced firmware 3204009 Power supply via USB 3204011 High speed CAN transceiver 82C251 or Low speed CAN 3204013 transceiver TJA1054 or Sing
165. re 0x00000002 Skip reset of the CAN controller USBCAN_RESET NO TXCOUNTER ie 0x00000004 Skip reset of the transmit message counter USBCAN_RESET_ NO _RXCOUNTER inner 0x00000008 Skip reset of the receive message counter USBCAN_RESET_NO_TXBUFFER_CH ie 0x00000010 Skip reset of the transmit buffers of a specific CAN channel CAN channel is specified by parameter bChannel_p 74 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS USBCAN_RESET NO _TXBUFFER_DLL iii 0x00000020 Skip reset of the transmit buffer for both CAN channels within the DLL USBCAN_RESET_NO_TXBUFFER_FW iii 0x00000080 Skip reset of the transmit buffers of both CAN channels within the device s firmware USBCAN_RESET _NO_RXBUFFER_CH iii 0x000001 00 Skip reset of the receive buffers of a specific CAN channel CAN channel is specified by parameter bChannel_p USBCAN_RESET_NO_RXBUFFER_DLL oe eeececececeeeesesnneeeeeeeseaeeeeeeeecnaeeeeeeeeeaaas 0x00000200 Skip reset of both receive message counters within the DLL USBCAN_RESET NO _RXBUFFER_SYS iii 0x00000400 Skip reset of the receive message counter of both CAN channels within the Kernel Mode driver USBCAN_RESET NO _RXBUFFER_ FEW iii 0x00000800 Skip reset of receive message counters of both CAN channels within the device s firmware USBCAN_RESET_FIRMWARE 00 cccccccsescceeceeescneeeeeeeeesneeeeeeessnseeeeeeeessse
166. re loader of USB CANmodul2 G3 3204002 3204003 kVerTypeCpl Ox000A Returns the version of the file USBCANCL CPL USB CANmodul Control from Windows Control Panel kVerTypeSysL21 0x000B Returns the version of loader USBCANL21 SYS for USB CANmodul2 G4 kVerTypeSysL22 0x000C Returns the version of loader USBCANL22 SYS for USB CANmodul1 G4 Table 13 Constants for the type of version information SYS TEC electronic GmbH 2015 L 487e 29 51 USB CANmodul Return value Software version number as DWORD using the following format Bit 0 7 Version Macro USBCAN_MAJOR_VER Bit 8 15 Revision Macro USBCAN_MINOR_VER Bit 16 31 Release Macro USBCAN_RELEASE_VER Example DWORD dwVersion _TCHAR szVersion 16 Get USBCAN library version number dwVersion UcanGetVersionEx kVerTypeUserD1l convert into a string _stprintf szVersion T V d 02d d USBCAN MAJOR VER dwVersion USBCAN MINOR VER dwVersion USBCAN RELEASE VER dwVersion 52 SYS TEC electronic GmbH 2015 L 487e_29 Software Support for Windows OS UcanGetFwVersion Syntax DWORD PUBLIC UcanGetFwVersion tUcanHandle UcanHandle p Usability HW_INIT CAN_INIT version 2 18 and higher Description This function returns the version number of the software in the USB CANmodul Parameter UcanHandle_p USB CAN handle that was received with the function UcaninitHardware or Ucanini
167. reInfoEx HwInfoEx p Syntax Visual Basic Public Shared Function USBcanServer CheckSupportTermResistor _ ByVal HwInfoEx p As tUcanHardwareInfoEx As Boolean Parameter HwInfoEx_p Hardware information structure read with method GetHardwarelnfo Return Value Displays true if the USB CANmodul has load resistors for the CAN bus on board Depending on the article number these have to be connected first CheckSupportUserPort Syntax C public static bool USBcanServer CheckSupportUserPort tUcanHardwareInfoEx HwInfoEx p Syntax Visual Basic Public Shared Function USBcanServer CheckSupportUserPort ByVal HwInfoEx p As tUcanHardwareInfoEx As Boolean Parameter HwInfoEx_p Hardware information structure read with method GetHardwarelnfo Return Value Displays true if the USB CANmodul has a port extension ref section 1 5 184 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS CheckSupportRbUserPort Syntax C public static bool USBcanServer CheckSupportRbUserPort tUcanHardwareInfoEx HwInfoEx p Syntax Visual Basic Public Shared Function USBcanServer CheckSupportRbUserPort _ ByVal HwInfoEx p As tUcanHardwareInfoEx As Boolean Parameter HwInfoEx_p Hardware information structure read with method GetHardwarelnfo Return Value Displays true if the USB CANmodul has a back readable port extension ref section 1 5 Ch
168. red else if USBCAN CHECK ERROR bRet PrintError bRet 102 SYS TEC electronic GmbH 2015 L 487e 29 UcanGetMsgPending Syntax Software Support for Windows OS UCANRET PUBLIC UcanGetMsgPending tUcanHandle BYTE DWORD DWORD Usability UcanHandle p bChannel p dwFlags p pdwCount_p CAN_INIT version 3 06 and higher only sysWORXX modules Description This function returns the number of the CAN messages which are currently stored to the buffers within the several software parts The parameter dwFlags_p specifies which buffers should be checked Should the function check more than one buffer then the number of CAN messages will be added before writing to the variable which is referenced by the parameter pdwCount_p Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx bChannel_p CAN channel to read data from USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 dwFlags_p Specifies which buffers should be checked refer to Table 17 The several flags can be combined In that case the number of CAN messages will be added pdwCount_p Address to a variable After calling this function writes the number of CAN messages stored to the specified buffer s to this variable This parameter must not be NULL Constant Value Meaning USBCAN_PENDING FLAG RX D
169. rfergrund Rights including those of translation reprint broadcast photomechanical or similar reproduction and storage or processing in computer systems in whole or in part are reserved No reproduction may occur without the express written consent from SYS TEC electronic GmbH Directly Your local distributor Address SYS TEC electronic GmbH Am Windrad 2 D 08468 Heinsdorfergrund GERMANY ne 49 0 3765 38600 0 You find a list of our distributors DORE info systec electronic com under Technical 49 0 3765 38600 2140 http www systec Support support systec electronic com electronic com distributors Fax 49 0 3765 38600 4100 Web Site http www systec electronic com 29t Edition February 2015 SYS TEC electronic GmbH 2015 L 487e 29 Contents Table of Contents Pr face nn nee en ne Me nan 1 INT OQUCTIONE EE PR E EEEE E N OE E 3 1 Getting Started aaae aar eatae deae ee nn nn 12 1 1 installation sn Sn they ai nn sod adda reset n ets e arts a gnet E 12 1 1 1 Installation of the USB CANmodul under Windows OS 12 1 1 2 Software Installati n sine tnt dt natures 12 1 1 3 Updating an Existing Installation c cc cceeeeeeeeeeeceeeeeeeeeeiaeeeeeeeeeaaeeeeeerenea 14 1 1 4 Verifying the Device Installation ec ccceeeeeeeeeceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeneaaeees 15 1 1 5 Device Number AlloCation ee eeeccecceeeeeencneeeeeeeeenaaeeeeeeeeeaaeee
170. rly This is shown in the figure below Note Starting with version 2 16 of the installation program the USB CANmodul will appear in the device manager under the entry USB CAN Hardware and no longer under the entry USB Controller after setup is completed Datei Aktion Ansicht e m Bo amp E Monitore Netzwerkadapter Dp Prozessoren JE Systemgerate 2 Tastaturen 4 USB CAN Hardware Systec USB CANmodul Device Driver Systec USB CANmodul Network Driver USB Controller USB Virtualisierung Figure 2 Device Manager with the USB CANmodul If the installation was not successful check the installation steps as described above and try to re install SYS TEC electronic GmbH 2015 L 487e 29 15 USB CANmodul 1 1 5 Device Number Allocation With the help of device number allocation it is possible to use more than one USB CANmodul simultaneously on the host PC The device number identifies the individual USB CANmodul e Click on Start gt Settings gt Control Panel Using the Category View in Windows XP additionally click to Other Control Panal Options in Windows Vista use Additional Options In 64 Bit edition of Windows XP or Vista click to View 32 bit Control Panel Items e Click on the USB CANmodul Control symbol The following window will appear ANmodul Control 64 Bit c SYS TEC electronic Gmb Hardware Versions Debug Update g Connected USB CANmodu
171. rtEx For the low speed USB CANmodul2 the signals EN and STB are interconnected at TJA1054 Both signals are switched by using the API function UcanWriteCanPortEx with the bit 6 UCAN_CANPORT_STB Bug fixed API Functions UcaninitHardwareEx and UcaninitHardwareEx2 of version V5 04 returned an error code although the USB CANmodul was successfully initialized Software Version 5 06 New feature USB CANmodul Control can start kernel logger sessions to log debug information from USBCAN kernel drivers Bug fixed USB CANmoduls of third generation G3 only received 2 extended CAN messages CAN2 0B 29 bit CAN ID Then the reception of extended CAN messages stopped Bug fixed With driver version V5 05 Windows freezed after initializing the CAN interface of an USB CANmodul Apparently this occurred on PC with a special type of USB chip sets Software Version 5 07 Bug fixed USB CANmoduls of third generation G3 only received 2 CAN messages if the acceptance filter AMR ACR was configured to only receive any CAN IDs Then the reception stopped for CAN messages which should be passed Bug fixed A BSOD occurred when using usbcan sys and the USB CANmodul was disconnected while actively sending CAN messages Software Version 5 08 New feature A new method EnumerateHardware was added to the UcanDotNET dll class USBcanServer The demo USBcanDemoVB uses this method to show the usage of the new method SYS TEC electronic G
172. s A detailed diagram is available on request Expansion Port for external CAN Transceiver Pin 1 8 bit port Figure 11 Location of CAN and Expansion Port on GW 002 Symbol Parameter Condition min max Unit ViH Input High Voltage 2 0 5 25 _ V Vi Input Low Voltage 0 5 0 8 V VoH Output High Voltage lout 1 6 mA 2 4 V VoL Output Low Voltage lout 1 6 mA 0 4 V Cin Input Pin Capacity 10 pF Voc Supply Voltage 4 75 5 25 V Table 7 Expansion Port Signal Properties on GW 002 Functions for expansion port access are described in section 2 3 2 SYS TEC electronic GmbH 2015 L 487e 29 31 USB CANmodul Figure 12 Figure 13 The pinout of the Expansion Port X400 on USB CANmodul2 is described in Table 6 Please note that pin 1 is located at the upper right corner of X400 This connector is not SD Card ext power a x400 5 VDC Location of the Expansion Port on USB CANmodul2 SD Card Trigger ext power 5 VDC JP104 JP105 x400 JP300 JP200 Position of expansion plugs on USB CANmodul2 G4 build in on all modules Symbol Parameter Condition min max Unit Vin Input High Voltage 2 0 5 5 V Vit Input Low Voltage 0 3 0 8 V VoH Output High Voltage lout 2 MA 2 9 V VoL Output Low Voltage lour 2 MA 0 4 V Cin Input Pin Capacitance 14 1 pF lout Output Current 2 0 mA Vcc Supply Vo
173. s load is much increased 50 and more the CAN messages from application are processed more rarely The result can be that the function UcanWriteCanMsg or UcanWriteCanMsgEx returns the warning indicating a receive overrun SYS TEC electronic GmbH 2015 L 487e_29 107 USB CANmodul UcanDefineCyclicCanMsg Syntax UCANRET PUBLIC UcanDefineCyclicCanMsg tUcanHandle UcanHandle p BYTE bChannel p tCanMsgStruct pCanMsgList p DWORD dwCount_p Usability HW_INIT CAN_INIT version 3 06 and higher only sysWORXX modules Description The function defines a set of up to 16 CAN messages within firmware of an USB CANmodul for the automatic transmission of cyclic CAN messages Call function UcanEnableCyclicCanMsg for enabling the automatic transmission Please note that UcanDefineCyclicCanMsg completely exchanges a previously defined set of CAN messages Parameter UcanHandle_p USB CAN handle received with the function UcaninitHardware or UcanInitHardwareEx bChannel_p CAN channel to transmit to USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 pCanMsgList_p Address to an array of type tCanMsgStruct containing a set of CAN messages for automatic transmission The member m_dwTime of the structure tCanMsgStruct specifies the cycle time This parameter may only be NULL when dwCount_p is zero too dwCount_p Specifies the number of CAN messages included within the array The value r
174. s sent to the PC If a callback function has been handed over to the function UcaninitHardware or UcanInitHardwareEx this callback function is called as well as the event USBCAN_EVENT_STATUS After calling the function UcanGetStatus the error state on the USB CANmodul is erased and the red status LED stops blinking Starting at version 2 17 a CAN status error must be cleared by calling the function UcanResetCan Parameter UcanHandle_p USB CAN handle received with the function Ucan nitHardware or UcanInitHardwareEx pStatus_p Error status of the USB CANmodul typedef struct WORD m_wCanStatus present CAN status WORD m_wUsbStatus present USB status tStatusStruct Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHW 86 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS The WORD m_wCanStatus found in the tStatusStruct structure returns the following values USBCAN_CANERR_OK 0x0000 No error USBCAN_CANERR_XMTFULL 0x0001 Transmit buffer in CAN controller is overrun USBCAN_CANERR_OVERRUN 0x0002 Receive buffer in CAN controller is overrun USBCAN_CANERR_BUSLIGHT 0x0004 Error limit 1 in CAN controller exceeded CAN controller is in state Warning limit now USBCAN_CANERR_BUSHEAVY 0x0008 Error limit 2 in CAN controller exceeded CAN controller is in state Error Passive
175. sEvent ByVal bChannel p As Byte Description Error status for the specified CAN Channel has changed Parameter bChannel_p CAN Channel which error status has been changed USBCAN_CHANNEL_CHO for CAN Channel 0 USBCAN_CHANNEL_CH1 for CAN Channel 1 188 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS Example of an event handler for the status event in Visual Basic NET Private Sub USBcan Status ByVal bChannel p As Byte Handles m USBcan StatusEvent signal event for status changed Dim are As AutoResetEvent _ CType Me m StatusWaitHandles 0 AutoResetEvent are Set End Sub Private Sub ThreadProcStatus Dim fDoExit False Do wait for event handle Dim index As Integer WaitHandle WaitAny Me m StatusWaitHandles status of USB CANmodul changed Dim status As UcanDotNET USBcanServer tStatusStruct Dim bRet As Byte bRet m USBcan GetStatus bChannel p status If bRet UcanDotNET USBcanServer USBCAN SUCCESSFUL Then Console WriteLine CAN status of channel _ bChannel p ToString _ status m wCanStatus ToString X4 Else Console WriteLine Error while reading status _ bRet ToString X2 End If Loop While fDoExit False End Sub SYS TEC electronic GmbH 2015 L 487e 29 189 USB CANmodul DeinitCanEvent Syntax C public event USBcanServer DeinitCanEvent byte bChannel p
176. sg not available for GW 001 GW 002 kUcanModeHighResTimer 0x08 The time stamp of CAN message structure tCanMsgStruct is high resolution for received CAN reports This means the value in the member variable m_dwTime for the standard variant has 100us_ resolution instead 1ms The overrun of the 32 Bit value this is reached every 4d 23h 18min 16 7296s This feature is only available for the newer fourth generation of USB CANmoduls G4 Table 14 Constants for CAN transmission mode Description Initializes the CAN interface of an USB CANmodul with expanded parameters This function works like the function UcaninitCan However it should not be called in combination with UcaninitCan Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_RESOURCE USBCAN_ERR_BUSY USBCAN_ERR_IOFAILED USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHW USBCAN_ERR_DATA USBCAN_ERR_ABORT USBCAN_ERR_DISCONNECT USBCAN_ERR_TIMEOUT USBCAN_ERRCMD _ 70 SYS TEC electronic GmbH 2015 L 487e_29 UcaninitCanEx2 Syntax UCANRET PUBLIC UcanInitCanl tUcanHandle BAGRE tUcanInitCanParam Usability HW_INIT version 3 00 and higher Parameter UcanHandle_p bChannel_p DRAT UcanHandle p bChannel p pinitCanParam p Software Support for Windows OS USB CAN handle that was received with function UcaninitHardware or UcaninitHardwareEx CAN
177. t PC yes on On Log in successful CAN is not initialized no error yes on Off CAN is initialized no error yes on Blinking cycle 2 A CAN bus error occurred on the device Table 1 States of the LEDs on the USB CANmodul GW 001 GW 002 On the Multiport CAN to USB each CAN channel has one Status LED Furthermore each channel has a Traffic LED green indicating CAN bus traffic once the channel has been initialized The Multiport CAN to USB USB CANmodul2 USB CANmodul8 and USB CANmodul16 have the same LED assignment On USB CANmodul1 there is only one traffic LED as there is only one channel available Table 2 contains a list of all LED states SYS TEC electronic GmbH 2015 L 487e 29 USB CANmodul USB CANmodul LED yellow LED red Description connected Power Status no off off No voltage is supplied to the device no on blinking cycle 1 USB cable not connected yes on blinking cycle 1 Device logs in to the host PC yes on on Log in successful CAN channel is not initialized no error yes on off CAN channel is initialized no error yes on blinking cycle 2 A CAN bus error occurred on this channel yes on blinking cycle 3 Firmware update running The device must not be powered off or disconnected while the firmware update is running Table 2 States of the LEDs on the sysWORXX modules All sysWORXX modules also have a green traffic LED for each CAN channel While i
178. t is blinking it shows an active traffic on CAN bus 28 SYS TEC electronic GmbH 2015 L 487e_29 Getting Started 1 3 CAN Supply Voltage No external CAN supply voltage is necessary for the standard version GW 002 or the GW 002 xx0 versions The low speed versions GW 002 xx1 and GW 002 xx2 require an external supply voltage for the CAN transceiver Be sure to note the limitations for the CAN transceivers when connecting the external supply voltage The pin assignment for the DB 9 CAN plug is shown in the table below Pin Pinout of DB 9 plug with 82C251 82C252 TJA1041 with AU5790 single wire TJA1054 differential 1 N C N C 2 CAN L N C 3 GND GND 4 N C N C 5 CAN shield CAN shield 6 GND GND 7 CAN H CAN H 8 N C N C 9 Vcc 7 to 30 VDC Vcc 5 3 to 13 VDC Table 3 Pinout of the CAN DB 9 Plug Note The value for Vcc depends on the alternative CAN transceiver that populates the device For the standard low speed version GW 002 xx2 refer to section 1 7 an input voltage between 12V and 30V can be supplied at pin 9 VCC The nominal voltage amounts to 24V 25 A temporary maximum voltage of up to 35V is allowed The CAN transceiver starts functioning with supply voltages as low as 8V The GW 002 xx2 version features an internal protective circuit and a voltage reduction circuit for the input voltage This means that when supplying the device from an extern
179. tHardwareEx Return value Software version number as DWORD in the following format Bit 0 7 Version Macro USBCAN_MAJOR_VER Bit 8 15 Revision Macro USBCAN_MINOR_VER Bit 16 31 Release Macro USBCAN_RELEASE_VER The version number format is the same format as in the function UcanGetVersionEx SYS TEC electronic GmbH 2015 L 487e_29 53 USB CANmodul UcaninitHwConnectControl Syntax UCANRET PUBLIC UcanInitHwConnectControl t onnectControlrkt fpConnecteControl kt pp Usability DLL_INIT HW_INIT CAN_INIT Description Initializes the supervision for recently connected USB CANmoduls If a new module is connected to the PC the callback function that is indicated in the parameter will be called This callback function is also called if a module is disconnected from the PC Parameter foConnectControlFkt_p Address to the callback function that has to be called if a new USB CANmodul is connected or disconnected This address may not be NULL The callback function must have the following format see section 2 3 7 void PUBLIC UcanConnectControlFkt BISRE bEvent p DWORD dwParam p Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_WARN_NULL_PTR 54 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS UcaninitHwConnectControlEx Syntax UCANRET PUBLIC UcanInitHwConnectControlEx tConnectControlFktEx fpConnectControlFktEx p void pCallback
180. time 196 SYS TEC electronic GmbH 2015 L 487e 29 Software support for Windows CE OS 4 2 API functions under Windows CE UsbCanCE dll contains the API functions for the USB CANmodul This USBCAN library is located in subfolder Lib XXX whereas XXX marks the CPU type This DLL contains all functions that are also available in USBCAN32 DLL under Windows 2000 XP Vista except for three functions UcaninitHwConnectControl UcaninitHwConnectControlEx UcanDeinitHwConnectControl Please refer to section 2 3 for the description of all available functions There are some more differences between UsbCanCE dil and USBCAN32 dIl Under Windows CE up to 9 USB CANmoduls can only be used simultaneously at one Windows CE device Function UcanGetVersionEx only can be run with the parameters kVerTypeUserDIl kVerTypeUserLib and kVerTypeSysDrv The call of UcanDeinitCan or UcanDeinitCanEx can take up to two seconds until return from this function 4 3 Logging debug information If there are problems with the driver it would be helpful if you send us a debug log file with debug information of the USBCAN library Using the current version Windows CE it is momentarily only possible to activate this feature by calling the function UcanSetDebugMode in your application Please refer to section 2 3 2 for more information SYS TEC electronic GmbH 2015 L 487e 29 197 USB CANmodul 198 SYS TEC electronic GmbH 2015 L 487e 29
181. turns and CAN messages are lost However it does not indicate the position of the lost CAN messages Since software driver version 3 05 the size of the receive buffer is configurable see function UcanInitCanEx and structure tUcaninitCanParam SYS TEC electronic GmbH 2015 L 487e_ 29 Software Support for Windows OS USBCAN_WARN_FW_TXOVERRUN Value 0x85 Description This warning is returned by function UcanWriteCanMsg and or UcanWriteCanMsgEx if flag USBCAN_CANERR_QXMTFULL is set in the CAN driver status However the transmit CAN message could be stored to the DLL transmit buffer This warning indicates that at least one transmit CAN message got lost in the device firmware layer This warning does not indicate the position of the lost CAN message USBCAN_WARN_FW_RXOVERRUN Value 0x86 Description This warning is returned by function UcanWriteCanMsg and or UcanWriteCanMsgEx if flag USBCAN_CANERR_QOVERRUN or flag USBCAN_CANERR_OVERRUN are set in the CAN driver status The function has returned with a valid CAN message This warning indicates that at least one reveived CAN message got lost in the firmware layer This warning does not indicate the position of the lost CAN message USBCAN_WARN_NULL_PTR Value 0x90 Description This warning message is returned by functions UcaninitHwConnectControl and or UcaninitHwConnectControlEx if a NULL pointer was passed as callback function address USBCAN_WARN_TXLIMIT Value 0x
182. turns with error code USBCAN_SUCCESSFUL then it also passes the respective CAN channel to the calling function USBCAN_CHANNEL_CHO or USBCAN_CHANNEL_CH1 see function UcanReadCanMsgEx The constants USBCAN CHANNEL _CAN1 and USBCAN CHANNEL CAN2 have the same values as USBCAN_CHANNEL_CHO and USBCAN_CHANNEL_CH1 They were defined because on top of the housing of USB CANmodul2 the first channel was named CAN1 but in the software the first channel is named 0 2 3 7 Using the Callback Functions The USBCAN library provides two types of callback functions The Connect Control Callback function announces Plug amp Play events for the USB CANmodul e g new USB CANmodul connected with the PC or taken off The second type announces events which occur during the work with the USB CANmodul e g CAN message receive Error status changed From software version 3 00 an extended format Support of multiple CAN channels exists for both types of the callback function SYS TEC electronic GmbH 2015 L 487e 29 141 USB CANmodul Note The Connect control callback function has a different format than callback functions for the other events Make sure to use the correct format in your application It is not possible to use the very same implementation for both types of callback function Also the format of the extended callback functions differs from the format of the standard functions Make sure to use the extended callback fu
183. ud rate register 1 of the SJA1000 BYTE m_bOCR Output control register of the SJA1000 should always be 0x1A DWORD m_dwAMR Acceptance filter mask of the SJA1000 DWORD m_dwACR Acceptance filter code of the SJA1000 DWORD m dwBaudrate Baudrate register for Multiport USB CANmodull and USB CANmodul2 number of entries in receive buffer in USBCAN library WORD m wNrOfRxBufferEntries number of entries in transmit buffer in USBCAN library WORD m wNrOfTxBufferEntries tUcanInitCanParam Note The configuration of the baud rate differs significantly between the older USB CANmodul versions GW 001 and GW 002 and the new sysWORXX modules For standardized baud rate values see section 2 3 4 the baud rate registers BTRO and BTR1 are as well applicable for the new sysWORXX modules Therefore set m_dwBaudrate to USBCAN BAUDEX USE BTRO1 SYS TEC electronic GmbH 2015 L 487e_29 69 USB CANmodul The mode of CAN transmission possible constants modes is configured by an 8 bit bit mask The following table shows all Constant Value Meaning kUcanModeNormal 0x00 normal transmit and receive mode kUcanModeListenOnly 0x01 listen only mode transmitted CAN messages are not sent out via CAN bus Received CAN messages of remote nodes are not acknowledged kUcanModeTxEcho 0x02 UcanReadCanMsg also returns transmitted messages as transmit echo see function UcanReadCanM
184. uded USB cable e Windows automatically detects the USB CANmodul The appropriate driver files will be found automatically see Note below The firmware will now be downloaded to the USB CANmodul The red status LED blinks with a frequency of 10 hertz to indicate this procedure SYS TEC electronic GmbH 2015 L 487e 29 13 USB CANmodul After successful download of the device firmware the red status LED will stay on Note The USB CANmodul device driver does not have the Microsoft signature Because of this an error message will appear when using Windows XP operation system that the driver didn t pass the loop test Ignore this message and click on Continue Installation Since 64 Bit Edition of Windows Vista all Kernel Mode Drivers has to be shipped with an certificate which identifies the manufacturer of the driver Installing the driver for the first time a windows appears as shown in Figure 1 Please tick the box for always trusting the software from company SYS TEC electronic GmbH la 7 Windows Security Would you like to install this device software Name SYS TEC electronic GmbH USB CAN Hardware TI Publisher SYS TEC electronic GmbH V1 Always trust software from SYS TEC electronic Install Don t Install OMD eee eel Ti You should only install driver software from publishers you trust How can I decide which device software is safe to install Figure 1 Installation of the driver at Wi
185. ve section of the tool If you do not change this range then all CAN messages will be shown Apply this setting by clickint to the button OK The main window of the tool appears refer to Figure 7 This screen is divided into two sections Receive and Transmit e Receive monitors CAN signals that are received from a node e Transmit monitors CAN signals sent from the host PC to the CAN network via the USB CANmodul Receive Section The Receive section provides the following information e Message identifier of the CAN message hexadecimal format ranging from 0 to 7FFh for 11 bit identifiers and from 0 to 1FFFFFFFh for 29 bit identifiers e Length data length code of the message ranges from 0 to 8 e Data values of the messages data bytes up to 8 or the text Remote request if a remote frame has been received e Period period of time between the reception of the last two messages with this identifier e Count number of messages received with this identifier no remote frames since last user reset e RTR Per period of time between the reception for the last two remote frames e RTR Cnt number of remote frames with this identifier SYS TEC electronic GmbH 2015 L 487e 29 43 USB CANmodul Transmit Section The Transmit section provides the following information e Message identifier of the CAN message hexadecimal format ranging from 0 to 7FFh for 11 bit identifiers and from 0 to 1FFFFFFFh from 29 bit
186. w_p bDeviceNrHigh_p dwSerialNrLow_p dwSerialNrHigh_p dwProductCodeLow_p dwProductCodeHigh_p fpCallback_p fEnumUsedDevs_p Return value back handler the user can decide whether the found USB CANmodul itialized by the DLL In this case the module changes to the state Filter parameters for the device number The value DDeviceNrLow_p specifies the lower limit and the value bDeviceNrHigh_p specifies the upper limit of the device number which have to be found Filter parameters for the serial number The values specifies the lower and upper limit of the serial number area which have to be found Filter parameters for the Product Code The values specifies the lower and upper limit of the Product Code area which have to be found Possible values are shown in Table 15 Callback handler which is called for each found USB CANmodul Set to TRUE if USB CANmoduls should be found too which are currently exclusively used by another application These modules cannot be used by the own application This method returns an array of class USBcanServer with all initialized USB CANmoduls The Callback handler has the following syntax Syntax C void PUBLIC MyEnumDelegateCallback DWORD BOOL tUcanHardware bols DOOIE Syntax Visual Basic Private Sub MyEnum ByVal dwIndex ByVal fIsUsed dwIndex_p ElsUsed p InfoEx pHwInfoEx p EDOlnitializs p ELeyNext a y DelegateCallback _ 9 AS IMSS _ D As
187. x C public byte USBcanServer GetStatus byte bChannel p SE UWS CSCUSSECUICE Ostetts S 7 Syntax Visual Basic PUIG Hunerion WSBcenmServer Cetstartus _ ByVal poCheanel As Byte BWINSIE pPOratus 9 AS EStaruesrrucr AS BYTS Usability HW_INIT CAN_INIT version 3 01 and higher Description Returns the error status of a specific CAN channel Structure tStatusStruct is described with function UcanGetStatus Parameter bChannel_p CAN Channel to be used USBCAN_CHANNEL_CHO for CAN Channel 0 USBCAN_CHANNEL_CH1 for CAN Channel 1 pStatus_p Error status of the device Return value Error code of the function USBCAN_SUCCESSFUL USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHANDLE USBCAN_ERR_ILLPARAM 164 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS SetBaud rate Syntax C public byte USBcanServer SetBaudrate byte bChannel p USBCAN CHANNEL CHO Short WATR jo USBCAN BAUD 1MBit int dwBaudrate p USBCAN BAUDEX USE BTRO1 Syntax Visual Basic Public Function USBcanServer SetBaudrate _ Optional ByVal bChannel p As Byte USBCAN CHANNEL CHO Optional ByVal wBTR p As Short USBCAN BAUD 1MBit Optional ByVal dwBaudrate p As Integer USBCAN BAUDEX USE BTRO1 As Byte Usability CAN_INIT version 3 01 and higher Description This function is used to configure the baud rate of specific CAN channel of a device Parameter bChannel_p CAN Channel w
188. yntax Visual Basic Public Function USBcanServer DefineCyclicCanMsg _ ByVal bChannel p As Byte _ ByRef pCanMsgList_p As tCanMsgStruct As Byte Usability HW_INIT CAN_INIT as of Version 3 06 and higher as of sysWORXX Description Defines a list of up to 16 CAN messages in the USB CANmodul for automated sending of cyclic CAN messages Sending is not initiated after the call of this function Call the method EnableCyclicCanMsg in order to activate the automatic sending Please not that a pre defined list will be completely replaced Parameter bChannel_p CAN Channel which is supposed to send USBCAN_CHANNEL_CHO for CAN channel 0 USBCAN_CHANNEL_CH1 for CAN channel 1 pCanMsgList_p Reference to a list of CAN messages as array of type tCanMsgStruct with max 16 entries which are to be sent cyclically The element m_dwTime of structure tCanMsgStruct indicates cucle time in milli seconds If NULL resp Nothing is stated only the old list in the module is deleted Return Value Error Code of Function USBCAN_SUCCESSFUL USBCAN_ERR_ILLPARAM USBCAN_ERR_ILLHANDLE USBCAN_ERR_MAXINSTANCES USBCAN_ERR_ILLHW USBCAN_ERR_ILLHWTYPE USBCAN_ERR_ILLCHANNEL USBCAN_ERRCMD _ 174 SYS TEC electronic GmbH 2015 L 487e 29 Software Support for Windows OS ReadCyclicCanMsg Syntax C public byte USBcanServer ReadCyclicCanMsg byte bChannel p ref tCanMsgStruct pCanMsgList p Git imne ChCotntE jo 0 Syntax V

Download Pdf Manuals

image

Related Search

Related Contents

User`s Guide Pinless Moisture/Humidity Meter + IR Model MO290  KOHLER K-4915-0 Installation Guide    117 Psicólogo - Área Organizacional  Quick CleanTM Quick Cle  ACCUMASS BW500 - Services  PRACTICAL DESIGN TECHNIQUES FOR SENSOR SIGNAL  Home Decorators Collection FB4853BXI1306PV Installation Guide  Belkin Car MicroCharger  337865S , REACTOR H-25, H-XP2 Dosificadores  

Copyright © All rights reserved.
DMCA: DMCA_mwitty#outlook.com.