44
        CANLab 2005                 Jacques De Sylva                 [email protected]  CANLab 2005, V0.02                                     1                                                       04/25/05

CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva [email protected]. Table of Contents Introduction.....4File Size: 670KBPage

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

        CANLab 2005 

                Jacques De Sylva                [email protected]

 

CANLab 2005, V0.02                                     1                                                       04/25/05

Page 2: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

                                            

Table of ContentsIntroduction................................................................................................................................4System description.....................................................................................................................5

Operationnal Modes..............................................................................................................6System Design...........................................................................................................................7

Required Interface............................................................................................................7Address writing................................................................................................................8Data writing......................................................................................................................9Data reading...................................................................................................................10Interrupt Signal...............................................................................................................11

Power Supply......................................................................................................................11PPCAN Module Specifications...............................................................................................11

Specifications......................................................................................................................11Current consumption...........................................................................................................11

Parallel Port Interface.....................................................................................................12PPCAN Module Schematic Diagram......................................................................................13Software Description...............................................................................................................14

Device driver.......................................................................................................................15Character Driver Functions............................................................................................16

Console Description............................................................................................................19Output Pane....................................................................................................................19State Symbol (SS)..........................................................................................................19Status Bar.......................................................................................................................19Input Pane.......................................................................................................................20

Program Syntax...................................................................................................................20Top Level Syntax...........................................................................................................21CAN Module Syntax......................................................................................................22Command File Example.................................................................................................23

Error Management..............................................................................................................25Rx Errors in CAN 2.0A mode........................................................................................25Tx Errors in CAN 2.0A mode........................................................................................26Error treatment in CAN 2.0A mode...............................................................................27Rx Errors in CAN 2.0B mode........................................................................................28Tx Errors in CAN 2.0B mode........................................................................................28

Use Cases............................................................................................................................29CANLab Error Management .........................................................................................29

CANLab 2005, V0.02                                     2                                                       04/25/05

Page 3: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

CANLab Error Configuration........................................................................................30CAN Sub­System Configuration....................................................................................31CAN Record Mode.........................................................................................................33CAN Transmit Mode......................................................................................................34CAN Auto Respond Mode.............................................................................................35CAN Sequence Triggering Mode...................................................................................36

Programmer Manual................................................................................................................37Makefiles.............................................................................................................................37Classes Descriptions...........................................................................................................39

nwindow.........................................................................................................................40appscreen .......................................................................................................................41

System Test..............................................................................................................................43PPCAN tests........................................................................................................................43

Rx Buffer Overflow.......................................................................................................43Rx / Tx Maximum Interrupt Rate: Standard frames, no data.........................................43Rx / Tx Maximum Data Rate: Standard frames, 8 data bytes........................................43Rx / Tx Maximum Data Rate: Extended frames, 8 data bytes.......................................44

Copyright (C)2005 Jacques De Sylva. 

This document is free; you can redistribute it and/or modify it under the terms of the GNUGeneral Public License as published by the Free Software Foundation; either version 2 of theLicense, or (at your option) any later version. 

This document is distributed in the hope that it will be useful, but WITHOUT ANYWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESSFOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 

CANLab 2005, V0.02                                     3                                                       04/25/05

Page 4: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Introduction

This document describes the CANLab software. This program can be used to monitor andanalyse CAN traffic at datarate up to 1 Mb/s. Received transactions can be stored on a file ordisplayed on the terminal screen. Additionnally, differents operations can be initiated by thesoftware according to received frames content and the current program configuration. Here isa summary of the differents functions available in CANLab 2005: 

• Traffic recording in file.• Traffic playback (not implanted yet).• Automatic Reply to selected frames based on Frame's address & data (not implanted yet).• Frame Sequence Detection based on Frame's address & data (not implanted yet).• File Scripts Execution.• Modbus support (not implanted yet).

Note that no fancy GUI is provided with this program which is based on simple commandsand script files. Helper applications may be developped to provide configuration andprogrammation facilities. 

CANLab 2005, V0.02                                     4                                                       04/25/05

Page 5: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

System description

The intended uses of the system is to test / debug / monitor CAN network. This can be donesilently, CANLab logging every frame meeting his acceptance criteria, or more evoluatefeatures such auto­reply and sequence triggering can be activated. Theses functions are fullyimplemented in the two CAN Frames format: Basic Frames & Extended Frames.

The system is divided in two hardware components and three software modules: 

Hardware components:• Common Of The Shelf Computer (COTS Computer).• The PPCan module (1).

The first component (COTS computer) is configured to execute the CANLab software whichrun under Linux OS.   

The second component, the PPCan module, simply connect a CAN Controller (PhilipsSJA1000) to the standard PC Parallel Port (EPP mode). The CAN module uses the SJA1000CAN controller from Philips and is powered from an external DC power source. 

Note 1: "PPCan module" refer to the hardware component while "PPCan driver" refer to thesoftware component.

CANLab 2005, V0.02                                     5                                                       04/25/05

Page 6: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Software Components:• PPCAN Driver• CANLab software• Database ( not implanted yet ).The PPCAN driver manages all access to the PPCan module. It is designed to run with theLinux kernel (version 2.6) and provides Read, Write, Open, Close and IOCTL operationtouser applications. The current version allows only one process to open the device at the time.

The CANLab software uses the driver to monitor the CAN traffic on the network andexecutes user requested operations. This component manages all networks communications,configurations and database access (TBD) .

