You are on page 1of 28

Technical documentation

PAM System
Download
User’s Manual
Ordering Number: 006.8032.C
Rev. 27 September 2000

This version replaces all


previous versions of this
document. ACC Motion SA
has made every effort to insure
this document is complete and
accurate at the time of printing.
In accordance with our policy
of continuing product
improvement, all data in this
document is subject to change
or correction without prior
notice. Doc. No. 006.8032.C
Rev. 27 September 2000
ACC Motion SA
Zone industrielle La Rippe  1997 - 2000
CH-1303 Penthaz by ACC Motion SA
Switzerland All rights reserved
Page 2 PAM System Download User’s Manual
Doc. No. 006.8032.C Rev. 28 September 2000
TOC
Table of Contents

1 INTRODUCTION ------------------------------------------------------------------------------------------- 5

1.1 System overview---------------------------------------------------------------------------------------------------5

1.2 System reqirements -----------------------------------------------------------------------------------------------5

1.3 PamSystemDownload --------------------------------------------------------------------------------------------6


1.3.1 FileType --------------------------------------------------------------------------------------------------------------6
1.3.2 Destination -----------------------------------------------------------------------------------------------------------6
1.3.3 Error code in the command line mode --------------------------------------------------------------------------7

2 PAM-P SYSTEM CHANNEL---------------------------------------------------------------------------- 9

2.1 Predefined CHANNEL_REFERENCE -----------------------------------------------------------------------9


2.1.1 CAL with DBT master---------------------------------------------------------------------------------------------9
2.1.2 CAL without DBT master-----------------------------------------------------------------------------------------9
2.1.3 DeviceNet ------------------------------------------------------------------------------------------------------------9

2.2 Channel frame -----------------------------------------------------------------------------------------------------9

2.3 PAM-P state diagram ------------------------------------------------------------------------------------------ 10


2.3.1 PAM-P bootware, firmware and application valid --------------------------------------------------------- 10
2.3.2 PAM-P firmware or application invalid ---------------------------------------------------------------------- 10
2.3.3 PamTools with RunHook = 2 (ACC internal use only) --------------------------------------------------- 10
2.3.4 PamTools with RunHook = 1 (ACC internal use only) --------------------------------------------------- 10
2.3.5 GOTO_BOOTING command ---------------------------------------------------------------------------------- 10

2.4 Download procedure ------------------------------------------------------------------------------------------- 11


2.4.1 Global download procedure------------------------------------------------------------------------------------- 11
2.4.2 Special files -------------------------------------------------------------------------------------------------------- 12
2.4.3 One File Download procedure (simple) ---------------------------------------------------------------------- 12
2.4.4 One File Download procedure (elaborate) ------------------------------------------------------------------- 13

2.5 Acknowledge Mode --------------------------------------------------------------------------------------------- 14

2.6 Commands from host ------------------------------------------------------------------------------------------ 15


2.6.1 Get Info (B + R +F) ---------------------------------------------------------------------------------------------- 15
2.6.2 Restart ring (B) ---------------------------------------------------------------------------------------------------- 16
2.6.3 Restart PAM (R + F) --------------------------------------------------------------------------------------------- 16
2.6.4 Fiber Test (B) ------------------------------------------------------------------------------------------------------ 16
2.6.5 file download begin (B)------------------------------------------------------------------------------------------ 17
2.6.6 File data download (B)------------------------------------------------------------------------------------------- 17
2.6.7 Check file data download (B) ---------------------------------------------------------------------------------- 17
2.6.8 File end download (B) ------------------------------------------------------------------------------------------- 17
2.6.9 Abort file download (B) ----------------------------------------------------------------------------------------- 17
2.6.10 Start (B)------------------------------------------------------------------------------------------------------------- 18

PAM System Download User’s Manual Page 3


Doc. No. 006.8032.C Rev. 28 September 2000
TOC Table of Contents

2.6.11 Goto booting (R + F) --------------------------------------------------------------------------------------------- 18


2.6.12 Set param (B + R + F)-------------------------------------------------------------------------------------------- 18
2.6.13 Get param (B + R + F) ------------------------------------------------------------------------------------------- 18

2.7 Answers from PAM -------------------------------------------------------------------------------------------- 19


