5 commands, 6 responses, 1 ack responses – ScanTool STN Bootloader User Manual

Page 5: 2 nack responses, 1 communication errors, Commands, Responses, Ack responses, Nack responses, Stn bootloader

Advertising
background image

STN

Bootloader

CRC is calculated on the data field prior to byte

stuffing. It is transmitted after the data field, and before
the <ETX> control character.

After a response is received, it must first be

unstuffed. Then the CRC is calculated over the entire
data packet (including the CRC bytes). If the reception
is successful, the CRC calculation result will equal
zero.

4.5 Commands

The data field of each packet transmitted to the

bootloader should contain one command and
(optionally) its associated data. Commands must be
transmitted to the bootloader in the following format:

<command><data length>[<data>] 

Table 3 details the command format. Commands

supported by the bootloader are detailed in section 5.0
Bootloader Commands”.

Table 3 – Command Format

Field

Length

(bytes)

Description

<command> 1 Bootloader

command

<data length>

2

Length of command
payload

[<data>] variable

Optional command
payload

Bytes comprising a command do not have to be

sent back-to-back. However, there cannot be more
than 200 milliseconds between any two bytes. If this
timeout occurs, the bootloader will abort receiving the
command, and will revert to looking for the start of the
next command packet.

4.6 Responses

The data field of each packet received from the

bootloader contains one response and its associated
data. The responses are transmitted by the bootloader
in the following format:

<ACK/NACK><command><data length>[<data>] 

Table 4 details the response format.

Table 4 – Response Format

Field Length

Description

<ACK/NACK> 2

bits

Success/error indication:
01

= ACK

10

= NACK

<command> 6

bits

Command which this
response is
acknowledging

<data length>

1 byte

Length of response
payload

[<data>] variable

Optional response
payload

4.6.1 ACK

Responses

Upon successful execution of each command, the

bootloader responds with an ACK response in the
following format:

<0x40|command><data length>[<data>] 

See section 5.0 “Bootloader Commands” for details

on responses to each bootloader command.

4.6.2 NACK

Responses

When the bootloader encounters an error while

processing a command, it will respond with a NACK
response. NACK responses have a fixed length of
three bytes (one data byte) and are in the following
format:

<0x80|command><0x01><error code> 

Table 5 lists possible error codes.

Table 5 – Error Codes

Error Type

Error

Code

(hex)

Description

01 CRC

error

Communication

02

Received packet too long

10 Unknown

command

Command

Validation

11

Invalid command format

30 Sequence

error

50 Authentication

error

80 Programming

error

Firmware

Upload

90 Verification

error

4.6.2.1 Communication Errors

NACK responses indicating communication errors

have their command field set to 0x00, because the
integrity of the packet has been compromised or could
not be verified, and the byte received in place of the
command field may not correspond to the command
actually sent by the host. These errors may occur for
any bootloader command. The following two errors
indicate communication problems:

STNBLA www.obdsol.com 5 of 12

Advertising