Operationnal Modes

1. Record mode : In this mode, all frame which meet the acceptance conditions are copiedinto the log file.

2. Auto Respond mode : In this mode, a reply is returned to all frame which meet theacceptance conditions. The acceptance conditions for this operationnal mode is that frameaddress matches the acceptance conditon AND  the Remote Transmission Request bit(RTR) set.

3. Sequence Triggering mode : In this mode, an action is initiate when a sequence offrames is detected on the CAN bus. 

4.FIXME => Define frame's content and timing requirement definition.FIXME => Define action! Logging, Frame reply, Email!

CANLab 2005, V0.02                                     6                                                       04/25/05

Page 7: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

System DesignParallel Port Interface 

Required Interface 

To use SJA1000, the parallel port interface have to support followingoperations:

- Address writing; - Data writing; - Data reading;

To meet these requirements, we will use the EPP mode ( Enhanced ParallelPort ) which enable higher data rate. Following waveforms representparallel port timing in this mode. I refer the reader to the followingaddress ( http://www.beyondlogic.org/epp/epp.htm ) for more explanationson the parallel port EPP mode.

Note that the EPP exist in two versions on current PC systems: 1.7 and1.9. The main difference is that version 1.9 need a WAIT* handshakesignal while this is not required in version 1.7. The PPCAN module willsupport both versions of the standard.

CANLab 2005, V0.02                                     7                                                       04/25/05

Page 8: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Address writing |______________ ____________ | | | Write* | | | +--------------------------------------------------------------- |______________ _______________________AStrobe* | | | | |________________________| +--------------------------------------------------------------- |_______________________________________________________________DStrobe* | | +--------------------------------------------------------------- | ___________________________ Wait* | | | |__________________| |________________ +---------------------------------------------------------------AD7 | _______________________________ to |_________________/// Adress \\____________AD0 | \\\ // +---------------------------------------------------------------

CANLab 2005, V0.02                                     8                                                       04/25/05

Page 9: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Data writing |______________ ____________ | | | Write* | | | +--------------------------------------------------------------- |_______________________________________________________________AStrobe* | | +--------------------------------------------------------------- |______________ _______________________DStrobe* | | | | |________________________| +--------------------------------------------------------------- | ___________________________ Wait* | | | |__________________| |________________ +---------------------------------------------------------------AD7 | _______________________________ to |_________________/// Data \\____________AD0 | \\\ // +---------------------------------------------------------------

CANLab 2005, V0.02                                     9                                                       04/25/05

Page 10: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Data reading |_______________________________________________________________ |Write* | +--------------------------------------------------------------- |_______________________________________________________________AStrobe* | | +--------------------------------------------------------------- |______________ _______________________DStrobe* | | | | |________________________| +--------------------------------------------------------------- | ___________________________ Wait* | | | |__________________| |________________ +---------------------------------------------------------------AD7 | _______________________________ to |_________________/// Data \\____________AD0 | \\\ // +---------------------------------------------------------------

Note1: SJA1000 signals ALE/AS and Rd*/E are respectively inversed AStrobe*and DStrobe* of parallel port.

Note2: Wait* signal is generate from signal AStrobe* and DStrobe* tosupport EPP version 1.9. We have Wait* == Not(AStrobe* AND DStrobe*).

Note3: Delay Th(AL-A) & Th(i)(EL-D) are provides by Wait* circuit.

CANLab 2005, V0.02                                     10                                                       04/25/05

Page 11: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Interrupt Signal

EPP mode of parallel port detect interruptions on the rising edge ofsignal present at Intr* (broche 10 du connecteur DB25). The SJA1000controller output signal for interruption gives a 5 Volts to 0 Volttransition (falling edge). We have to invert the signal for the goodworking of the circuit in the PPCAN module.

Power Supply

The PPCAN module must be powered from an externel DC Power source thru woconnectors provided for this purpose. A 7805 rugulator circuit is thenused to provide a clean regulated 5 volts supply to the module. A fuseprotected the module from polarity inversion of the input sully lines.

PPCAN Module Specifications

Specifications

Parameter Minimum Maximum UnitDC Input voltage (Ext. PS) 7 30VDCDC Input current (Ext. PS) - 100ma

CAN Bus loading (diff. input resistance) 20 100Kohms

Current consumption

Parts Minimum MaximumSJA1000 - 15 maPCA82C250 - 70 ma74HCT00 - 1 ma74HCT14 - 1 ma

CANLab 2005, V0.02                                     11                                                       04/25/05

Page 12: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Parallel Port Interface

 FIXME => Parallel Port Interface Specification

CANLab 2005, V0.02                                     12                                                       04/25/05

Page 13: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

PPCAN Module Schematic Diagram

CANLab 2005, V0.02                                     13                                                       04/25/05

Page 14: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Software Description

The intended goal of this software is to develop a general purposes engine used to controlautomation functions on a PC. The objective is to provide automation solutions at low costfor both domestic and industrial environment.  Ideally, the software will run without GUI, theHMI beiing hosted on a remote client. 

Practically, for development, configuration and debugging purpose, a front end will beprovided: CANLab 2005. As the name indicates, the current software support CANcommunication throught the PC parallel port. Eventually, MODBUS support and automaticcontrol functions will be added (to be defined).

Boot sequence:

The software is developped for the Linux OS with the ncurses library. This choice is to allowlow footprint systems to be configured to run CANLab 2005. After power up, if the file“autocan.cmd” is found in the program directory, it is execute to configure the system.Otherwise, the system is in idle and wait for user  command.

CANLab 2005, V0.02                                     14                                                       04/25/05

Page 15: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Device driver

The PPCAN device driver is used to access the CAN bus thru the PC parallel port. It mustbe loaded before launching the software. To enable correct loading of the PPCAN driver,the PPCAN module must be connected to the host parallel port. If not, “insmod” functionwill return with an IO Error and the driver will not be loaded into kernel. Followings arethe configuration parameters that can be passed to the module at load time and theirdefault values:

Parameter Name Type Default Valuedev_name char* ppcan

base_address int 0x378dev_irq int -1

dev_major int 0 (auto number)

rxtx_buffer_size int 10tx_interframe_delay int 0

Parameters description

Parameter Descriptiondev_name The device name, as it will appear in the /dev folder.

base_address The parallel port base address to use. The device will uses thisport 8 first s IOs (Enhance Parallel Port mode) plus the 3 IOslocaled at base_address + 0x400.

dev_irq The irq associate with the parallel port. If this parameter is notused, the default value (-1) will be changed as per the baseaddress used:base_address = 0x378 ==>> dev_irq = 7base_address = 0x278 ==>> dev_irq = 2base_address = 0x3bc ==>> dev_irq = 5

dev_major The device major number to used to regiter the character device.If this parameter is not used, the default value (0) will beoverwritten with a value assigned by the OS.

rxtx_buffer_size The size of the device circular buffers used to transmit andreceive CAN frames. If this parameter is not used, the defaultvalue is 10 frames for both buffer.

CANLab 2005, V0.02                                     15                                                       04/25/05

Page 16: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Parameter Descriptiontx_interframe_delay The delay, in milliseconds, inserted between the transmission of

frames. This is an approximate value and is system dependant.The default value is 0 msec.

Character Driver Functions

The PPCAN driver implements a character device driver to control the PPCAN Module. Assuch, it implements “standard” file operations associted with char devices. Here is a list oftheses functions and a brief description:

– ppcan_open: The open function is called when the user program open the device in it's initprocedure. The PPCAN driver limits the number of process able to access the driver at thesame time to one. This operation is protected by a spinlock to avoid race condition. Thislimitation may vanished in the future. The open function also request the interrupt numberused by the driver.  An error message is log at INFO level in the kernel log file if the irqnumber cannot be obtains.

– ppcan_release: This is the driver cleanup function. The interrupts are diseabled and the irqnumber is released.

– ppcan_read_data: This function implements the device read operation. Both blocking andnon­blocking mode are supported. 

RECEIVE BUFFER MANAGEMENT

When the circular buffers are created, ptr_interrupt_ and ptr_frame_ point tothe same frame in the list. When a new frame is received, it his stored at thissame position and the interrupt pointer is moved to the next frame in the list.If a rcv interrupt is detected by the SJA1000, we also have to check that wedo not overlapped the list. Since the read function moves the ptr_frame_readpointer in the same manner, we have to verify that ptr_interrupt_read­>next !=ptr_frame_read, in which case (if ==) the buffer is considered to be full (even ifin reality, we still have one place left). We use this test to differentiate thesituation where ptr_interrupt_read == ptr_frame_read which means that the bufferis empty.

CANLab 2005, V0.02                                     16                                                       04/25/05

Page 17: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

At initialization(nothing received):

 ptr_interrupt_read ptr_frame_read        |       V ******* next      ******* next *    1     ******>*     2    *******> *******              *******  After one interrupt:

             ptr_interrupt_read        ptr_frame_read  |           |                       |          V                     V   ******* next     ******* next   *     1   ******>*     2     *******>   *******             *******

– ppcan_write_data: This function implements the device write operation. Both blockingand non­blocking mode are supported.

TRANSMIT BUFFER MANAGEMENTWhen the circular buffers are created, ptr_interrupt_ and ptr_frame_ point tothe same frame in the list. This condition indicates that the buffer is empty.When new frames are required to be transmitted, the  ppcan_write_data functionwrite them into the ptr_frame_write position and move this pointer to the nextitem in the list. If we compare with the receive algorithm, the pointermove in the oppsite sequence: ptr_frame_write is first update by theppcan_write_data function, then the ptr_interrupt_write move to this new position(because ptr_frame_write != ptr_interrupt_write) and transmit the frames.

At initialization (nothing to transmit):

ptr_interrupt_writeptr_frame_write | V

CANLab 2005, V0.02                                     17                                                       04/25/05

Page 18: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

******* next     ******* next*    1    ******>*    2      *******>*******             *******

After one write from ppcan_write_data function:

ptr_interrupt_write |                  ptr_frame_write |                             | V                           V******* next     ******* next*    1    ******>*    2     *******>*******             *******

– ppcan_ioctl: This function handle ioctl call from user space.  This driver uses IO magicnumber = 0xf0 to encode its operations. Here is the operations supported:PPCAN_IOC_RESET: This operation reset the SJA1000 in a knowned state and emptyboth circular buffers by setting read/write and interrupt pointers to the same frame.PPCAN_IOCT_MODE: TBDPPCAN_IOCT_INTERRUPT: Enable / Disable interrupt according to the receivedparameters associate with the SJA1000 interrupts. The PPorts interrupts are enabled assoon as one SJA1000 is requested and they are disabled if no SJA1000 interrups arerequired. PPCAN_IOCT_DATA: Output value to the module databus. The data is passed by value.PPCAN_IOCT_ADDRESS: Output value to the module address bus. The data is passedby value.PPCAN_IOCT_CONTROL: Output value to the parallel port control register. The data ispassed by value.PPCAN_IOCS_REGISTER: Initialize register's content. The data is passed with appcan_register structure define as follow:

  typedef struct _ppcan_register  {    char address;    char data;  } ppcan_register;

 PPCAN_IOCG_REGISTER: Read register's content. The data is passed with appcan_register structure.

CANLab 2005, V0.02                                     18                                                       04/25/05

Page 19: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Console Description

The main screen is divise into four  sections: output pane, state symbol, status bar, inputpane.

Output Pane

The first section on the screen is the output pane. It is the bigger section on the screen andwhere the program output information to user. 

State Symbol (SS)

This symbole color and type change accoding to the program state. We identify the followingprogram states:

State Symbol DescriptionIdle * The program is waiting for user commands, no others

actions are performedRx R All frames received by the program are logged according

to the receive command issue (i.e. rxon log / rxon det /rxon all).

Tx T Transmit a serie of frames according to the transmitcommand issue ( i.e. tx number_of_frames) and thePPCAN driver configuration (tx_interframe_delay).

RxTx & The program is transmitting frames AND is in receivedmode.

Note: The symbol is green when no error is detected. When an error occurs, the symbol passto red. All errors are logged into the “error.txt” file. The current symbol turn back to greenwhen the user issu the “error clear” command.

Status Bar

The status bar is displayed at the bottom of the screen. It contain feedback information aboutprogram execution ( as error codes).

CANLab 2005, V0.02                                     19                                                       04/25/05

Page 20: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Input Pane

The input pane stands beside the status bar. It enables user to give command to the software. 

Following figure represents the main screen:

**********************************************************************                                                                                                                                      **                                                                                                                                      **                                                                                                                                      **                                                                                                                                      **                                                                                                                                      **                                                   Output Pane                                                               **                                                                                                                                      **                                                                                                                                      **                                                                                                                                      **                                                                                                                                      **                                                                                                                                      *********************************************************************** SS  *                                 Status Bar                               *       Input Pane                  **********************************************************************                                    fig 1    CANLab main ScreenProgram Syntax

The command parser uses the space as delimiter to tokenize the command line. The tokensare then interpreted from left to right, the first one representing the target subsystem. As anexample, the command line:

can wr 0 0

is composed of four tokens. The first one identify the CAN interface, the second one is the“Write Register” command and the two others identifies the target register and the data towrite.

Current version of the software recognizes only the CAN subsystem. Note that all commandnot recognized as subsystems are considered “Top Level Commands”. This means that toplevel commands do not have subsystem identifier as first token. 

CANLab 2005, V0.02                                     20                                                       04/25/05

Page 21: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Top Level Syntax

Command Descriptionhelp / ? Display a brief description of possible commands. The system

configuration (CAN, Modbus, Database) is also displayed.exit / quit / bye Close the CANLab software.error ? Display the last recorded error and set the system state to “no error”.

If this command repeated before any error occured, the errordisplayed will be “no error”. Following is the list of allowed errors:

- no error- CAN Data Overrun Error- CAN Rx Circular Buffer Overflow- CAN Error Warning- CAN Bus off- MODBUS Error- DB Error

error count Display total error count since last “error reset” command.error reset Set the error count to 0.

Following are reserved subsystems keywords:

Keyword DescriptionCAN CAN bus commands used by the PPCAN module.SER Serial link commands.PP Parallel Port commands.MDB MODBUS related commands.DB Data Base commands.ERROR Error commands.

CANLab 2005, V0.02                                     21                                                       04/25/05

Page 22: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

CAN Module Syntax

Command Descriptioncan tx number_of_frames Transmit a burst of frames according to current CAN sub-

system configuration. All frames are data frames with 8 databytes. Each data byte is initialysed according to the frameposition into the sequence (The first frame data is 0x01, thesecond one 0x02 and so on...).

can rxon Start the CAN sub-system reception mode. All frames arestore into the “canmod.out” file and displayed on theCANLab output pane.

can rxon nolog Start the CAN sub-system reception mode. All frames aredisplayed on the CANLab output pane.

can rxon nodet Start the CAN sub-system reception mode. All frames arestore into the “canmod.out” file.

can reset Reset the CAN module SJA1000. Module configuration isnot affected (interrupts).

can wr address data Write SJA1000 Register. can rr address Read SJA1000 Register. can error log value Log errors indicated by value and signal them to the user.

The “value” variable is the “or” of following numbers:

- 0 => None. Do not log any error. - 1 => Rx Circular Buffer Overflow.- 2 => SJA1000 Data overrun error. - 4 => SJA1000 Error Counter Overflow.- 8 => Tx Pending Error- 15 => All

can error rxoverrun action Defines how Rx Circular Buffer Overflows will be treated.What do we do when the input buffers is full and there arestill somes frames coming in? Following are the allowedvalues for the action field:

- drop => The new incoming frame is lost. - incr => Increase the Rx circular buffer size.- wait => Wait. Timeout == 1 seconds.

can error txpending timeout Set the timeout value after what the error is raised.

CANLab 2005, V0.02                                     22                                                       04/25/05

Page 23: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Command File Example

Following is an example of command file that can be executes by the CANLab software.

# Jacques De Sylva, 2005## This is a sample command file to uses with the CANLab software.# The file will be executes automatically if it is named "autocan.cmd"# and if it is located in the software working directory at startup.## Set the Reset Request BIT of the SJA1000can wr 0 1## Set Acceptance Code to FF (Allow everything!)can wr 4 0xff# Set Acceptance Mask to FF (Allow everything!)can wr 5 0xff# Set BTR0 to operate at 1 Mb/s with a 24MHz xtal # Tscl = 1/12MHz# Set Tsjw = 2 Tsclcan wr 6 0x00## Set BTR1 to Single sampling in Sync Segment# Set TSEG2 = 4/12MHz (TSEG2.2 to TSEG2.0 = 011)# Set TSEG1 = 7/12MHz (TSEG1.3 to TSEG1.0 = 0110)can wr 7 0x36## Set the Output Control Register to oxda# OCTP1  OCTN1  OCPOL1  OCTP0  OCTN0  OCPOL0  OCMODE1  OCMODE0#   1      1       0      1      1      0        1        0can wr 8 0xda## Set the Clock Divider Output## Basic CAN, Bypass, RxInt disable, reserved, Clock off,#     0         1         0             0         1        #can wr 31 0x48# Reset the Reset Request BIT of the SJA1000can wr 0 0

CANLab 2005, V0.02                                     23                                                       04/25/05

Page 24: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

## Write tx address MSBcan wr 10 0# Write tx address LSBcan wr 11 0x11# Request frame's transmissioncan wr 1 1can wr 1 0

CANLab 2005, V0.02                                     24                                                       04/25/05

Page 25: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Error Management

This section describes how eroors are treated in CANLab. 

Rx Errors in CAN 2.0A mode

1. Rx Circular Buffer Overflow This error occurs when CAN frames mathching the acceptance filter criteria of theSJA1000 arrived at a rythm too fast to allow PPCAN driver to process them appropriately.If the PPCAN Driver do not have enough room to save the incoming data, the Rx CircularBuffer overflows. In this situation, we have three options. The first one is to wait, untilCANLab software recuperates some data from the PPCAN driver, allowing this one tostore the incoming data into the newly freed buffer. This is the default treatment inPPCAN driver. This can be risky because if CANLab software do not freed memories fastenough, the frames will stayed in the SJA1000 buffer which will eventually overlappedtoo. this is also very dependant of host performances   and CAN bus loading.

The second option is to increase on the fly the size of the Rx Circular Buffer. Thisrequires a lot of processing (CPU time), and according to network speed, loading and hostsystem speed, may again leed to SJA1000 Data overrun.

The third option is to drop the frame. 

Note that which option the user choose, he have to configured the SJA1000 error loggingmechanism to ensure those errors are reported correctly.

2. SJA1000 Data Overrun InterruptsAccording to the SJA1000 data sheet, when a data overrun error occurs, a message(frame) was lost because there was not enough space for that message in the SJA1000RXFIFO. Up to this situation, there is not much we can do except to log the error. For theerror treatment, we have to increment the “data overrun error counter” and clear theSJA1000  data overrun error by writing to the SJA1000 command register bit 3 (0x08).

3.  SJA1000 Error InterruptsIn Rx mode, the SJA1000 initiates an error interrupt to the host system in the followingsituation:­ The Rx error counter exceeds the 96 errors limit. This is normally a symptom of a highlydisturbed node. In this case the status register bit 6 will be sets to 1. CANLab softwarewill then memorized this error condition and gives a visual indication to the user. Notethat this is a Rx/Tx error.

CANLab 2005, V0.02                                     25                                                       04/25/05

Page 26: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Tx Errors in CAN 2.0A mode

1. Transmission Pending ErrorThis kind of error occur when the SJA1000 cannot completes the transmission requestedby the user. One of the possible causes can be that the transmitted frame had not beenacknowledge by a remote node. There is no way to detect this kind of error except to notethat the transmission complete bit of the status register is not set after “x seconds”. So thisshould be a configuration of the CANLab software (not the PPCAN driver). Practically,will will raise this error when the elapse time between transmit command and the “not yettransmit” observation exceeds the configure value.

2. SJA1000 Error InterruptIn Tx mode, the SJA1000 initiates an error interrupt to the host system in the followingsituations:­ The Tx error counter exceeds the 96 errors limit. This is normally a symptom of a highlydisturbed node. In this case the status register bit 6 will be sets to 1. CANLab softwarewill then memorized this error condition and gives a visual indication to the user. Notethat this is a Rx/Tx error.­ The transmit error counter exceeds the 255 errors limit. In this case, the Bus Status Bit(bus­off) and the command register Reset Request Bit are set to 1. The SJA1000 stays  inReset mode until the Reset Request Bit is cleared by the user (TBD => can error ?command...?).   ­ Once the following sequence is executed:     1­ User clears the Reset Requested Bit;    2­ 128 occurences of “bus free signal” are detected;    3­ The error counters and the error status bit have been cleared by SJA1000. This         indicates that the PPCAN module is “on­bus” again.

In this situation, the SJA1000 transmit an interrupt to the host system. Not quite sure herewhat we can do with that!!! For this version, we clear the interrupt and advise the user.Note that this is considere an Rx/Tx error. TODO => more ...

CANLab 2005, V0.02                                     26                                                       04/25/05

Page 27: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Error treatment in CAN 2.0A mode

There are two situations that CANLab software needs to manage in the CAN errorsprocessing: user request and SJA1000 request through interrupts.

• User Request:These are errors configuration and reporting actions. Please refer to “Use Cases section”in this document fore more details.

• SJA1000 requests:There are two sources of interruption related to error treatment in the SJA1000: Dataoverrun interrupts and error interruptions. Most of the process is performed into thePPCAN driver. Here is the general error interrupt routine algorithm:

­ IF this is a Data Overrun Interrupt THEN    ­ Increments Data Overrun Count­ ELSE IF this is an Error Interrupt THEN    ­ IF we are in the “Bus­Off” state        ­ Memorize “Bus­Off” state    ­ ELSE IF we are in the “Bus­On” state        ­ Memorize “Bus­On” state    ­ ELSE        ­ Memorize “Interrupt Error Condition”­ ELSE    ­ Memorize “Interrupt Error Condition”

CANLab 2005, V0.02                                     27                                                       04/25/05

Page 28: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Rx Errors in CAN 2.0B mode

Tx Errors in CAN 2.0B mode

CANLab 2005, V0.02                                     28                                                       04/25/05

Page 29: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Use Cases

Introduction

This section describes the expected use cases of CANLab 2005. For all use cases, it isassumed that the PPCAN module is connected to the PC parallel port and that the PPCANdriver is loaded in the Linux kernel.

CANLab Error Management

1. DescriptionThis use case describes the global error management process with CANLab. This use caseassume that the system had just start (or had been reset anyhow) and that no informationabout current error status is valid for the user.

2. Flows of events2.1 Basic Flow1­ The user configures CANLab error handling mode using the “CANLab errorconfiguration” use case.2­ The user clears any pending error using the “error clear” command. The systemresponds by setting the state symbol color to green.3­ The user start the desired CANLab functionality (can rxon, can tx n, etc...).When thesystem detect an error, the software automatically changes the state symbol color to RED,increments the error count and store the error description as per current errorconfiguration.4­ The user can then clear the error (turning the state symbol color back to GREEN) byrequesting the last error description using “error ?” command.

3. Special requirementsNone

4. Pre­Conditions­ As describe in the use cases section introduction.­ The system must be configure correctly to work on the target network.­ The CAN sub­system should be set to idle mode using the “can idle” command.

5. Post­ConditionsNone

6. Extensions PointsNone

CANLab 2005, V0.02                                     29                                                       04/25/05

Page 30: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

CANLab Error Configuration

1. DescriptionThis use case describes the error configuration in CANLab. CANLab error configurationrefer to system and sub­systems error handling and error reporting. 

2. Flows of events2.1 Basic Flow1.0­ The user stop all CANLab sub­system functions using the appropriate commands.2.0­ The user configures the CAN sub­system error management. 2.1­ The user select which errors will be logged using the command “CAN error logvalue” command. Refer to the paragraph “CAN Module Syntax” for allowed error values.2.2­ The user select how the PPCAN driver Rx circular buffer overrun will be treatedusing the “can error rxoverrun action” command.  Refer to the paragraph “CAN ModuleSyntax” for allowed action values. 2.3­ The user select how the SJA1000 data overrun will be treated using the “can errorsjaoverrun action” command. Refer to the paragraph “CAN Module Syntax” for allowedaction values. 

3. Special requirementsNone

4. Pre­Conditions­ As describe in the use cases section introduction.­ The system must be configure correctly too work on the target network.­ The CAN sub­system should be set to idle mode using the “can idle” command.

5. Post­ConditionsNone

6. Extensions PointsNone

CANLab 2005, V0.02                                     30                                                       04/25/05

Page 31: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

CAN Sub-System Configuration

1. DescriptionThis use case describes the configuration of the CAN module with the CANLab software.When the driver is first loaded into the Linux kernel, it is automatically configured tooperate at 1MB/S according to following settings:

              ­ Acceptance code & mask to accept all frames.                 ­ Set BTR0 to operate at 1Mb/s with 24 MHz xtal.              ­ Tscl = 1/12MHz              ­ Tsjw = 2 Tscl              ­ Set BTR1 to single sampling in sync segment.              ­ Set TSEG1 = 7/12MHz (TSEG1.3 to TSEG1.0 = 0110).              ­ Set TSEG2 = 4/12MHz (TSEG2.2 to TSEG2.0 = 011).              ­ Set the output mode Push­Pull, normal mode.              ­ Set Mode to Basic CAN, Bypass, No o/p clock.              ­ Go into Normal Mode, no interrupts enabled.

This use case describes the operations required to change those settings.

2. Flows of events2.1 Basic Flow1­ The user stop any CAN function currently running in the CANLab software with the“can idle” command.2­ The user reset the SJA1000 by writing data 0x01 at register address 0.3­ The user set the Acceptance Code (SJA1000 register address 4) as per systemrequirement.4­ The user set the Acceptance Mask (SJA1000 register address 5) as per systemrequirement.5­ The user set the Bit Timing Register 0 (SJA1000 register address 6) to meet requiredCAN bus frequency.6­ The user set the Bit Timing Register 1 (SJA1000 register address 7) to obtain requiredsegment length.7­ The user set the Output Control Register (SJA1000 register address 8) to configureSJA1000 output stage.8­ The user set the Clock Divider Register (SJA1000 register address 31) to obtainrequired clock frequency.9­ The user enable the SJA1000 operation and interruptions by writing appropriate data atregister address 0.

CANLab 2005, V0.02                                     31                                                       04/25/05

Page 32: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

2.2 Alternative Flows2.2.1 Configuration is encoded into a script file.1­ The user stop any CAN function currently running in the CANLab software with the“can idle” command.2­ The user launch a command script to automatically makes the configuration (look at theCommand File Example in this document).

3. Special requirements

None

4. Pre­Conditions

­ As describe in the use cases section introduction.­ No errors should be present (all errors should be cleared by user).

5. Post­Conditions

None

6. Extension Points

None

CANLab 2005, V0.02                                     32                                                       04/25/05

Page 33: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

CAN Record Mode

1. DescriptionThis mode enable the CANLab software to listen to the CAN channel and to log receivedframes as per current CANLab configuration.

2. Flows of events2.1 Basic Flow1­ The user start recording using the “can rxon” command.2­ When the desired recording period is expired, the user issue the “can rxoff” to stop therecording process.2.2 Alternative Flows2.2.1 Do not record frames on fileAlternatively, in the basic flow, the user can issue the command “can rxon nolog” to avoidframes recording in the file.2.2.2 Do not display frames on the screenAlternatively, in the basic flow, the user can issue the command “can rxon nodet” to avoidprinting of frames details into the PC screen. This allows the receiving system to be morerapid to process incoming frames.2.2.3 Error during receptionWhen an error is detected during frames reception, an indication is provided to the userand an inscription is made in the file if the system is in logging mode. The error is thenautomatically cleared and the system resume normal operation.

3. Special requirementsNone

4. Pre­Conditions­ As describe in the use cases section introduction.­ No errors should be present (all errors should be cleared by user).­ The system must be configured correctly to work with the target network.

5. Post­ConditionsIf the use case is NOT initiated with the “can rxon nolog” command, the file“canmod.out” is available into the CANLab working directory. This file contains all thereceived frames and error messages.

6. Extensions PointsNone

CANLab 2005, V0.02                                     33                                                       04/25/05

Page 34: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

CAN Transmit Mode

1. DescriptionThis mode enable the CANLab software to transmit a burst of frames. All frames are dataframes with 8 data bytes. Each data byte is initialysed according to the frame position intothe sequence (The first frame data is 0x00, the second one 0x01 and so on...).

2. Flows of events2.1 Basic Flow1­ The user start the transmit mode using the “can tx number_of_frames” command.

3. Special requirementsNone

4. Pre­Conditions­ As describe in the use cases section introduction.­ No errors should be present (all errors should be cleared by user).­ The system must be configured correctly to work with the target network.

5. Post­ConditionsThe frames are transmitted.

6. Extensions PointsNone

CANLab 2005, V0.02                                     34                                                       04/25/05

Page 35: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

CAN Auto Respond Mode

CANLab 2005, V0.02                                     35                                                       04/25/05

Page 36: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

CAN Sequence Triggering Mode

CANLab 2005, V0.02                                     36                                                       04/25/05

Page 37: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Programmer Manual

Makefiles

There are four makefiles associated with the software.

• Top Level Makefile: Located in the project root directory, this makefile manages the buildprocess for each sub module. 

• PPCAN Makefile: This file is located in the ./PPCAN/ sub­directory and is used to buildthe PPCAN Linux Driver.

• CANLab Makefile: This file is located in the ./CANLab/ sub­directory and is used tobuild the CANLab software

• MODBUS Makefile: This file is located in the ./MODBUS/ sub­directory and is used tobuild the MODBUS interface.

Following variables must be defined correctly before launching the make : 

PPCAN_DEBUG  : If this variable si defined, debug information associate whit the devicedriver will be log into the kernel info file  (/var/log/kernel/info) . This is an ON / OFFswitch. Following syntax is used at bash prompt to compile module with the debug info:

export set PPCAN_DEBUG=1

CANLAB_DEBUG   : This variable defines the logging level for CANLab 2005. A zerovalue means no logging while a value of 5 means Log everything. Following syntax is usedat bash prompt:

export set CANLAB_DEBUG=5

CANLab 2005, V0.02                                     37                                                       04/25/05

Page 38: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

When debugging information is inserted at compile time, execution traces will be found infollowing text files:

Filemane Descriptiont_appenv.txt File uses to log debugging information generated by the program

environment class (source file appenv.cpp).t_appscreen.txt File uses to log debugging information generated by the program

main window class (source file appscreen.cpp).t_canmod.txt File uses to log debugging information generated by the program

CAN class (source file canmod.cpp).

CANLAB_VER   : This variable defines the software version number. This number is usedto named the executable files. It also appears in the main screen status bar when the “help”command (?) is initiated.

Makefiles Invocation / Parameters : 

Following parameters can be passed to the CANLab makefile to control make operations:

Parameter Descriptionall Default make operation. The PPCAN driver, the CANLab software

along with the MODBUS classes will be build. ppcan Build only the PPCAN Linux Driver.canlab Build only the CANLab software.modbus Build only the MODBus associate classes.clean With this parameter, make erase all object (*.o, *.ko) and text (*.txt)

files in root and sub-directories. The executable and tar files are alsoerased.

distrib Create compressed file (tar.gz) with source and conpiled executable.This file is named canlab-$(CANLAB_VER).tar.gz

Following is a command line example to build the PPCAN driver for the 2.6 serie kernels:

make ­C ~/projects/kernel/src/linux­2.6.10­PREEMPT/ SUBDIRS=~/projects/ppeng/src/ppcan modules

CANLab 2005, V0.02                                     38                                                       04/25/05

Page 39: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Classes Descriptions

This is the class diagram for the CANLab software.

CANLab 2005, V0.02                                     39                                                       04/25/05

Page 40: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

nwindow

Description: This class encapsulates the ncurses functions required to manipulate a window.As much as possible, this class will provides only encapsulation, no local functionnalitieswill be developped here. They are ncurses equivalent related to a curses window. Thisenables multiwindow management. Please note that to respect ncurses implementation,character are encoded into the unsigned long int type which is equivalent to ncurses chtype.

Attributes:

Name DescriptionWINDOW* mywin This is the pointer to the ncurses structure defining the class

window.int mywidth This is the horizontal size of the window. int myheight This is the vertical size of the window.

Methods:

Name Descriptionnwindow(void) Default constructor. The window created will uses the full

terminal screen.nwindow(int y, int x) Constructor used to define a new window of predefine size. int addch(unsigned long ch) This function put a single character into the current cursor

location and advance the position of the cursor. If ch is a tab,newline, or backspace, the cursor is moved appropriatelywithin the window.

int addchnstr(constunsigned long *lp, int n)

Copy lp into the window at and after the current cursorposition. Copy at most n elements, but no more than will fiton the line.

int addchstr(const unsignedlong *lp)

Copy the lp string into the window image structure at andafter the current cursor position.

int addstr(const unsignedlong *)

Add a string of characters to a curses window and advancecursor to the next position.

int beep (void) This function sounds an audible alarm on the terminal, ifpossible; otherwise it flashes the screen (visible bell).

int flash (void) This function flashes the screen, and if that is not possible,sounds the alert. If neither alert is possible, nothing happens.

CANLab 2005, V0.02                                     40                                                       04/25/05

Page 41: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Name Descriptionmvaddch (int y, int x, constchtype ch)

Moves the cursor to y row and x column, adds the chcharacter at this position and advance to the next position.

appscreen

Description: This class encapsulates CANLab main window. It inherits functionnalities fromits super class “nwindow”. Locally, we add the screen content management, status bar,inputfield and state symbol management.

Attributes:

Name Descriptionchar inputstring[80] This is the buffer holding the command line enter by the user

in the input section.string strcaption This string holds the application caption.string statusbartext This string holds the status bar content.string *linearray This array holds the screen text content.int *linecolor This array holds the line color associates with the text to

display on the screen. It have the same dimension as the“linearray” attribute, array index matching together.

unsigned int screenlines The number of lines we can display on the window.unsigned int screenposition This attribute indicates where in the string array we will write

the next line.unsigned int screenfull This attribute is used to control the line scrolling in the

“writeline” method algorithm.debug *appscreendebug This object is used to output debug information on the output

trace file associates with this class.

CANLab 2005, V0.02                                     41                                                       04/25/05

Page 42: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Methods:

Name Descriptionappscreen(int aheight, int awidth)

Constructor used to define a new window of predefine size.

~appscreen(void) Destructor

void drawrectangle(unsigned int y = 0,unsigned int x = 0,unsigned int awidth = 0,unsigned int aheight = 0)

void drawrectanglerelative(unsigned int y = 0,unsigned int x = 0,unsigned int aheight = 0,unsigned int awidth = 0)

CANLab 2005, V0.02                                     42                                                       04/25/05

Page 43: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

System Test

PPCAN tests

Rx Buffer Overflow

This test submit the PPCAN module to a buffer overflow. We have to compile a module with10 frames in the Rx circular Buffer and send at least 11 frames to force the overflow. 

How the SJA1000 can memorize frames for us?

How frames can it memorize?

Dynamic expansion of Rx Buffer?

Do we lost frames?

Results : To Follow.

Rx / Tx Maximum Interrupt Rate: Standard frames, no data.

This test submit a PPCAN module / driver to a maximum interrupt rate test. This testevaluates the interrupt handling mechanism.

Results : To Follow.

Rx / Tx Maximum Data Rate: Standard frames, 8 data bytes.

This test submit a PPCAN module / driver to a maximum data rate test. We have to evaluatehow much time we need to  process in and out frames with standard frames (CAN Standardversion 2.0A). 

Results : To Follow.

CANLab 2005, V0.02                                     43                                                       04/25/05

Page 44: CANLab 2005 - Canoe.capages.infinit.net/jds/canlab/CANLab 2005 V0.02.pdf · CANLab 2005 Jacques De Sylva jdesylva@hotmail.com. Table of Contents Introduction.....4File Size: 670KBPage

Rx / Tx Maximum Data Rate: Extended frames, 8 data bytes.

This test submit a PPCAN module / driver to a maximum data rate test with extended frameformat. We have to evaluate how much time we need to  process in and out frames withextended frames (CAN Standard version 2.0B). 

Results : To Follow.

CANLab 2005, V0.02                                     44                                                       04/25/05