2.7.1 Info (B + R + F) --------------------------------------------------------------------------------------------------- 19
2.7.2 Error (B + R + F)-------------------------------------------------------------------------------------------------- 19
2.7.3 File data download check Ack (B) ---------------------------------------------------------------------------- 19
2.7.4 File data download check Nak (B) ---------------------------------------------------------------------------- 20
2.7.5 File download end Ack (B) ------------------------------------------------------------------------------------- 20
2.7.6 File download end Nak (B) ------------------------------------------------------------------------------------- 20
2.7.7 File download beg Ack (B) (With param_ack_mode set to 1) ------------------------------------------- 20
2.7.8 File download beg Nak (B) (With param_ack_mode set to 1) ------------------------------------------- 20
2.7.9 File download dat Ack (B) (With param_ack_mode set to 1)-------------------------------------------- 20
2.7.10 File download dat Nak (B) (With param_ack_mode set to 1)-------------------------------------------- 20
2.7.11 Generic Ack (B + R + F) ---------------------------------------------------------------------------------------- 20
2.7.12 Generic Nak (B + R + F) ---------------------------------------------------------------------------------------- 21
2.7.13 Message (B + R + F) --------------------------------------------------------------------------------------------- 21
2.7.14 Param (B + R + F) ------------------------------------------------------------------------------------------------ 21

3 FILES GENERATION AND DOWNLOAD--------------------------------------------------------- 23

3.1 SAM Parameters Files (SPI) ---------------------------------------------------------------------------------- 23

3.2 Save after download -------------------------------------------------------------------------------------------- 23

4 INTEL CRC16 --------------------------------------------------------------------------------------------- 25

4.1 DLL Specification----------------------------------------------------------------------------------------------- 25

4.2 DLL use----------------------------------------------------------------------------------------------------------- 26

4.3 DLL implementation ------------------------------------------------------------------------------------------- 27

Page 4 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
1
Introduction

1 INTRODUCTION
This document presents the PAM-P system channel (not running on a PAM). It provides the ability to
completely update an ACC Socapel system (PAM-P + SAM). The minimal ProMotion version is 200. It must
be used with document 006.8029 PAM CAN Bus Interface User’s Manual.

1.1 SYSTEM OVERVIEW


The global system is:

Host Files to be
downloaded

Comm
PAM-P

SAM SAM SAM

The goal is to update all software components of PAM-P and SAM from the host. Each software component
(bootware, firmware, etc.) is downloaded from a file with extension .ADW (ACC Download). These files are
generated with the WIN95 PamSystemDownload (PAM-P system download file generator) ACC utility.

1.2 SYSTEM REQIREMENTS


To be able to completely update an ACC Socapel system (PAM-P + SAM), the following software parts must
be running:
Hardware Software
PAM-P Bootware
SAM Bootware
Comm card (CAN card or PC CommCard) Bootware, firmware and application

PAM System Download User’s Manual Page 5


Doc. No. 006.8032.C Rev. 28 September 2000
1 Introduction

1.3 PAMSYSTEMDOWNLOAD
This utility can be run from the command line or in interactive mode.

Command Line mode:


PamSystemDownload [option] FileType InFileName OutFileName [Destination]

Option: -v to be verbose (to debug batch in command line)


FileType: Type of the input file (see next table)
InFileName: Input file name
OutFileName: Output file name
Destination: Destination of the file on the ACC Socapel System (used only for SAM).

1.3.1 FILETYPE
File type File Type for command Extension
line
PAM-P bootware PAM_BOOT *.PBI
PAM-P firmware PAM_FIRM *.PFI
PAM-P application PAM_APPL *.PAI
SAM bootware SAM_BOOT *.SBI
SAM firmware SAM_FIRM *.SFI
SAM application SAM_APPL *.SAI
SAM parameters SAM_PARAM *.SPI
CAN bootware CAN_BOOT *.CBI
CAN firmware CAN_FIRM *.CFI
Channel bootware CHNL_BOOT *.HBI
Channel firmware CHNL_FIRM *.HFI

1.3.2 DESTINATION
The destination address of the SAM can be:
• Individual (Ex : SAM1)
• Range (Ex :SAM3-7)(without space before and after -)
• All (Ex :SAMAll)
• Set of individual and range (Ex :SAM1;3-7;11) (without space before and after ;)

Page 6 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
Introduction
1

1.3.3 ERROR CODE IN THE COMMAND LINE MODE


