Home
RS232/USB to CAN bridge user`s guide
Contents
1. Another message with a Remote Transmit Reguest RTR might be I X os R In this case a message is sent in extended mode indicated by the letter X with the identifier 0x800 This is a remote transmission reguest R in which no data are indicated as the aim is for the device receiving this message to reply with the data needed by the requester Receiving a CAN message If a CAN message is received this will be automatically displayed on the screen in the following format R lt S Tente lt N R Dre saa The received message format is the same as the transmission format An example of a message received might be R S 0xA N 8 0x102030405060708 In this case a message is received in standard mode indicated with the letter S with the identifier OxA This is a normal type message N with eight data bytes 8 which are 0x102030405060708 Chapter 4 Command format 5 Communication error management Since this is a communication bridge proper detection warning and action against possible communication errors is vital for the developed firmware to be fully operative and reliable To make it easier for the reader to understand the errors have been divided into three types e Syntax errors in the command line e RS232 USB CAN transmission errors e CAN RS232 USB transmission errors Syntax errors in the command line To avoid possible communication errors the firmware rejects commands wi
2. 0 01 35 conectado ANSIW 115200 8 N 1 Figure 4 Baud rate mask filter and mode configuration Other application options are the obtainment of the program version and a full error report An example is shown in the following figure Bridge CAN RS232 or USB HyperTerminal Archivo Edici n Ver Llamar Transferir Ayuda Dae 33 DE A xxxxxxxxxxBridge CAN RS232 USB based on iCM4011 V Bssee eee DE E JE JE JE DE EEE 3 C ingenia cat S L 26 26 26 26 26 26 26 96 26 36 96 96 36 96 96 96 26 96 96 3626 FE HH HH HHH HUI LN GON LA CAt COM HH HH HHH HH HH 262626262262 G VERSION VERSTON 1 00 G ERRORS ERROR MODE ERROR ACTIVE RX ERROR COUNT 9 TX ERROR COUNT 9 0 20 59 conectado ANSIW 115200 8 N 1 Figure 5 Obtaining the program version and error report Chapter 2 How to use it 7 Sending and receiving messages In Figure 6 and Figure 7 the reader can see an example of sending CAN messages from HyperTerminal and their subsequent monitoring in PCAN View RS232 USB CAN transmission and vice versa The information flow and direction between devices is also described PeakSystem CAN device CAN messages are received and monitored at PCAN View software Data FF 33 33 Y Remote Request Communication way any I A C ingenia cat S L s u INGENIA CAT COM u T S Ox7FF N 2 0x3333 Message transmitted successfully CAN messages are sent from T X 0X800 R iCM4011 HyperTerminal applicati
3. As a result the message has been lost The software FIFO for messages from the CAN bus has been overrun As a result the message has been lost Table 4 Possible CAN RS232 USB transmission errors Chapter 5 Communication error management Downloads BridgeRS232CAN zip Downloads References Ingenia iCM4011 Product manual Ingenia UIB PC104 Product manual Microchip dsPIC30F401 1 4012 Data Sheet DS70135 Microchip dsPIC30F Family Reference Manual DS70046 Bosch CAN specification References 20
4. Data bits 8 bits e Parity None e Stop bits 1 e Flow control No flow control CAN interface configuration RS232 USB to CAN bridge firmware enables the configuration of CAN communications through commands As many as seven different transmission speeds can be chosen ranging from 10Kbps to 1Mbps There is also a mask and a programmable filter to decide the type of messages we want to receive Standard or extended modes can also be chosen by the user For further information about the CAN interface consult the protocol specification and processor product manual which you can find in the reference list Outlined below is an example of how to configure the transmission speed the mask the filter and the mode standard or extended For further information about the commands consult the chapter Command format Chapter 2 How to use it Bridge CAN RS232 or USB HyperTerminal Archivo Edici n Ver Llamar Transferir Ayuda Dae 33 DE a xxxxxxxxx Bridge CAN RS232 USB based on 1CM4011 V1 Qx x sxx 222 Re s CCH 1ngenia cat SL 2226 26 36 36 26 26 26 26 26 JE JE JE JE 6 26 26 96 JE JE 26 FE DE DE DE DE DE DE DE DE DEEE DE DE DEEE EU LNJENIA CAT COM H 262626262626 262626262626 262626262626 2E 2E S BAUDRATE 0 G BAUDRATE BAUDRATE 1Mbps 0 S MASK OxF S FILTER xA S MESSAGE 1 G MASK MASK _ xF G FILTER FILTER 0xA G A MESSAGE FILTER EXTENDED S MESSAGE 0 G MESSAGE MESSAGE FILTER STANDARD i
5. and the transmission speed Parameter 0 1 2 3 4 5 6 Speed Kbps 1000 500 250 125 50 20 10 Table 1 Transmission speeds To obtain the transmission speed the command to send is G lt Space gt BAUDRATE lt Space gt The program will reply with a message similar to the one below BAUDRATE 1 Mbps 0 Obtaining and modifying the mask filter and mode To configure the mask filter and working mode the following syntax must be used S lt Space gt MASK lt Space gt lt Identifier gt S lt Space gt FILTER lt Space gt lt Identifier gt Chapter 4 Command format S lt Space gt MESSAGE lt Space gt lt Mode gt The MASK must be a numerical value expressed in decimal or hexadecimal format whose range of values depends on the working mode chosen standard or extended If working in standard mode its value should be between 0 0x0 and 2 bits 1 2047 Ox7FF If working in extended mode however the minimum value should be between 0 0x0 and a maximum of 2 bits 1 536870911 Ox1FFFFFFF The FILTER should be a numerical value expressed in decimal or hexadecimal format The range of values covered follows the same rules as the MASK Finally the possible MESSAGE values are 0 to select standard working mode and 1 for extended working mode To set the mask at OxF for example the filter at OxA and the mode as extended the following commands must be sent fro
6. RS232 USB CAN bridge User Manual 22 10 2008 Version 1 0 2008 INGENIA CAT S L Contents aN geo Uo 1 9 Pewee Rae ee O OE AE EE PE NE OV V en ee 4 What is a communication bridge and how does it work 4 HOW GO WIS Ose r O en slu rr nn 6 RS232 U SB interface configuration 6 CAN interface configuration 6 Sending and receiving messages 8 Aspects of interest to the user nn 9 Application s execution TOW i pricincdendsenteexSiarCeovbseuSterSeacteorSaeudenSenxdevedeurtdeuss 10 Commando Mal ess eds ral de Rem ti zda mila dp kz dok 12 Obtaining and modifying the CAN bus transmission speed 12 Obtaining and modifying the mask filter and mode ooeee 12 Obtaining the program version and error report 13 CAN message transmission 0 ccccceceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeneceeeeeeeceeeeees 14 Receiving a CAN message ss 15 Communication error management 16 Syntax errors in the command line 16 RS232 USB CAN transmission errors 17 CAN RS232 USB transmission errors 2 0ccecceceeeeeceececceceeceeeeeeees 18 Icons Following is shown the meaning of the icons that reader can find on this manual Information Provides the user with tips and tricks and other useful data Warning A Provid
7. S UART MESSAGE Full Message Received YES v Parse message Y NO Put message into UART FIFO process queue IART messages to process YES AA Process messages from NO UART FIFO RETURN s 10 The following resources are used by the iCM4011 device in this example e CAN Module e UART Module e Timer Module e Interrupts o Interrupt due to CAN module reception o Interrupt due to UART module reception o Timer module interrupt e RAM memory 674 2048 bytes gt 32 9 e Program memory 9242 16384 bytes gt 56 4 Chapter 3 Application s execution flow Command format This chapter outlines the syntax of possible commands for configuring sending and or receiving messages from the RS232 USB interface The reader can also find details of application features Remember that you should always finish the command with a carrier return Obtaining and modifying the CAN bus transmission speed To modify the CAN bus transmission speed the following command must be sent from the serial communications program i e HyperTerminal S lt space gt BAUDR TH lt Space gt lt speed parameter gt The numerical value that accompanies the command indicates the speed we wish to use To choose a bus speed of 1Mbps for example we must type S BAUDRATE 0 Table 1 shows the eguivalence between the command parameter
8. bridge are outlined below e Sending and receiving CAN messages in ASCII format e Compatible with CAN 2 0A and CAN 2 0B e Communication speeds available o R5232 USB interface set at 115200bps o CAN interface 10 20 50 125 250 500 or 1000Kbps which may be configured using ASCII commands e Configurable CAN communication parameters o Mask o Filter o Standard 11 bit identifier or extended mode 29 bit identifier o Transmission speed e Full report of communication errors Chapter 1 Introduction How to use it Microsoft HyperTerminal will be used as the PC application for exchanging messages through the RS232 USB bus The user may in the same way also be able to use PCAN View software supplied by the manufacturer of the PCAN USB device to send and receive messages through the CAN bus Messages sent from HyperTerminal will therefore be displayed in PCAN View Messages sent from PCAN View will also be displayed in HyperTerminal RS232 USB interface configuration In the first place and according to the connection used between the iCM4011 and the PC the user must choose the serial USB or RS232 interface on the iCM4011 through its selection jumpers see the iCM4011 manual ay Remember that the USB interface on the iCM4011 is seen by the host as a serial port Communication between the PC and the iCM4011 module takes place at a fixed speed with the following configuration parameters e Transmission speed 115200bps e
9. command line RS232 USB CAN transmission errors The following table lists the possible errors that may occur when sending a message from the RS232 USB interface which will be shown in HyperTerminal Error code Message Possible causes Hardware UART FIFO overflow Message has been lost E1 Software UART FIFO overflow Message has been lost E2 Message not transmitted Communication failed Check communication E19 Chapter 5 Communication error management The UART module hardware buffer has been overrun As a result the message has been lost The software FIFO for messages from the RS232 has been overrun As a result the message has been lost The pending transmission wait time five seconds has been exceeded parameters before retrying the transmission Reset all CAN devices to recover normal operation mode The message could not be sent due to incompatible communication configuration parameters or due to a faulty device connection Table 3 Possible RS232 USB CAN transmission errors CAN RS232 USB transmission errors The following table lists the possible errors that may occur when sending a message from the CAN interface which will be shown in HyperTerminal Error code Message Possible causes Hardware CAN reception buffer Laval overflow Message has been lost Software CAN FIFO E18 overflow Message has been lost The CAN controller hardware buffer has been overrun
10. d in Identifier value is not transmitting the message but an identifier Chapter 5 Communication error management standard It is extended Invalid command Ea DLC value is not correct E10 Invalid command Not enough parameters Invalid command You must type a command before Intro E11 Invalid command EM You must type S or X E13 Invalid command You must type NorR Invalid command Baudrate range is between 0 and 6 E14 Message is 0 for Standard mode and it is 1 for Extended mode E15 Identifier value is not Ete extended It is standard greater than 11 bits was entered When the message was sent a value greater than 8 or another non numerical character was entered in the DLC field In transmitting a message T or in configuring a parameter S the respective command lacks arguments The carriage return has been pressed without having entered any character In transmitting a message a character other than S or X was entered in the working mode field In transmitting a message a character other than N or R was entered in the message type field An out of range value has been chosen in transmission speed configuration A number other than 0 or 1 has been entered in the working mode configuration An extended X identifier has been indicated in transmitting the message but an identifier of less than 12 bits has been entered Table 2 Possible typographical errors in the
11. e bridge is responsible for acting as an interpreter between the two so that this difference becomes transparent to them A descriptive diagram is shown in Figure 2 m INTERFACE A gt INTERFACE B Device 1 INTERFACE A INTERFACE B Device 2 INTERFACE A INTERFACE B COMMUNICATION BRIDGE Figure 2 Example of communication between two devices with different interfaces In our particular case device 1 will be a PC and interface A its RS232 or USB port Device 2 will be a CAN transceiver receiver node specifically a PCAN USB from the PEAK System company Chapter 1 Introduction The module iCM4011 programmed with RS232 USB to CAN bridge firmware will act as a communication bridge between both devices An application diagram is shown below RS232 USB BUS CAN BUS m Transmission Transmission f s WU ES i me i y Reception Reception y DEVICE 1 INTERFACE A COMMUNICATION INTERFACE B DEVICE 2 PC BRIDGE CAN NODE iCM4011 Figure 3 Specific example of communication between two devices with different interfaces When the iCM4011 receives an ASCII format message through the RS232 or USB interface it converts it into CAN format and sends it through this bus Similarly when the iCM4011 receives a message through the CAN bus it converts it into ASCII format and sends it through the RS232 or USB bus The main features of this communication
12. es the user with important information Omitting this warning may cause the device not to work properly Critical Warning Provides the user with critical information Omitting this critical warning may destroy the device Introduction The CAN bus has become a real communications standard in the industry today due to its high capacity reduced wiring great noise immunity etc This is why the need may arise in developing new applications to connect several devices through the CAN interface Yet if we want to work with systems equipped with just RS232 or USB a conventional PC for example it is necessary to use an intermediate device called a communication bridge which converts the protocols RS232 Device USB Device A HN RS232 bus USB bus Y NZ Bridge CAN RS232 USB Bridge CAN RS232 USB NU 7 i ZN ZN CAN bus CAN bus v N7 CAN NETWORK Nn ZN ZN CAN bus CAN bus CAN bus V7 M CAN Device CAN Device CAN Device Ss ait i Figure 1 Typical application of a CAN RS232 USB communication bridge This manual describes the implementation of a firmware capable of establishing a bridge between RS232 USB and CAN communications using an iCM4011 communication module from Ingenia The function it performs is shown by the Bridge CAN RS232 USB block that appears in Figure 1 What is a communication bridge and how does it work A communication bridge allows communication between two or more devices using different interfaces Th
13. m the communications program ending each one with a carrier c 3 S MASK 0xF S FILTER 0xA S MESSAGE 1 To obtain the mask filter and mode value the following commands have to be written G lt Space gt MASK G lt Space gt FILTER G lt Space gt MESSAGE The program answers to each respective message will be MESSAGE FILTER EXTENDED pu Il Another possibility is to set the working mode to 0 The reply will then be MESSAGE FILTE STANDARD Obtaining the program version and error report To obtain the program version the user must send the following command Chapter 4 Command format 3 G lt Space gt VERSION The reply to this command will be a text such as VERSION 1 00 To obtain the error report the user must send the following command G lt Space gt ERRORS The response to this command will be ERROR MODE ERROR ACTIVE RX ERROR COUNT 0 TX ERROR COUNT 0 In the example above the application tells us there has been no communication error due to the transmission and reception counters being zero ERROR ACTIVE is the normal operating mode in which the CAN node can actively participate in communication If these counters exceed 127 the ERROR MODE would change to BUS PASSIVE In this case the CAN node would have less priority for participating in communication If any counter exceeds 255 the system would also enter BUS OFF In
14. on Message transmitted successfully BRIDGE CAN RS232 USB Figure 6 Information flow in RS232 USB CAN transmission PeakSystem CAN device CAN message is sent PCAN View for USB from PCAN View software Y I S58 PT F h 01 02 03 04 OS 06 07 08 Vast Communication way RS 232I U SB connectios a C ingenia cat S L ww ingenia cat con CAN message is received at iCM4011 HyperTerminal application R S Oxf N 8 0x102030405060708 BRIDGE CAN RS232 USB Figure 7 Information flow in RS232 USB CAN transmission Chapter 2 How to use it Aspects of interest to the user With respect to HyperTerminal commands it should be noted that the program does not distinguish between capital and lower case letters and allows the use of the backspace key to correct wrong command characters With respect to CAN bus connection you should also remember to terminate the bus appropriately If you use Ingenia User Interface Board UIB PC 104 with the iCM4011 a 1200 resistor can be inserted between CANH and CANL by simply enabling the third position of J2 For further information about UIB PC104 as well as module iCM4011 please consult the documents in the reference list Chapter 2 How to use it Application s execution flow Outlined below is the application s firmware execution flow 1 Initial configurations a Input output port configurations b CAN module configuration baud rate mask fil
15. ter and working mode c CAN module reception interrupt configuration d UART configuration e UART reception interrupt configuration 2 Infinite loop a Process UART message i If received a full message analyze the command received and place the message in the UART FIFO process queue ii Process UART FIFO messages if any b Process CAN message i Process CAN module FIFO messages if any UART and CAN interrupt routines perform the tasks of storing the character received ISR UART as well as placing the message in the CAN FIFO process queue ISR CAN The flow chart is outlined below MAIN LOOP INITIAL CONFIGURATIONS X Y INITIAL Configure CONFIGURATIONS I O pins v Configure CAN v module parameters PROCESS UART v MESSAGE Configure CAN reception ISR s Vv PROCESS CAN MESSAGE Configure UART module parameters AA Configure UART reception ISR Y RETURN PROCESS CAN ISR ISR MESSAGE CAN UART i y Parse Save received CAN messages message character to process AA Put message into Y CAN FIFO RETURN process gueue Process messages from RETURN NO ON TFO RETURN U RETURN Figure 8 Application s execution flow Chapter 3 Application s execution flow PROCES
16. th badly expressed syntax Error messages related to poor input command syntax are shown in the following table Error code Message Possible causes Erroneous command This is shown in the E3 Invalid command case that the error does not come from any of the sources described in this table In the transmission of a message the identifier field was expressed in hexadecimal form preceded by Ox and some of its characters were not between 0 Invalid command and 9 or between A and F E4 Identifier is not correct In the transmission of a message the identifier field was expressed as a decimal and some of its characters were not between 0 and 9 In the transmission of a message the data field was expressed as a hexadecimal number preceded by 0x and some of its characters were not between 0 and 9 or Invalid command E5 f between A and F Data is not correct In the transmission of a message the data field was expressed as a decimal and some of its characters were not between 0 and 9 The mask or filter parameter was entered Invalid command E6 d incorrectly in configuration as a Parameter is not correct hexadecimal or decimal Invalid command The command was started with characters E7 Command is not correct other than T transmit message G get the Only T G or S are value of a specific parameter or S set the available value at a specific parameter E8 Invalid command An S standard identifier was indicate
17. this operation mode the node would be disconnected from the bus without being able to send or receive The RX ERROR COUNT and TX ERROR COUNT counters increase or decrease according to the CAN bus specification CAN message transmission For CAN message transmission it is necessary to send a command using the following syntax T lt Space gt lt S X gt lt Space gt lt Identifier gt lt Space gt lt N R gt lt Space gt lt DLC gt lt Space gt lt Data gt Where e lt S gt Standard mode lt x gt Extended mode e lt Identifier gt Identifier in hexadecimal 0x0000 or decimal 0 base e lt N gt Normal message lt R gt Remote Transmit Request e lt DLC gt Number of bytes to transmit e lt Data gt Information in hexadecimal 0x0000 or decimal 0 base e lt Space gt Space separating each field To indicate that the message has been sent correctly the following message will appear on the screen Chapter 4 Command format 4 Message transmitted successfully An error message will be displayed if there is a transmission failure For further information see the chapter referring to CAN RS232 USB transmission errors An example of this kind of message might be 1 S Oxy N Z 0x35333 In this case a message is sent in standard mode indicated with the letter S with the identifier 0x7FF This is a normal type message N with two data bytes 2 which are 0x3333
Download Pdf Manuals
Related Search
Related Contents
Sony Ericsson Mobile Communications AB 仕 様 書 Herunterladens USER`S MANUAL JVC XV-S42SL User's Manual Guía del usuario de McAfee GroupShield versión 7.0.1 Philips shaving heads cleaning spray HQ110 Copyright © All rights reserved.
Failed to retrieve file