Download Print this page

Advertisement

Quick Links

CAN-Engine
C Programmable Embedded CAN Controller, with 100M BaseT Ethernet, RS232,
CompactFlash, and 16-bit parallel high speed ADC
Technical Manual
th
1950 5
Street, Davis, CA 95616, USA
Tel: 530-758-0180
Fax: 530-758-0181
Email:
sales@tern.com
http://www.tern.com

Advertisement

loading
Need help?

Need help?

Do you have a question about the CAN-Engine and is the answer not in the manual?

Questions and answers

Summary of Contents for Tern CAN-Engine

  • Page 1 CAN-Engine ™ C Programmable Embedded CAN Controller, with 100M BaseT Ethernet, RS232, CompactFlash, and 16-bit parallel high speed ADC Technical Manual 1950 5 Street, Davis, CA 95616, USA Tel: 530-758-0180 Fax: 530-758-0181 Email: sales@tern.com http://www.tern.com...
  • Page 2 TERN and the Buyer agree that TERN will not be liable for incidental or consequential damages arising from the use of TERN products. It is the Buyer's responsibility to protect life and property against incidental failure.
  • Page 3 The CANE supports low cost, removable, up to 2 GB mass storage CompactFlash cards with onboard CompactFlash interface. User can store and transfer large amounts of data with a PC, via a CF card with TERN’s FAT filesystem software support.
  • Page 4 Linear 5V regulators LM7805 Figure 1.1 Functional block diagram of the CAN-Engine The CANE supports on-board 512 KB 16-bit Flash and up to 512 KB 16-bit battery-backed SRAM. The on-board ACTF Flash has a protected boot loader and can be easily programmed in the field via serial link. Users can download a kernel into the Flash for remote debugging.
  • Page 5 • 4 ch 16-bit parallel high speed ADC (AD7655) • Hardware TCP/IP stack for 100M Base-T Ethernet • CompactFlash card with FAT file system support 1.2 Physical Description The physical layout of the CAN-Engine is shown in Figure 1.2. Figure 1.2 Physical layout of the CAN-Engine...
  • Page 6 Chapter 1: Introduction CAN-Engine Power On or Reset Step 2 jumper STEP 2 set? Go to Application Code CS:IP CS:IP in EEPROM: 0x10=CS high byte 0x11=CS low byte STEP 1 0x12=IP high byte ACTF menu sent out through ser0 0x13=IP low byte at 19200/9600 baud(EE40/80) Figure 1.3 Flow chart for ACTF operation...
  • Page 7 CAN-Engine Chapter 1: Introduction 1.3 CAN-Engine Programming Overview Steps for product development: Preparation for Debugging(DONE in Factory !) • Connect board to PC via RS-232 link, 19,200, 8, N, 1 • Power on without STEP 2 jumper installed • ACTF menu should be sent to PC terminal •...
  • Page 8 3) The on-board CANE must have a Jump Address of 0xfa000. 4) The STEP2 jumper must be installed on J2 pins 38-40. For further information on programming the CAN-Engine, refer to the manual on the TERN CD under: tern_docs\manuals\software_kit.pdf. The CANE works with most TERN expansion boards including the P50, P100, P300, MotionC, MMC, and Eye0.
  • Page 9 2.2.1 Connecting to the PC The following diagram (Fig 2.1) provides the location of the debug serial port and the power jack. The controller is linked to the PC via a serial cable (DB9-IDE) which is supplied with TERN’s EV-P / DV-P Kits.
  • Page 10 Chapter 2: Installation CAN-Engine 2.2.3 Connecting the CAN-Engine™ The proper connections required to debug the board (through Paradigm software). H1 (Ser 0) is a 5x1 pin header. Use the back row of the IDE cable’s female header to connect to H1. (See...
  • Page 11 In the future, when the fast (10 ns) and low standby power SRAM is available, then 80 MHz E-Engine can have both RTC and SRAM with battery backup plus the DMA, zero wait state operation. User can use sample program c:\tern\186\samples\ee\rdc_id.c to read the ID register (0xfff4), in order to identify RDC CPU type.
  • Page 12 As a result of this buffering, these pins are capable of only acting as input. These buffered external interrupt inputs require a falling edge (HIGH-to-LOW) to generate an interrupt. The CAN-Engine uses vector interrupt functions to respond to external interrupts. Refer to the Am186ES User’s manual for information about interrupt vectors.
  • Page 13 The maximum rate at which each timer can operate is 10 MHz, since each timer is serviced once every fourth clock cycle. Timer output takes up to six clock cycles to respond to clock or gate events. See the sample programs timer02.c and ae_cnt1.c in the tern\186\samples\ae directory. 3.2.5 PWM outputs and PWD The Timer0 and Timer1 outputs can also be used to generate non-repetitive or variable-duty-cycle waveforms.
  • Page 14 After power-on/reset, PIO pins default to various configurations. The initialization routine provided by TERN libraries reconfigures some of these pins as needed for specific on-board usage, as well. These configurations, as well as the processor-internal peripheral usage configurations, are listed below in Table 3.1.
  • Page 15 (1); return 16-bit status of P16-P31, if corresponding pin is in input mode, Some of the I/O lines are used by the CAN-Engine system for on-board components (Table 3.2). We suggest that you not use these lines unless you are sure that you are not interfering with the operation of such components (i.e., if the component is not installed).
  • Page 16 J2 pin 24=P2 USER *PCS0 may be used for other TERN peripheral boards. To illustrate how to interface the CAN-Engine with external I/O boards, a simple decoding circuit for interfacing to an 82C55 parallel I/O chip is shown in Figure 3.1. 82C55...
  • Page 17 This automatic assertion of /RESET may recover the application program if something is wrong. After the CAN-Engine is reset, the WDO remains low until a transition occurs at the WDI pin of the MAX691. When controllers are shipped from the factory the J5 jumper is off, which disables the watchdog timer.
  • Page 18 Chapter 3: Hardware CAN-Engine J5 WatchDog Figure 3.2 Location of watchdog timer enable jumper Power-failure Warning The supervisor supports power-failure warning and backup battery protection. When power failure is sensed by the PFI=J1.11, pin 9 of the MAX691 (lower than 1.3 V), the PFO is low. The PFI pin 9 of 691 is directly shorted to VCC by default.
  • Page 19 EEPROM can be read and written by simply calling the functions ee_rd() and ee_wr(). A range of lower addresses in the EEPROM is reserved for TERN use. Details regarding which addresses are reserved, and for what purpose, can be found in Appendix E of this manual.
  • Page 20 The CAN bus pinout on J3 is shown below. It is a compact 0.1” spacing 3x2 pin header. User can use a IDE10-DB9 flat cable from TERN to connect CAN signals to an external standard DB9 CAN connector in the field.
  • Page 21 Chapter 3: Hardware 3.5.7 Power Supplies The CAN-Engine can be powered by regulated 5V or unregulated 9V with on-board regulator: 1) Regulated external 5V DC power via J2.39=VCC and J2.40=GND, or J1.1=VCC and J1.2=GND. 2) Unregulated 9V to 12V DC power via two pin screw ternimals(T2) while a 5V linear regulator(LM7805, U00) is installed.
  • Page 22 Chapter 3: Hardware CAN-Engine 3.6 Headers and Connectors 3.6.1 Expansion Headers J1 and J2 There are two 20x2 0.1 spacing headers for expansion. Most signals are directly routed to the Am186ES processor. These signals are 5V only, and any out-of-range voltages will most likely damage the board.
  • Page 23 Implicit accesses to I/O and memory address space occur throughout your program from TERN libraries as well as simple memory accesses to either code or global and stack data. You can, however, explicitly access any address in I/O or memory space, and you will probably need to do so in order to access processor registers and on-board peripheral components (which often reside in I/O space) or non-mapped memory.
  • Page 24 This function can be used to retrieve data from components in I/O space. You will find that most hardware options added to TERN controllers are mapped into I/O space, since memory space is valuable and is reserved for uses related to the code and data. Using I/O mappings, the address is output over the address bus, and the returned 16 or 8-bit value is the return value.
  • Page 25 4.2.1 CAN-Engine Initialization ae_init This function should be called at the beginning of every program running on CAN-Engine core controllers. It provides default initialization and configuration of the various I/O pins, interrupt vectors, sets up expanded DOS I/O, and provides other processor-specific updates needed at the beginning of every program.
  • Page 26 ICUs, the user should refer to Chapter 7 of the AMD Am186ES Microcontroller User’s Manual. TERN provides functions to enable/disable all of the eight external interrupts. The user can call any of the interrupt init functions listed below for this purpose. The first argument indicates whether the particular interrupt should be enabled, and the second is a function pointer to an appropriate interrupt service routine that should be used to handle the interrupt.
  • Page 27 (* nmi_isr)()); 4.2.3 I/O Initialization Two ports of 16 I/O pins each are available on the CAN-Engine. Hardware details regarding these PIO lines can be found in the Hardware chapter. Several functions are provided for access to the PIO lines. At the beginning of any application where you choose to use the PIO pins as input/output, you will need to initialize these pins in one of the four available modes.
  • Page 28 4.2.4 Timer Units The three timers present on the CAN-Engine can be used for a variety of applications. All three timers run at 1/4 of the processor clock rate (10MHz based on 40MHz system clock, or one timer clock per 100ns), which determines the maximum resolution that can be obtained.
  • Page 29 H3 pin 2 High inport(0x110) Refer to the sample code, cane_ad.c, in the \tern\186\samples\cane directory. It shows necessary steps to read channels on the AD7655. The sample code is also incorporated into the sample project, “cane.ide”. 4.2.6 Other library functions...
  • Page 30 Chapter 4: Software CAN-Engine _____________________________________________________________________________________ unsigned char sec1; One second digit. unsigned char sec10; Ten second digit. unsigned char min1; One minute digit. unsigned char min10; Ten minute digit. unsigned char hour1; One hour digit. unsigned char hour10; Ten hour digit.
  • Page 31 The internal asynchronous serial ports are functionally identical. SER0 is used by the DEBUG ROM provided as part of the TERN EV-P/DV-P software kits for communication with the PC. As a result, you will not be able to debug code directly written for serial port 0.
  • Page 32 Chapter 4: Software CAN-Engine _____________________________________________________________________________________ Function Argument Baud Rate 4800 9600 19,200 (default) 38,400 57,600 115,200 250,000 500,000 1,250,000 Table 4.1 Baud rate values After initialization by calling s1_init(), SER1 is configured as a full-duplex serial port and is ready to transmit/receive serial data at one of the specified 15 baud rates.
  • Page 33 There is a data structure containing important serial port state information that is passed as argument to the TERN library interface functions. The COM structure should normally be manipulated only by TERN libraries. It is provided to make debugging of the serial communication ports more practical. Since it allows you to monitor the current value of the buffer and associated pointer values, you can watch the transmission process.
  • Page 34 Chapter 4: Software CAN-Engine _____________________________________________________________________________________ unsigned char slave; unsigned int in_segm; /* input buffer segment */ unsigned int in_offs; /* input buffer offset */ unsigned int out_segm; /* output buffer segment */ unsigned int out_offs; /* output buffer offset */ unsigned char byte_delay;...
  • Page 35 Miscellaneous Serial Communication Functions One thing to be aware of in both transmission and receiving of data through the serial port is that TERN drivers only use the basic serial-port communication lines for transmitting and receiving data. Hardware flow control in the form of CTS (Clear-To-Send) and RTS (Ready-To-Send) is not implemented.
  • Page 36 Transmitted and received packets are buffered both in the hardware chipset (up to 64 bytes), as well as the interrupt-driven TERN firmware drivers (buffer size defined by application). TERN firmware drivers are configured to use the SJA1000 in BasicCAN mode only. More advanced features may be available by directly accessing the SJA1000’s control registers. The datasheet for the SJA1000 may be found on the TERN development CD in the directory \tern_docs\parts.
  • Page 37 TERN board for clean transmit and receive. inputBuf, iSize – these variables represent the ring-buffer allocated for receiving messages. inputBuf should be a CanMsg array, while iSize indicates the size of the array. TERN drivers will inject messages into this array on an interrupt-driven basis.
  • Page 38 After software drivers have been enabled, the CAN transceiver must still be enabled using a digital output pin. Once the transceiver is enabled, the port will be connected to the CAN bus, and able to transmit/receive messages. On the CAN-Engine, the transceiver is controlled using SER1 RTS pin:. s1_rts(0); // RTS1 low - enable. void can_hit Arguments: none Return value: non-zero if packet received, 0 if receive buffer is empty.
  • Page 39 When working with different TERN controllers enabled with the I2CHIP module, you must select the proper #define statements to describe your hardware configuration. See section 4.6.5 below for more details.
  • Page 40 5. The MAC address needs to be unique from any other device on the subnet. If you're using multiple C-Eye's on the same network, connected to the same hub, make sure they have different MAC addresses. Contact TERN if you are working with multiple C-Eyes and would like our help selecting unique MAC address ranges.
  • Page 41 For the SensorCore/R-Engine-L controllers, implying a direct mapping at 0x80000 with 'even byte' only shifted addressing. TERN_CEYE TERN_EE For the EE/CEye controller, implying direct mapping at 0x80000 (if no expansion board used). The TERN SCA also fits in this category; define TERN_EE when working with the TERN SCA. 4-19...
  • Page 42 Wiznet provides a variety of generic TCP/UDP/IP sample applications, including FTP, DHCP, SMTP, etc. TERN has ported a few of these over specific to the TERN platform, and expanded them by adding support to TERN peripherals (like the CF-based FAT16 filesystem). These samples are described below.
  • Page 43 (httpd_fs_u.axe, and httpd_fs_r.axe for different hardware platforms: the EE40, and the RE + P51 expansion board respectively) This sample layers a simple http daemon server on top of the i2chip module, and the TERN FAT16 filesystem. For details on the TERN FAT16 filesystem, see: \tern\186\include\fileio.h, and \tern\186\samples\flashcore\readme.txt.
  • Page 44 Chapter 4: Software CAN-Engine _____________________________________________________________________________________ tcp_client. This sample provides for a simple RS232-based TCP client. A 115200 baud, N81 serial connection is opened on SER1 with a simple menu based interface. Supported commands include: - ‘c’ (for establishing a new connection to a remote TCP server), - ‘i’...
  • Page 45 CAN-Engine Chapter 4: Software io_ping This very basic sample is only useful for the now discontinued I2CHIP, bus-based expansion board. httpd_img For customers using the C-Eye controller, a HTTP-based daemon serving up bitmap images is available in the samples\ceye\ directory.
  • Page 46 Chapter 4: Software CAN-Engine _____________________________________________________________________________________ 4.6.8.2 586-BASED BOARDS For 586-based boards, your project is the file: \tern\586\samples\i2chip\586_io.ide The same samples as above are duplicated. Please refer to above comments for more details about basic implementation. Related files include: - socket.c, socket implementation, as above.
  • Page 47 CAN-Engine Layout CAN-Engine CAN-Engine Layout All dimensions are in inches. 3.367, 2.175 3.575, 2.333 0.483, 2.267 1.233, 2.267 3.183, 2.217 3.442, 0.125 0, 0 2.408, 0.058 1.433, 0.075...
  • Page 48 74HC138 LM7805 LM340 /INT4 INT4 /RST /INT3 XTAL3 /TXD1 INT3 /INT0 /RXD1 /NMI INT0 INT2 RXD1 Title /INT1 VOFF TXD1 CAN-ENGINE INT1 /TXD0 TXD0 /RXD0 RXD0 Size Document Number 74HC14Z DS1337 CANE-M.SCH MAX232D Date: February 29, 2008 Sheet 1 of...