If the application is successful, the Errorlevel is 0 otherwise non zero. To get the correct error code, it is
necessary to use START /W to run the PamSystemDownload program.
Errorlevel Meaning
0 PsysDwn successful
1 Invalid option
2 Invalid file type
3 Too many parameters
4 Too few parameters
5 Invalid destination
10 Input file not found
11 Output file write error
12 Input file read error

Example:

:Test
Start /w pamsystemdownload sam_boot sbez1511.sbi sbez1511.adw
if errorlevel 12 goto Err12
if errorlevel 11 goto Err11
if errorlevel 10 goto Err10
if errorlevel 5 goto Err5
if errorlevel 4 goto Err4
if errorlevel 3 goto Err3
if errorlevel 2 goto Err2
if errorlevel 1 goto Err1
if errorlevel 0 goto Ok

:Err12
echo Input file read error
goto end

:Err11
echo Output file write error
goto end

:Err10
echo Input file not found
goto end

:Err5
echo Invalid destination
goto end

:Err4
echo Too few parameters
goto end

PAM System Download User’s Manual Page 7


Doc. No. 006.8032.C Rev. 28 September 2000
1 Introduction

:Err3
echo Too many parameters
goto end

:Err2
echo Invalid file type
goto end

:Err1
echo Invalid option
goto end

:Ok
echo Conversion successful
:end

Page 8 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
2
PAM-P System channel

2 PAM-P SYSTEM CHANNEL

2.1 PREDEFINED CHANNEL_REFERENCE


Now, when you declare a CAN_CHANNEL you have two predefined CHANNEL_REFERENCE. One for
the input and one for output to the PAM-P system channel.

2.1.1 CAL WITH DBT MASTER


If you use the DBT master, the names of the two variables are :
• « CAL NODE NAME »SysI for system input
• « CAL NODE NAME »SysO for system output

Example:
If in the CAN_CHANNEL declaration, NODE_NAME = PAM, then variable for system input is PAMSI.

2.1.2 CAL WITHOUT DBT MASTER


The COMM_ID for system input is 0.
The COMM_ID for system output is 1 .

2.1.3 DEVICENET
Like CAL without DBT master.

2.2 CHANNEL FRAME


The commands that are sent to system input variable are built with :

1byte (1 bit (7) +3 bit (0-2)) 1 byte 0-6 bytes


Toggle bit + Data size Command Code Data

The toggle bit is first set to 1 and change at each command.

Example :
first frame : 0x00 0x??
second frame : 0x80 0x??
third frame : 0x00 0x??
fourth frame : 0x80 0x??

The toggle bit should not be used to detect lost frames because inconsistencies could arise when going from
BOOTING to RUNNING or from RUNNING to BOOTING.

PAM System Download User’s Manual Page 9


Doc. No. 006.8032.C Rev. 28 September 2000
2 PAM-P System channel

2.3 PAM-P STATE DIAGRAM


In the followings state diagrams, the gray state is the final state.

2.3.1 PAM-P BOOTWARE, FIRMWARE AND APPLICATION VALID

FatalError

Booting Running

2.3.2 PAM-P FIRMWARE OR APPLICATION INVALID

FatalError

Booting with
Channel Running

2.3.3 PAMTOOLS WITH RUNHOOK = 2 (ACC INTERNAL USE ONLY)

FatalError
Booting with
Channel Running

2.3.4 PAMTOOLS WITH RUNHOOK = 1 (ACC INTERNAL USE ONLY)

FatalError
Booting without
Channel Running

2.3.5 GOTO_BOOTING COMMAND

FatalError
Booting with
Channel Running

Page 10 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
PAM-P System channel
2

2.4 DOWNLOAD PROCEDURE


2.4.1 GLOBAL DOWNLOAD PROCEDURE
First, the host must send the command GOTO_BOOTING to the PAM-P. Then, the PAM-P is in BOOTING
state. After this, only the input and output system channel references are available. The host downloads each
file (see 2.4.3 One File Download procedure (simple) and save them except special files (see 2.4.2 Special
files). The download finishes with command START. At this moment, if downloaded, the PAM-P save
special files.

WARNING: never switch off the system after the START command because it is possible to destroy the
special files.

Host : Host PAM


1: GOTO_BOOTING( )

PAM-P
Bootware 2: OneFileDownload( )

PAM-P
Firmware 3: OneFileDownload( )

PAM-P
Application 4: OneFileDownload( )

1-n SAM
Bootware 5: OneFileDownload( )

1-n SAM
Firmware 6: OneFileDownload( )

1-n SAM WARNING:


Application Never switch off the system
7: OneFileDownload( ) during the save of the
Comm files and PAM-P
1-n SAM Bootware
Parameters 8: OneFileDownload ( )

9: START( )
10: SaveSpecialFiles( )

11: PAMReset( )

PAM System Download User’s Manual Page 11


Doc. No. 006.8032.C Rev. 28 September 2000
2 PAM-P System channel

2.4.2 SPECIAL FILES


These files are saved only after the START command.

The special files are :


• Comm card bootware.
• Comm card firmware
• PAM-P bootware.

2.4.3 ONE FILE DOWNLOAD PROCEDURE (SIMPLE)


The first command of a file download is FDWNL_BEG. After this the data are sent with command
FDWNL_DAT. When all data are sent, the host must send command FDWNL_END. The PAM send an
acknowledge if all the data are valid and saved on the target except for special files that are saved after
START command (see 2.4.1 Global download procedure).

Host PAM

1: FDWNL_BEG ( )

2: FDWNL_DAT ( )
3: FDWNL_DAT ( )

4: FDWNL_DAT ( )

5: FDWNL_DAT ( )

6: FDWNL_DAT ( )

7: FDWNL_DAT ( )

Could need
some time to
download to
8: FDWNL_END ( ) the target

9: FDWNL_END_ACK( )

Page 12 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
PAM-P System channel
2

2.4.4 ONE FILE DOWNLOAD PROCEDURE (ELABORATE)


It is the same as 2.4.3 One File Download procedure (simple) except that we can do an intermediate check of
CRC. At the startup, the CRC is 0. In the following example, after three FDWNL_DAT command, we send
the command FDWNL_CHK and the CRC of the data of the three fist frame. If the PAM-P answers
FDWNL_CHK_ACK, the host must set the new CRC value to 0. If the PAM-P answer FDWNL_CHK_NAK,
the host must resends all the blocks after the last FDWNL_CHK_ACK.

Host PAM

In this example, a 1: FDWNL_BEG ( )


check is done after
3 frames

2: FDWNL_DAT ( )
3: FDWNL_DAT ( )
Send CRC of
4: FDWNL_DAT ( ) The FDWNL_CHK
the data of
frames 2-4 command is
5: FDWNL_CHK ( ) optional
6: FDWNL_CHK_ACK ( )

One transmit 7: FDWNL_DAT ( )


error 8: FDWNL_DAT ( )
9: FDWNL_DAT ( )
10: FDWNL_CHK ( )
11: FDWNL_CHK_NAK ( )

The host must 12: FDWNL_DAT ( )


resend frames
13: FDWNL_DAT ( )
7 -9
14: FDWNL_DAT ( )
15: FDWNL_CHK ( )
16: FDWNL_CHK_ACK ( )

17: FDWNL_END ( )

Could need
some time to
download to
18: FDWNL_END_ACK( ) the target

PAM System Download User’s Manual Page 13


Doc. No. 006.8032.C Rev. 28 September 2000
2 PAM-P System channel

2.5 ACKNOWLEDGE MODE


This feature is available only for bootware and firmware 6027 and higher. With this feature, users can force
the PAM-P to acknowledge all incoming commands. In this mode, such commands as GOTO_BOOTING,
START, FDWNL_BEG, FDWNL_DAT, FDWNL_ABO, … that did not send acknowledges in previous
version will answer with one of the new acknowledges.
In order to set this mode, the commands GET_PARAM, SET_PARAM and the answer PARAM have been
added.
Host PAM

SET_PARAM(PARAM_ACK_MODE, 1)
Set the AckMode
parameter to 1 ACK()

FDWNL_BEG()

FDWNL_BEG_ACK()
Now, all download
commands give an
acknowledge.
FDWNL_DAT()

FDWNL_DAT_ACK()

FDWNL_ABO()

FDWNL_END_ACK()

START()
The start command ACK()
gives also an
acknowledge.

Parameters are lost after GET_PARAM(PARAM_ACK_MODE)


transitions from
BOOTING to RUNNING PARAM(0)
or RUNNING to
BOOTING.

SET_PARAM(PARAM_ACK_MODE, 1)
ACK()

GOTO_BOOTING()

ACK()

WARNING: Note that after state transitions, BOOTING to RUNNING and RUNNING to BOOTING, the
AckMode must be set up again.

Page 14 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
PAM-P System channel
2

2.6 COMMANDS FROM HOST


For all commands, in the title, it is indicated in witch state the command is possible:
• B for booting.
• R for running.
• F for fatal error.

2.6.1 GET INFO (B + R +F)


This command asks information from the ACC system. The NodeId is the identifier of the node (0 for PAM-P
and the physical address for the SAMs).
The InfoId is the identifier of the information that is asked.
Toggle bit + Data size Command Code Data
0xt2 GET_INFO (0x01) NodeId (1 byte)
InfoId (1 byte)

PAM InfoId
InfoId Description
PAM_STATE (0x0) State (BOOTING (1), RUNNING (2), FATAL_ERROR (3),
BUSY(4))
PAM_BOOT_VER (0x1) PAM bootware version
PAM_FIRM_VER (0x2) PAM firmware version
PAM_APPL_VER (0x3) PAM application version
PAM_BOOT_CRC (0x4) PAM bootware CRC
PAM_FIRM_CRC (0x5) PAM firmware CRC
PAM_APPL_CRC (0x6) PAM application CRC
PAM_NB_NODE (0x7) Number of node on the EasyBus
PAM_NODE_INFOS_STATE (0x8) Status of the node infos: UNINITIALIZED(0), READING(1)
and AVAILABLE (2)
PAM_CHNL_BOOT_VER (0x11) Channel bootware version
PAM_CHNL_FIRM_VER (0x12) Channel firmware version
PAM_SERIAL_NB (0x21) PAM serial number
PAM_PART_NB (0x22) PAM part number
PAM_VERSION (0x23) PAM version

! WARNING : The system info PAM_NODE_INFOS_STATE is available only for bootware and
firmware version 6029 and above.
! WARNING : Check that PAM_NODE_INFOS_STATE is equal to 2 before reading any node
information. A value of 0 means that PAM has not yet started to get nodes information. A value of 1 means
that PAM is reading information from connected nodes. A value of 2 means that informations about
connected nodes have been read and that those informations are now available through the GET_INFO
command.
The value of PAM_NODE_INFOS_STATE can be modified after sending the following commands:
START, GOTO_BOOTING, RESTART_PAM, RESTART_RING, FDWNL_END.

PAM System Download User’s Manual Page 15


Doc. No. 006.8032.C Rev. 28 September 2000
2 PAM-P System channel

NODE InfoId
InfoId Description
NODE_PRESENT (0x0) True if NODE is present
NODE_BOOT_VER (0x1) NODE bootware version
NODE_FIRM_VER (0x2) NODE firmware version
NODE_APPL_VER (0x3) NODE application version
NODE_BOOT_CRC (0x4) NODE bootware CRC
NODE_FIRM_CRC (0x5) NODE firmware CRC
NODE_APPL_CRC (0x6) NODE application CRC
NODE_PARAM_VER (0x7) NODE parameters version (D_UserParamVersion parameter)
NODE_PARAM_CRC (0x8) NODE parameters CRC
NODE_SERIAL_NB (0x21) NODE serial number
NODE_PART_NB (0x22) NODE part number
NODE_VERSION (0x23) NODE version

2.6.2 RESTART RING (B)


This command restarts the optical ring. It must be used when there is a ring error and that the problem is
solved.
Toggle bit + Data size Command Code Data
0xt0 RESTART_RING (0x02) -

2.6.3 RESTART PAM (R + F)


This command restarts (reset) the PAM.
! WARNING : this command stops the application, so be sure that all axes are stopped.
Toggle bit + Data size Command Code Data
0xt0 RESTART_PAM (0x03) -

2.6.4 FIBER TEST (B)


This command test the Fiber on the EasyBus (optical ring). The test is made with 80% of the power of
emission .
Toggle bit + Data size Command Code Data
0xt0 FIBER_TEST_P80 (0x04) -

The PAM modify the power of emission (optical) on each node and test if the ring run.
If there is a problem on one node the following error appear :
To tools : Fiber Test : Problem with outgoing fiber : node# xx. (xx is node address.)
To channel: system channel error occurs 0C000014 with nodeId.
That means that the problem is between node xx and the next one.

To start the test PAM must be in Boot.

Page 16 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
PAM-P System channel
2

To start test from system channel :


From Running :
1.GoToBoot GOTO_BOOTING (0X0B)
2. Wait That PAM is not busy GET_INFO (0x01) PAM_STATE (0x0) not equal at BUSY(4)
3.Start Test FIBER_TEST_P80 (0x04)
If errors occurs, messages 0C000014 with node id (Address) are sent.
When test is made PAM send 0C002001.

From Boot :
3.Start Test FIBER_TEST_P80 (0x04)
If errors occurs, messages 0C000014 with node id (Address) are sent.
When test is made PAM send 0C002001.

To start test from tools : from menu Advanced then Fiber Test.
If errors occurs, messages : Fiber Test : Problem with outgoing fiber : node# xx
When test is made tool display message : 0C002001 Fiber Test Ended.

2.6.5 FILE DOWNLOAD BEGIN (B)


This command starts a file download.
Toggle bit + Data size Command Code Data
0xt0 FDWNL_BEG (0x05) -

2.6.6 FILE DATA DOWNLOAD (B)


This command sends data to the current file download.
Toggle bit + Data size Command Code Data
0xt6-0xt1 FDWNL_DAT (0x06) 1-6 bytes

2.6.7 CHECK FILE DATA DOWNLOAD (B)


This command sends the current CRC of the data blocks (see 2.4.4 One File Download procedure (elaborate)).
Toggle bit + Data size Command Code Data
0xt4 FDWNL_CHK (0x07) Current CRC (4 bytes)

2.6.8 FILE END DOWNLOAD (B)


This command is send when all the data of the download are send. Then the PAM-P check the complete file
and save it (except special files). If it is OK. The PAM-P will send a FDWNL_END_ACK answer, otherwise
FDWNL_END_NAK answer.
Toggle bit + Data size Command Code Data
0xt0 FDWNL_END (0x08) -

2.6.9 ABORT FILE DOWNLOAD (B)


This command aborts the current file download.
Toggle bit + Data size Command Code Data
0xt0 FDWNL_ABO (0x09) -

PAM System Download User’s Manual Page 17


Doc. No. 006.8032.C Rev. 28 September 2000
2 PAM-P System channel

2.6.10 START (B)


This command saves the special files (if necessary) (see 2.4.1 Global download procedure) and start the PAM
application.
Toggle bit + Data size Command Code Data
0xt0 START (0x0A) -

2.6.11 GOTO BOOTING (R + F)


This command put the PAM in the « Booting » state.
! WARNING: this command stops the application, so be sure that all axes are stopped.
Toggle bit + Data size Command Code Data
0xt0 GOTO_BOOTING (0x0B) -

2.6.12 SET PARAM (B + R + F)


This command allows the setting of channel parameters. (Only for pbez6027 and pfez6027 and higher)
The PAM will answer with the generic ACK or NAK.
Toggle bit + Data size Command Code Data
0xt5 SET_PARAM(0x0D) Parameter Id (1 byte)
New value (4 bytes)
Parameter Id
Parameter Id Description
PARAM_ACK_MODE (0x0) Data = 1: Enable the Acknowledge Mode.
Data = 0: Disable the Acknowledge Mode.
See the Acknowledge Mode section on page 14 for details.

2.6.13 GET PARAM (B + R + F)


This command can be used to read channel parameters. (Only for pbez6027 and pfez6027 and higher)
The PAM will answer with the PARAM answer.
Toggle bit + Data size Command Code Data
0xt1 GET_PARAM(0x0C) Parameter Id (1 byte)

See table under the Set Param section for available parameter Ids.

Page 18 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
PAM-P System channel
2

2.7 ANSWERS FROM PAM


2.7.1 INFO (B + R + F)
This is the PAM answer to GET_INFO command.
Toggle bit + Data size Command Code Data
0xt4 INFO (0x81) Current info (4 bytes)

2.7.2 ERROR (B + R + F)
The PAM sends this command when there is an error.
Toggle bit + Data size Command Code Data
0xt5 ERROR (0x82) Error code (4 bytes)
NodeId (1 byte)
The possible error codes are:
Error code in hex Meaning
0C000001 Peripheral not ready
0C000002 Wrong peripheral type
0C000003 Peripheral didn’t change its state
0C000004 Peripheral refuse download
0C000005 Peripheral buffer full
0C000006 Peripheral download error
0C000007 Peripheral download storage error
0C000008 Download ADW file failed
0C000009 CRC error on downloaded ADW file
0C00000A EasyBus: optical link interrupted
0C00000B EasyBus: CRC error
0C00000C EasyBus: Synchronism problem
0C00000D EasyBus: node not ready
0C00000E EasyBus: nodes on the same address
0C00000F ADW download already in use (by CAN)
0C000010 ADW download already in use (by Tools)
0C000011 This file is not an ADW file
0C000012 ADW file header is spoiled
0C000013 Unknown channel command
0C000014 Fiber Test : Problem with outgoing fiber from NodeId
0C000015 Fiber Test : Problem with outgoing fiber from Pam

2.7.3 FILE DATA DOWNLOAD CHECK ACK (B)


This is the FDWNL_CHK acknowledge.
Toggle bit + Data size Command Code Data
0xt0 FDWNL_CHK_ACK (0x83) -

PAM System Download User’s Manual Page 19


Doc. No. 006.8032.C Rev. 28 September 2000
2 PAM-P System channel

2.7.4 FILE DATA DOWNLOAD CHECK NAK (B)


This is the FDWNL_CHK non-acknowledge.
Toggle bit + Data size Command Code Data
0xt0 FDWNL_CHK_NAK (0x84) -

2.7.5 FILE DOWNLOAD END ACK (B)


This is the FDWNL_END acknowledge.
Toggle bit + Data size Command Code Data
0xt0 FDWNL_END_ACK (0x85) -

2.7.6 FILE DOWNLOAD END NAK (B)


This is the FDWNL_END non-acknowledge.
Toggle bit + Data size Command Code Data
0xt0 FDWNL_END_NAK (0x86) -

2.7.7 FILE DOWNLOAD BEG ACK (B) (WITH PARAM_ACK_MODE SET TO 1)


This is the FDWNL_BEG acknowledge. (Only for pbez6027 and higher)
Send only if the PARAM_ACK_MODE is set to 1.
Toggle bit + Data size Command Code Data
0xt0 FDWNL_BEG_ACK (0x98) -

2.7.8 FILE DOWNLOAD BEG NAK (B) (WITH PARAM_ACK_MODE SET TO 1)


This is the FDWNL_BEG non-acknowledge. (Only for pbez6027 and higher)
Send only if the PARAM_ACK_MODE is set to 1.
Toggle bit + Data size Command Code Data
0xt0 FDWNL_BEG_NAK (0x99) -

2.7.9 FILE DOWNLOAD DAT ACK (B) (WITH PARAM_ACK_MODE SET TO 1)


This is the FDWNL_DAT acknowledge. (Only for pbez6027 and higher)
Send only if the PARAM_ACK_MODE is set to 1.
Toggle bit + Data size Command Code Data
0xt0 FDWNL_DAT_ACK (0x9A) -

2.7.10 FILE DOWNLOAD DAT NAK (B) (WITH PARAM_ACK_MODE SET TO 1)


This is the FDWNL_DAT non-acknowledge. (Only for pbez6027 and higher)
Send only if the PARAM_ACK_MODE is set to 1.
Toggle bit + Data size Command Code Data
0xt0 FDWNL_DAT_NAK (0x9B) -

2.7.11 GENERIC ACK (B + R + F)


This is the generic acknowledge. (Only for pbez6027 and pfez6027 and higher)
Send in response to SET_PARAM and GET_PARAM.

Page 20 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
PAM-P System channel
2

Send in response to START, GOTO_BOOTING, RESTART_RING and RESTART_PAM commands if the


PARAM_ACK_MODE is set to 1.
Toggle bit + Data size Command Code Data
0xt0 ACK (0x96) -

2.7.12 GENERIC NAK (B + R + F)


This is the generic non-acknowledge. (Only for pbez6027 and pfez6027 and higher)
Send in response to SET_PARAM and GET_PARAM.
Send in response to START, GOTO_BOOTING, RESTART_RING and RESTART_PAM commands if the
PARAM_ACK_MODE is set to 1.
Toggle bit + Data size Command Code Data
0xt0 NAK (0x97) -

2.7.13 MESSAGE (B + R + F)
The PAM sends this command when there is an message.
Toggle bit + Data size Command Code Data
0xt5 MESSAGE (0x87) Message code (4 bytes)
The possible message codes are:
Message code in hex Meaning
0C002001 Fiber Test ready

2.7.14 PARAM (B + R + F)
This is the PAM answer to GET_PARAM command. (Only for pbez6027 and pfez6027 and higher)
Toggle bit + Data size Command Code Data
0xt4 PARAM(0x9C) Value (4 bytes)

PAM System Download User’s Manual Page 21


Doc. No. 006.8032.C Rev. 28 September 2000
2 PAM-P System channel

Page 22 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
3
Files generation and download

3 FILES GENERATION AND DOWNLOAD

3.1 SAM PARAMETERS FILES (SPI)


SAM parameters files to be downloaded must take care about the release of the SAM database. If the SPI file
database is not the same as the SAM database, the download is refused. So, to generate a correct SPI file you
must follow this procedure:
• Connect a SAM with the correct firmware to the PC
• Start the SAM Tools
• Put the SAM in the configuring state
• From the menu “Parameters”, choose “Generate SPI from file…”
• Choose the correct parameters file (*.SPA)

3.2 SAVE AFTER DOWNLOAD


SAM parameters, SAM application PAM-P application are saved automatically after a download.

PAM System Download User’s Manual Page 23


Doc. No. 006.8032.C Rev. 28 September 2000
3 Files generation and download

Page 24 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
4
Intel CRC16

4 INTEL CRC16
If you want to use the FDWNL_CHK, the host must be able to calculate a CRC.
ACC provides an example of CRC calculation in the WIN95 DLL file AccCustUtil.dll

4.1 DLL SPECIFICATION


The specification of this DLL is (AccCustUtil.h):

#ifndef ACCCUSTUTIL_H
#define ACCCUSTUTIL_H

#include <windows.h>

/*------------------------*/
/* AccCUComputeIntelCRC16 */
/*========================*/

UINT AccCUComputeIntelCRC16 (UINT uLength,


UINT uStartValue,
LPSTR szBuffer) ;

#endif /* ACCCUSTUTIL_H */

PAM System Download User’s Manual Page 25


Doc. No. 006.8032.C Rev. 28 September 2000
4 Intel CRC16

4.2 DLL USE


The following example calculates the CRC of a file:

bool CalculateCrc(LPCSTR pFileName, UINT & crc)


{
CFile l_File ;
int l_Count ;
UINT l_Crc = 0 ; // Start value always zero
char l_Buffer[1024] ;

if ( !l_File.Open (pFileName, CFile::modeRead | CFile::typeBinary) )


{
AfxMessageBox (IDS_FILE_ERROR) ;
return ( false );
}

l_Count = l_File.Read (l_Buffer, 1024) ;


while ( 0 != l_Count ) {
l_Crc = AccCUComputeIntelCRC16 (l_Count, l_Crc, l_Buffer) ;
l_Count = l_File.Read (l_Buffer, 1024) ;
}

crc = l_Crc ;

return ( true ) ;
}

Page 26 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000
Intel CRC16
4

4.3 DLL IMPLEMENTATION


Here is an example of the code how to calculate the Intel CRC16 :

#include "AccCustUtil.h"

static unsigned short CRCtab[256] = {


0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241,
0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440,
0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40,
0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841,
0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40,
0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41,
0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641,
0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040,
0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240,
0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441,
0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41,
0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840,
0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41,
0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40,
0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640,
0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041,
0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240,
0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441,
0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41,
0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840,
0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41,
0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40,
0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640,
0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041,
0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241,
0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440,
0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40,
0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841,
0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40,
0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41,
0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641,
0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040,
};

PAM System Download User’s Manual Page 27


Doc. No. 006.8032.C Rev. 28 September 2000
4 Intel CRC16

/*------------------------*/
/* AccCUComputeIntelCRC16 */
/*========================*/

UINT AccCUComputeIntelCRC16 (UINT uLength,


UINT uStartValue,
LPSTR szBuffer)

{
UINT l_uCount = 0 ;
UINT l_uCRC = uStartValue ;

while ( l_uCount < uLength ) {


l_uCRC = CRCtab [ (l_uCRC^szBuffer[l_uCount]) & 0xFF ] ^ (l_uCRC>>8)
;
l_uCount++ ;
}

return l_uCRC ;

} /* AccCUComputeIntelCRC16 */

Page 28 PAM System Download User’s Manual


Doc. No. 006.8032.C Rev. 28 September 2000

You might also like