Concept2
PRELIMINARY
Performance Monitor Generation III (PM3) and Performance Monitor Generation IV (PM4) Communications Interface Definition
Filename: Concept2 PM Communication Interface Definition 014.doc
Revision: 0.14
4/1/2008 2:42 PM
Concept2
Morrisville, VT 05661
802-888-5226 (Voice)
802-888-6331 (Fax)
rowing@concept2.com
Table of Contents
PM3 Manufacturer Information.. 20
Protocol Layer Definition.. 21
Network and Transport Layers. 24
CSAFE Default Configuration.. 25
CSAFE State Machine Operation.. 26
CSAFE Unsupported Features. 27
Command and Response Definitions.. 27
Configuring a Programmed Workout 27
Programmed Workout Parameter Limits. 28
PC-Host Dynamic Link Library (DLL) and Application Programming Interface (API) 28
PM3/PM4 Device Discovery & Interface. 29
802.xx Interface (RF network) 29
Asynchronous Interface (RS232/485) 29
PM3/PM4 Device Discovery & Interface API 31
Example Application Logic – CSAFE DLLs. 48
Example Application Logic – USB DLL (“direct interface”). 49
CSAFE Commands Implemented.. 50
CSAFE PM3-Specific Commands Implemented.. 54
Command Example #1 – Get Horizontal Command. 70
Command Example #2 – Get PM3Worktime and Get PM3Workdistance Command. 72
Command Example #3 – Set Programmed Workout Command. 75
PM4 Status LED State Definitions. 78
List of Figures
Figure 1 - Standard Frame Format.. 18
Figure 2 - Extended Frame Format.. 18
Figure 3 - Long Command Format.. 19
Figure 4 - Short Command Format.. 20
Figure 5 - Response Frame Contents Format.. 20
Figure 6 - Individual Command Response Format.. 20
Figure 7 - CSAFE State Machine Diagram.. 26
Figure 8 – Demo Application Screen Shot – CSAFE Get Horizontal Command.. 72
Figure 9 – Demo Application Screen Shot – Get PMWorkTime & Get PMWorkDistance. 74
Figure 10 – Demo Application Screen Shot – Set Programmed Workout.. 77
List of Tables
Table 1 - Document Modification History...................................................................................................... 7
Table 2 - Related Documents................................................................................................................................ 7
Table 3 - PM3/PM4 Configuration/Data to PC................................................................................................ 9
Table 4 - PC Configuration/Data to PM3....................................................................................................... 15
Table 5 - Extended Frame Addressing.............................................................................................................. 18
Table 6 - Unique Frame Flags............................................................................................................................... 19
Table 7 - Byte Stuffing Values........................................................................................................................... 19
Table 8 - Command Field Types........................................................................................................................... 20
Table 9 - Response Field Types............................................................................................................................. 20
Table 10 - CSAFE Concept2 PM3/PM4 Information...................................................................................... 20
Table 11 - PM-Specific CSAFE Command Wrappers...................................................................................... 21
Table 12 - PM Proprietary CSAFE Command Wrappers............................................................................ 21
Table 13 - USB Series B Receptacle Mechanical......................................................................................... 21
Table 14 - USB Series B Receptacle Connector Pin-out........................................................................... 22
Table 15 - PM3/PM4 USB Definitions.................................................................................................................. 24
Table 16 - PM3 CSAFE Protocol Defaults...................................................................................................... 25
Table 17 - PM3 Unsupported CSAFE Protocol Features.......................................................................... 27
Table 18 - Workout Configuration Parameter Limits............................................................................. 28
Table 19 - PM3/PM4 Error Code Descriptions................................................................................................ 57
Table 20 - Status LED State Definitions........................................................................................................ 78
Purpose and Scope
This document contains the communications interface definition for the Concept2 PM3 and PM4. The PM3/PM4 is the performance monitor for the indoor rower providing the ability to communicate with a host PC utilizing Universal Serial Bus (USB) media.
Feedback on this document and the SDK itself should be provided via the protected forum (http://concept2.ipbhost.com) for software developers. Your protected forum password should have already been provided to you. If not, please contact Scott Hamilton (rowing@concept2.com) at Concept2.
Document History
Table 1 - Document Modification History
Edit Date | Engineer | Description of Modification |
5/25/04 | Mark Lyons | Created from Engineering Notes, rev 0.01 |
6/09/04 | Mark Lyons | Updated, rev 0.02 |
6/10/04 | Mark Lyons | Released for review |
6/11/0 | Mark Lyons | Minor updates, rev 0.03 |
6/14/04 | Mark Lyons | Updated, rev 0.04 |
6/29/04 | Mark Lyons | Minor updates, rev 0.05 |
9/9/04 | Mark Lyons | Minor updates and added PM3 error codes, rev 0.06 |
3/7/05 | Andrew Dombek | Minor updates and fixed documentation inconsistencies, rev 0.07 |
3/10/05 | Mark Lyons | Minor updates and changes to several PM3-specific commands, rev 0.08 |
3/10/05 | Andrew Dombek | Minor updates to example code. Added Demo App screen shots, rev 0.09 |
4/12/05 | Mark Lyons | Minor update to CSAFE state machine diagram |
5/9/05 | Mark Lyons | Minor updates to commands; added table defining workout programming parameter limits |
6/6/05 | Mark Lyons | Minor updates to commands including FORCEPLOTDATA; minor updates to CSAFE state machine diagram for clarity, rev 0.10 |
7/13/05 | Mark Lyons | Minor updates to add some additional PM3-specific commands to allow CSAFE master to determine the parameters for a user programmed workout |
9/12/05 | Mark Lyons | Minor updates to clarify workout programming, etc., rev 0.11 |
11/02/05 | Mark Lyons | Fix error in data definition for ForcePlotData command |
7/25/06 | Stephen Pilcher | Added HeartBeatData command |
7/31/06 | Mark Lyons | Updated for use w/ PM4 |
4/11/07 | Mark Lyons | Updated for PM4 LED operation, rev 0.13 |
3/26/08 | Andrew Dombek | Updated to incorporate new cross-platform DLLs, rev 0.14 |
Related Documents
Table 2 - Related Documents
Document Title | Document Number - Date |
CSAFE Protocol Technical Specification, V1.x | http://www.fitlinxx.com/csafe/ |
Concept2 PM3 Firmware Revision History | (TBD) |
Concept2 PM3PM4 Software Development Kit Revision History | (TBD) |
Concept2 PM4 Firmware Revision History | (TBD) |
Note to Developers
This document provides sufficient information to allow a software developer to create custom PC applications for the PM3/PM4, using the provided Data Link Libraries (DLLs). This document assumes the developer has experience writing applications that interface to DLLs.
Another option available to developers is a software tool called Performance Monitor Interface or PMI, written by Chris Brett. The PMI is aimed at simplying the task of developing applications that are capable of processing data from the PM3/PM4. The free software and documentation is available for download here:
http://www.concept2.co.uk/software/pmi.php
Overview
The PM3/PM4 communication protocol is intended for use over the Universal Serial Bus (USB). The PM3/PM4 protocol is based on the CSAFE protocol that is targeted at supporting communications between physical fitness equipment and a host PC. Extensions to the CSAFE protocol are employed to provide the PM-specific functionality not supported by the generic protocol while maintaining compatibility.
The communication protocol possesses the following basic features:
· Self-starting frame structure with data transparency over numerous physical interfaces
· Simple state machine model for master/slave interactions
· “Speak-when-spoken-to” configuration with the option for well-defined unsolicited response communication
· Point-to-point and point-to-multi-point network configurations
· Error detection
· Standardized data formats for time, distance, etc.
· Extensibility by virtue of equipment vendor identification and vendor custom command definitions
The following sections provide the communication protocol definition including the physical, data link, network, and transport layer aspects for each interface.
Data Flow
The following sections summarize the data used by a host PC for controlling, configuring, and monitoring a single PM3/PM4. The data flow is separated into data originating from the PM3/PM4 or from the host PC. The various data along with the size and update rate requirement serve to establish the commands/responses that exist within the communication protocol. Certain data may be included in more than one command/response if dictated by the data flow requirements.
Table 3 - PM3/PM4 Configuration/Data to PC
Parameter | Description | Update Rate (max) | Units(Resolution) | Precision | Bytes | CSAFE Command |
Slave Status | Slave status | Per Request | N/A | N/A | 0 | CSAFE_GETSTATUS_CMD |
Workout Duration | Work time duration of workout | 10 Hz | N/A | HMS4 | 3 | CSAFE_GETTWORK_CMD |
Horizontal Distance | Work distance of workout | 10 Hz1 | Meters(1 m) | Integer | 2 | CSAFE_GETHORIZONTAL_CMD |
Pace | Time elapsed per unit distance for a given stroke | 2 Hz2(per stroke) | Sec/Km | Integer | 2 | CSAFE_GETPACE_CMD |
Power | Power generated based on the pace per stroke | 2 Hz(per stroke) | Watts(1 w) | Integer | 2 | CSAFE_GETPOWER_CMD |
Accumulated Calories | Accumulated calories burned | 2 Hz(per stroke) | Calories(1 cal) | Integer | 2 | CSAFE_GETCALORIES_CMD |
Cadence | Strokes per minute for per stroke | 2 Hz(per stroke) | Strokes/Min(1 stroke) | Integer | 1 | CSAFE_GETCADENCE_CMD |
Current Heart Rate | Current heart beats per minute | 1 Hz | Beats/Min(1 beat) | Integer | 1 | CSAFE_GETHRCUR_CMD |
Product Version | Manufacturer ID, CID, Model, HW Version, Application FW Version | Per Request | Numeric | Integer | | CSAFE_GETVERSION_CMD |
HW Serial Number | Hardware serial number | Per Request | ASCII | Integer | 9 | CSAFE_GETSERIAL_CMD |
User ID Number | User identifier number | Per Request | Numeric | Integer | 3 – 53 | CSAFE_GETID_CMD |
Capabilities | Device capabilitiesProtocol:
| Per Request | Numeric | Integer | 3 – 115 | CSAFE_GETCAPS_CMD |
Error Code | Last error code (see User Programmer’s Guide) latched and cleared after reading | Per Request | Enumeration | Integer | 3 | CSAFE_GETERRORCODE_CMD |
PM3 Specific Commands | ||||||
Work Time | Work time duration of workout (high resolution) provided as an integer duration in seconds as displayed on the PM3/PM4 display (0.01 sec resolution) and the remaining fractional duration in seconds (0.01 sec resolution) Note: this is the time seen on the display, not necessarily the elapsed time | 10 Hz | Seconds(0.01 sec) | Integer | 5 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_WORKTIME |
Work Distance | Work distance of workout (high resolution) provided as an integer duration in meters as displayed on the PM3/PM4 display (0.1 m resolution) and the remaining fraction duration in meters (0.1 m resolution) Note: this is the distance seen on the display, not necessarily the accumulated distance | 10 Hz | Meters(0.1 m) | Integer | 5 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_WORKDISTANCE |
Drag Factor | Drag factor | 2 Hz(per stroke) | N-M-Sec2 | Integer | 1 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_DRAGFACTOR |
Stroke State | State of stroke logic:
| 100 Hz | Enumeration | Integer | 1 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_STROKESTATE |
Workout Type | Workout Type:
| Per Workout | Enumeration | Integer | 1 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_WORKOUTTYPE |
Error Value | Specific error code (see User Programmer’s Guide) | N/A | Enumeration | Integer | 2 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_ERRORVALUE |
Force Plot Data | Data samples proportional to force taken every 15.625 msec (64 Hz) from catch to end of drive (samples used to create Force Curve on PM3/PM4 display) | Per Request | N/A | Integer | 33 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_FORCEPLOTDATA |
Heart Beat Data | Data samples recording heart beat period for every heart beat. Up to 16 heartbeat periods are available | Per Request | 1 ms | Integer | 33 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_HEARTBEATDATA |
Workout State | State of workout logic:
| 2 Hz(per stroke) | Enumeration | Integer | 1 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_WORKOUTSTATE |
Rest Time | Rest time for the upcoming or current rest interval. Note: this is the time seen on the display, not necessarily the elapsed rest time | 10 Hz | Seconds(1 sec) | Integer | 2 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_RESTTIME |
Interval Type | Interval Type:
| Per Interval | Enumeration | Integer | 1 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_INTERVALTYPE |
Workout Interval Count | Workout interval count | Per Interval | Numeric | Integer | 1 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_GET_WORKOUTINTERVALCOUNT |
Notes:
1. At 2000 rpm of flywheel (2000 rpm/60 seconds/m x 3 tics/revolution x 1/12.93 tics/meter = 7.7 meters/second)
2. At 100 strokes/min
3. Dependent on configuration
4. Hours/Minutes/Seconds in byte format
5. Dependent on capability code
Table 4 - PC Configuration/Data to PM3
Parameter/Function | Description | Update Rate (max) | Units(Resolution) | Precision | Bytes | CSAFE Command |
CSAFE Machine State | Sets PM3/PM4 to one of the CSAFE machine states:
| Per Command | N/A | N/A | 0 | CSAFE_GOREADY_CMD,CSAFE_GOIDLE_CMD,CSAFE_GOHAVEID_CMD,CSAFE_GOINUSE_CMD,CSAFE_GOFINISHED_CMD |
CSAFE Machine Reset | Reset CSAFE state machine and related parameters | Per Command | N/A | N/A | 0 | CSAFE_RESET_CMD |
User ID Digits | Number of user ID digits to accept ( 2 – 5) | Per Command | N/A | Integer | 1 | CSAFE_IDDIGITS_CMD |
Bad User ID | Invalid User ID | Per Command | N/A | N/A | 0 | CSAFE_BADID_CMD |
Time of Day | Time of day | Per Command | N/A | HMS1 | 3 | CSAFE_SETTIME_CMD |
Date | Date | Per Command | N/A | YMD2 | 3 | CSAFE_SETDATE_CMD |
State Timeout | Timeout period for exiting certain states | Per Command | Seconds(1 sec) | Integer | 1 | CSAFE_SETTIMEOUT_CMD |
Workout Time | Workout time goal | Per Workout | N/A | HMS | 2 | CSAFE_SETTWORK_CMD |
Horizontal Distance | Horizontal distance goal | Per Workout | Units Specifier | Integer | 2 | CSAFE_SETHORIZONTAL_CMD |
Power Target | Power goal | Per Workout | Watts(1 w) | Integer | 2 | CSAFE_SETPOWER_CMD |
Program | Programmed/ pre-stored workouts3:
| Per Workout | Enumeration | Integer | 2 | CSAFE_SETPROGRAM_CMD |
User Information | User information including:
| Per Command | Weight(0.25 lb/0.125 kg)Age(1 year)Gender(Enum) | Integer | 5 | CSAFE_SETUSERINFO_CMD |
PM3 Specific Commands | ||||||
Split Duration Time | Time duration of a split | Per Workout | Seconds(.01 sec) | Integer | 4 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_SET_SPLITDURATION |
Split Duration Distance | Distance duration of a split | Per Workout | Meters(1 m) | Integer | 4 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_SET_SPLITDURATION |
Screen Error Display Mode4 | Set the screen error display mode:
| Per Command | Enumeration | Integer | 1 | CSAFE_SETUSERCFG1_CMD+CSAFE_PM_SET_SCREENERRORMODE |
Notes:
1. Hours/Minutes/Seconds in byte format
2. Year/Month/Day in byte format
3. “Programmed” workout takes either workout time or horizontal distance goals to set-up a “fixed time” or “fixed distance” workout; “Favorites #1 – 5” are only available if a logcard is present. “Standard List” workouts defined in Standard List Workouts.
4. Default screen error display mode is enabled and will return to enabled upon each power-up. In the disabled mode, no error information will be displayed on the PM3/PM4 screen, but will be available through the command interface. All errors will be latched and cleared only by reading the error value via the command interface when the screen error display mode is disabled.
Protocol Framework
In the CSAFE protocol, communication between the master and the slave(s) device is accomplished using two basic frame types: standard frame and extended frame. The standard frame provides no provisions for slave-to-slave communication or multi-drop network configurations, as device addressing is implicit. The PM3/PM4 application requires explicit device addressing for numerous scenarios (as provided by the extended frame format) so that both frame types will be handled for our implementation. In general, the slave device only speaks when responding to a master’s request. Certain exceptions may be made in very specific circumstances.
The extended frame is defined as stream of bytes with the structure shown in Figure 2. Note that the standard and extended frames are identical with the exception of the frame-unique start flag and the device address information. The start flags and stop flag are unique values used to delineate the frame and, therefore, cannot appear in the frame contents or the checksum. A byte-stuffing technique is employed to ensure that these unique bytes do not occur elsewhere in the frame. A checksum is included in the frame to allow both the master and slave devices to verify the integrity of the “Frame Contents”. Neither an acknowledgement (ACK) nor negative acknowledgement (NAK) at the frame level is an integral part of the protocol.
Figure 1 - Standard Frame Format
Standard Start Flag | Frame Contents | Checksum | Stop Flag |
Figure 2 - Extended Frame Format
Extended Start Flag | Destination Address | Source Address | Frame Contents | Checksum | Stop Flag |
Frame Structure
The frame structure is a stream of bytes with a unique start byte, optional addressing, frame contents (e.g., commands and responses), a checksum and a unique stop byte. The unique start and stop byte values are shown in Table 6. In order to ensure that these start and stop values do not appear anywhere in the frame, the master and slave devices perform “byte-stuffing” and “byte-unstuffing” on the byte stream (i.e., frame contents including extended frame addresses and checksum). This technique can be performed “on the fly” without impacting the data stream buffering requirements since the extra bytes only exist on the data link.
The extended frame addressing rules are summarized in Table 5.
Table 5 - Extended Frame Addressing
Address | Description |
0x00 | PC Host (master) |
0x01 – 0xFC | <unassigned> |
0xFD | Default slave address |
0xFE | Reserved for expansion |
0xFF | “Broadcast” accepted by all slaves |
The “byte-stuffing” algorithm simply substitutes two bytes for each of the unique bytes listed in Table 6. The unique Byte Stuffing Flag is followed by a 0x00, 0x01, 0x02, or 0x03 as shown in Table 7 depending on the byte being replaced. The impact of this technique on the data link is that the frame size could increase in size by a factor of two in the worst case.
Table 6 - Unique Frame Flags
Description | Value |
Extended Frame Start Flag | 0xF0 |
Standard Frame Start Flag | 0xF1 |
Stop Frame Flag | 0xF2 |
Byte Stuffing Flag | 0xF3 |
Table 7 - Byte Stuffing Values
Frame Byte Value | Byte-Stuffed Value |
0xF0 | 0xF3, 0x00 |
0xF1 | 0xF3, 0x01 |
0xF2 | 0xF3, 0x02 |
0xF3 | 0xF3, 0x03 |
The frame beginning and end are designated by the unique Start and Stop bytes. If a Start or Stop byte is missed, the frame is discarded and frame resynchronization occurs at the beginning of the next frame. Once a full frame is received and all “byte-unstuffing” is performed, a one-byte checksum is computed with byte-by-byte XORing of the frame contents to verify frame integrity. The frame definition does not explicitly place any limits on the frame length. Because the entire frame contents must be buffered before computing the checksum, memory resources on the slave devices typically establish the restrictions on frame length. For CSAFE protocol compatibility, the following frame length restrictions are invoked for the PM3/PM4 USB physical link:
1. A maximum frame size of 96 bytes including start/stop flags, checksum and byte stuffing
2. All flow control handled natively as part of USB
Frame Contents
The frame protocol transports frame content data consisting of both commands and responses. The only restrictions on the frame contents relate to length of frame and the requirement that individual commands/ responses do not straddle a frame boundary (i.e., no partial commands/responses within a frame). The following sections detail the command and response formats.
Command Format
All commands have one of two basic formats: long command or short command. Long commands are those including command data while short commands are command only. The command is represented by a single byte with the command address space partitioned equally (i.e., long commands have MS bit clear and short commands have MS bit set). Figure 3 and Figure 4 illustrate the long and short command formats, respectively.
Figure 3 - Long Command Format
Long Command | Data Byte Count | Data |
Figure 4 - Short Command Format
Short Command |
In the long command format, the Long Command and Data Byte Count fields are single bytes. The Data Byte Count field determines the Data field size. The short command format consists solely of the single byte Short Command. Table 8 summarizes the command field types for both the long and short commands. Note that the command formats allows a long command with a Data Byte Count of 0 and no bytes in the Data field. The virtue of the Data Byte Count field in the long command is to allow slave devices to handle unrecognized commands by merely disregarding the command and its data while continuing to process succeeding commands within the same frame.
Table 8 - Command Field Types
Description | Size (Bytes) | Value |
Long Command | 1 | 0x00 – 0x7F |
Short Command | 1 | 0x80 – 0xFF |
Data Byte Count | 1 | 0 - 255 |
Data | Variable | 0 - 255 |
Multiple complete commands can be included in a single frame, but no partial commands or responses are allowed. Sending a frame consisting of multiple commands to a slave device results in a frame consisting of multiple command responses being generated by a slave.
Response Format
All responses have the same Frame Contents format as shown in Figure 5.
Figure 5 - Response Frame Contents Format
Status | Command Response Data |
Figure 6 - Individual Command Response Format
Identifier | Data Byte Count | Data |
Table 9 - Response Field Types
Description | Size (Bytes) | Value |
Status | 1 | 0x00 – 0x7F |
Command Response Data | Variable | 0 - 255 |
Identifier | 1 | 0x00 – 0xFF |
Data Byte Count | 1 | 1 - 255 |
Data | Variable | 0 - 255 |
PM3 Manufacturer Information
Table 10 summarizes the Concept2 PM3/PM4 product-specific information.
Table 10 - CSAFE Concept2 PM3/PM4 Information
Product Information | Description |
Manufacturer ID | 22 |
Class Identifier | 2 |
Model | 3 |
Maximum Frame Length | 96 Bytes |
Minimum Inter-frame Gap | 50 msec. |
PM3 Extensions
The PM3/PM4 extensions to the frame protocol involve utilizing one pre-defined custom command that serves as a “wrapper” for additional PM-specific commands. The one command is defined in Table 11. The one custom command wrapper is used to expand the CSAFE command set for additional configuration and data operations. See Appendix A for a detailed explanation of the command wrapper implementation.
Table 11 - PM-Specific CSAFE Command Wrappers
Command Name | Command Identifier |
CSAFE_SETUSERCFG1_CMD | 0x1A |
Additional PM3/PM4 proprietary extensions to the frame protocol involve utilizing four commands added to the existing CSAFE protocol command set that serve as “wrappers” for the PM3/PM4 command set. The four commands are defined in Table 12. The four command wrappers are used to partition the PM3/PM4 command set space into “push” (i.e., set) and “pull” (i.e., get) operations for configuration and data. The use of these command wrappers allow the PM3/PM4 to support existing CSAFE protocol commands while introducing PM3/PM4 proprietary commands only accessible via the command set extension. These commands are not accessible via the “public” interface and require special “authentication” with the PM3/PM4 to function.
Table 12 - PM Proprietary CSAFE Command Wrappers
Command Name | Command Identifier |
CSAFE_SETPMCFG_CMD | 0x76 |
CSAFE_SETPMDATA_CMD | 0x77 |
CSAFE_GETPMCFG_CMD | 0x7E |
CSAFE_GETPMDATA_CMD | 0x7F |
Protocol Layer Definition
Universal Serial Bus
Physical Layer
USB Version 1.10 operating at full speed (12 Mb/s).
Table 13 - USB Series B Receptacle Mechanical
Table 14 - USB Series B Receptacle Connector Pin-out
Pin # | Signal Name |
1 | VBUS (+5V) |
2 | DATA- |
3 | DATA+ |
4 | GND |
Data Link Layer
In general, USB transactions consist of
3. Token Packet (Header defining what it expects to follow), an
4. Optional Data Packet, (Containing the payload) and a
5. Status Packet (Used to acknowledge transactions and to provide a means of error correction)
USB is a host centric bus. The host initiates all transactions. The first packet, also called a token is generated by the host to describe what is to follow and whether the data transaction will be a read or write and what the device’s address and designated endpoint is. The next packet is generally a data packet carrying the payload and is followed by a handshaking packet, reporting if the data or token was received successfully, or if the endpoint is stalled or not available to accept data.
Data on the bus is transmitted LS bit first. USB packets consist of the following fields,
Sync
All packets must start with a sync field. The sync field is 8 bits long at low and full speed or 32 bits long for high speed and is used to synchronize the clock of the receiver with that of the transmitter. The last two bits indicate where the PID fields starts.
PID
PID stands for Packet ID. This field is used to identify the type of packet that is being sent. The following table shows the possible values.
Group | PID Value | Packet Identifier |
Token | 0001 | OUT Token |
1001 | IN Token | |
0101 | SOF Token | |
1101 | SETUP Token | |
Data | 0011 | DATA0 |
1011 | DATA1 | |
0111 | DATA2 | |
1111 | MDATA | |
Handshake | 0010 | ACK Handshake |
1010 | NAK Handshake | |
1110 | STALL Handshake | |
0110 | NYET (No Response Yet) | |
Special | 1100 | PREamble |
1100 | ERR | |
1000 | Split | |
0100 | Ping | |
| | |
There are 4 bits to the PID, however to insure it is received correctly, the 4 bits are complemented and repeated, making an 8-bit PID in total. The resulting format is shown below.
PID0 | PID1 | PID2 | PID3 | nPID0 | nPID1 | nPID2 | nPID3 |
§ ADDR
The address field specifies which device the packet is designated for. Being 7 bits in length allows for 127 devices to be supported. Address 0 is not valid, as any device which is not yet assigned an address must respond to packets sent to address zero.
§ ENDP
The endpoint field is made up of 4 bits, allowing 16 possible endpoints. Low speed devices, however can only have 2 additional endpoints on top of the default pipe. (4 endpoints max)
§ CRC
Cyclic Redundancy Checks are performed on the data within the packet payload. All token packets have a 5 bit CRC while data packets have a 16 bit CRC.
§ EOP
End of packet. Signaled by a Single Ended Zero (SE0) for approximately 2 bit times followed by a J for 1 bit time.
USB has four different packet types. Token packets indicate the type of transaction to follow, data packets contain the payload, and handshake packets are used for acknowledging data or reporting errors and start of frame packets indicate the start of a new frame.
§ Token Packets
There are three types of token packets,
§ In - Informs the USB device that the host wishes to read information.
§ Out - Informs the USB device that the host wishes to send information.
§ Setup - Used to begin control transfers.
Token Packets must conform to the following format,
Sync | PID | ADDR | ENDP | CRC5 | EOP |
§ Data Packets
There are two types of data packets each capable of transmitting up to 1024 bytes of data.
§ Data0
§ Data1
High Speed mode defines another two data PIDs, DATA2 and MDATA.
Data packets have the following format,
Sync | PID | Data | CRC16 | EOP |
§ Maximum data payload size for low-speed devices is 8 bytes.
§ Maximum data payload size for full-speed devices is 1023 bytes.
§ Maximum data payload size for high-speed devices is 1024 bytes.
§ Data must be sent in multiples of bytes.
§ Handshake Packets
There are three types of handshake packets which consist simply of the PID
§ ACK - Acknowledgment that the packet has been successfully received.
§ NAK - Reports that the device temporary cannot send or received data. Also used during interrupt transactions to inform the host there is no data to send.
§ STALL - The device finds its in a state that it requires intervention from the host.
§
Handshake Packets have the following format,
Sync | PID | EOP |
§ Start of Frame Packets
The SOF packet consisting of an 11-bit frame number is sent by the host every 1ms ± 500ns on a
Full-speed bus.
Sync | PID | Frame Number | CRC5 | EOP |
Specifically, the PM3 enumerates itself as a Human Interface Device (HID) with a control endpoint and two interrupt endpoints (IN/OUT).
Table 15 - PM3/PM4 USB Definitions
Parameter | Description |
Bus Specification | USB 1.10 |
Bus Speed | Full-speed (12 Mbits/sec) |
Control Endpoint Max Pkt Size | 8 bytes |
Device Description | Bus powered (98 mA max), 1 interface configuration (0) |
Interface Description | Human Interface Device (HID) |
Manufacturer string | “Concept2” |
Product string | “Concept2 Performance Monitor 3 (PM3)” or“Concept2 Performance Monitor 4 (PM4)” |
Endpoints | IN: Interrupt/EP3/polling rate: 8 msec.OUT: Interrupt/EP4/polling rate: 4 msec. |
Reports | ID #1 – 20 bytes + 1 byte report IDID #2 – 120 bytes + 1 byte report IDID #4 – 62 bytes + 1 byte report ID |
Network and Transport Layers
The CSAFE protocol provides both the network and transport layer functionality over USB. The packetization, integrity checking, and node addressing is supported by the protocol. The maximum frame size has been increased to 96 bytes from the 32 bytes specified for the asynchronous serial interface.
Protocol Features
CSAFE Default Configuration
Individual manufacturers specify certain protocol parameters (e.g., timeouts, auto response behavior, etc.). Table 16 summarizes the protocol defaults for the PM3/PM4. Note that certain parameters listed in Table 16 cannot be changed (refer to the section on CSAFE Unsupported Features for additional information).
Table 16 - PM3 CSAFE Protocol Defaults
Parameter | Default Value | Comments |
HaveID State Transition Timeout | 10 seconds | This timeout (settable via the cmdSetTimeout command) defines the delay between entering the HaveID state and transitioning back to the Idle state |
Inactivity During InUse State Timeout | 6 seconds | This timeout defines the duration of inactivity during the InUse state (once the workout has begun) before entering the Paused state |
Inactivity During Pause State Timeout | 220 seconds | This timeout defines the duration of inactivity during the Paused state (once the workout has begun) before entering the Finished state |
Unconfigured Workout During Manual State Timeout | 220 seconds | This timeout is the same as the PAUSE state timeout and occurs if a user enters MANUAL mode and doesn’t configure a workout |
Inactivity During Finished State Timeout | 220 seconds | This timeout is the same as the PAUSE state timeout and occurs if the workout has begun and been abandoned or the workout has never begun |
Units Type | Metric | Metric units only |
User ID Digits | 5 | Five-digit user ID (settable via the cmdIDDigits from 2 – 5 digits) |
User ID | 0 0 0 0 0 | Default value |
AutoUpload Byte | 0x10 | flgAutoStatus: Disabled (cannot be changed)flgUpStatus: Disabled (cannot be changed)flgUpList: Disabled (cannot be changed)flgAck : Enabled (cannot be changed)flgExternControl: Disabled (cannot be changed) |
Serial Number Digits | 9 | Number of digits in serial number response |
PM3-specific Commands | All states | These commands are accessible in all slave states |
CSAFE State Machine Operation
The state machine implementation is shown in
Figure 7 including variations to the behavior specific to the PM3/PM4.
Figure 7 - CSAFE State Machine Diagram
CSAFE Unsupported Features
Individual manufacturers also determine which protocol features will not be supported by their equipment. Table 17 summarizes the unsupported protocol features and the deviations from other features. In addition, the status of implementation for each CSAFE command is included in Appendix A.
Table 17 - PM3 Unsupported CSAFE Protocol Features
Feature | Comments |
AutoStatus Enable | No unsolicited status uploads |
UpList Enable | No unsolicited command list uploads |
Ack Disable | All commands will be responded to by a least a status byte |
Text Messaging | No text messaging functions |
Set User Information | Not setting user weight, age and gender |
Get User Information | User weight is fixed at 175 lbs, age and gender not supported |
Finished State Timeout | No Finished state timeout is employed to cause a transition back to the Idle state; when a user hits the MENU/BACK to conclude viewing a finished workout result or terminate a workout in progress, the Ready state is entered instead of the Idle state. Instead a Finished state timeout is employed to return to the Ready state. |
Paused State Timeout | A timeout is employed to enter the Finished state in the event a configured workout is never started or re-started. |
Manual State Timeout | A timeout is employed to return to the Idle state in the event a manual user ID override is performed and a workout is never configured |
InUse State Entry | In addition to allowing entry into the InUse state from the Idle and HaveID states, entry from the Ready state is also allowed |
Set Calories Goal | Since the PM3/PM4 allows the user to select display units (either time/meters, watts or calories), setting the workout goal using power is sufficient to define a target pace for the pace boat display for all display units. |
Command and Response Definitions
Workouts
Configuring a Programmed Workout
The following steps are required to configure the workout parameters and put the PM3/PM4 screen in the proper state prior to rowing commencement:
1. Set all pertinent workout parameters including either workout time (fixed time workout) or horizontal distance goal (fixed distance workout), and time/distance split duration (if not using default values). Time split duration used for “fixed time” workout and distance split duration used for “fixed distance” workout.
2. If a power/calories goal is desired to control the paceboat, the proper goal value must be configured.
3. Configure the programmed workout using the previously set workout parameters, and direct the PM3/PM4 to initialize the workout display parameters and go to the proper rowing screen in preparation for beginning the workout.
The following is a sample CSAFE command sequence for configuring a 2000m fixed piece with a split duration of 500 m and a power goal of 300 watts:
0x21 0x03 0x02 0x00 0x21 (CSAFE_SETHORIZONTAL_CMD, 2 x Km units specifier)
0x1A 0x07 0x05 0x05 0x80 0xF4 0x01 0x00 0x00
(CSAFE_SETUSERCFG1_CMD,
CSAFE_PM_SET_SPLITDURATION, distance, 500m)
0x24 0x02 0x00 0x00 (CSAFE_SETPROGRAM_CMD, programmed workout)
It is important to issue the SETHORIZONTAL or SETTIME commands prior to setting the split duration because default split duration values are configured by the PM3/PM4 in response to the SETHORIZONTAL and SETTIME commands.
Note that this complete sequence of commands can be combined as follows with the same result:
0x21 0x03 0x02 0x00 0x21 0x1A 0x07 0x05 0x05 0x80 0xF4 0x01 0x00 0x00 0x34 0x03 0x2C 0x01 0x58 0x24 0x02 0x00 0x00
The following is a sample CSAFE command sequence for selecting the first standard list (predefined) workout in the PM3/PM4:
0x24 0x02 0x01 0x00 (CSAFE_SETPROGRAM_CMD, standard list workout #1)
Programmed Workout Parameter Limits
There are several parameters which have minimum and maximum values when configuring a workout. These parameter limits are imposed by the user interface when configuring the workout during typical usage, but will be imposed somewhat differently when configuring workouts via the public CSAFE interface. When the SetProgramCmd is issued by the Master to program the previously configured workout, all pertinent workout parameters are checked against their respective limits. If any parameter violates its limits, the entire workout configuration operation is aborted resulting in a “PrevReject” frame status. The Master must issue a PM-specific GetErrorType command to determine the specific error information. Table 18 lists the workout configuration parameter limits which should be adhered to during programming.
Table 18 - Workout Configuration Parameter Limits
Command Name | Description | Minimum | Maximum |
CSAFE_SETTWORK_CMD | Workout time goal | :20 | 9:59:59 |
CSAFE_SETHORIZONTAL_CMD | Horizontal distance goal | 100m | 50,000m |
CSAFE_PM_SET_SPLITDURATION | Time/distance split duration | :20/100m1 | N/A2 |
Notes:
1. The minimum split duration must not cause the total number of splits per workout to exceed the maximum of 30.
2. The maximum split duration cannot exceed the workout time goal or the horizontal distance goal.
PC-Host Dynamic Link Library (DLL) and Application Programming Interface (API)
Overview
PC-based host applications can communicate with PM3s over the Universal Serial Bus (USB) using the DLLs.
The following sections describe the architecture and interface details of the DLLs.
Architecture
For User applications, the PM3/PM4 utilizes a protocol architecture based on CSAFE, a protocol that is targeted at supporting communications between physical fitness equipment and a host PC. Extensions to the CSAFE protocol are employed to provide PM-specific functionality not supported by the generic protocol while maintaining compatibility.
The system architecture also supports other protocols in addition to CSAFE, including PM3/PM4 proprietary protocols for maintenance and system testing.
PM3/PM4 Device Discovery & Interface
(PM3DDICP.DLL, PM3DDICP.H, PM3DDICP.LIB)
The PM3/PM4 Device Discovery & Interface DLL is central to all types of applications that communicate with PM3/PM4s. It provides a means for applications to identify, initialize and communicate with PM3s/PM4s, as well as to discover the network topology upon which the PM3s/PM4s reside. The Device Discovery interface centralizes the various addressing schemes used by the Media Interfaces, and exposes a unified, global address map to the application.
Incorporated within this DLL is a generic command/response engine as well as an asynchronous interface. It relies on the other DLLs at the API layer for protocol-specific information (e.g. CSAFE protocol vs. PM3/PM4 proprietary protocol for implementing Flash download).
Media Interfaces
These interfaces are generally not called from the application layer, as they are meant to communicate between the Device Discovery Interface and the hardware specific windows drivers. They provide implementations of communications interfaces specific to the hardware and WDM layers. Each media interface has unique methods for identifying and addressing PM3s/PM4s. It is up to the Device Discovery interface to consolidate these unique addressing schemes into a unified address mapping.
USB Interface
(PM3USBCP.DLL, PM3USBCP.H, PM3USBCP.LIB)
This media interface implements a Human Interface Device (HID) class connection with the PM3s/PM4s over a USB connection. The USB HID Class enumeration process performed by the built-in WDM functions provides unique addressing information for each connected PM3/PM4.
802.xx Interface (RF network)
(tbd)
Asynchronous Interface (RS232/485)
(tbd)
ANT Interface (RF network)
(tbd)
CSAFE+ Command Interface
(PM3CSAFECP.DLL, PM3CSAFECP.H, PM3CSAFECP.LIB)
The CSAFE+ Command Interface DLL exposes CSAFE commands to the application and provides the proprietary protocol-specific commands/responses that allow the implementation of the CSAFE protocol over the PM3/PM4 network. Extensions to the CSAFE protocol (hence the name CSAFE+) provide additional proprietary functionality specific to PM3s/PM4s. These proprietary commands are only available if the host PC has performed the prescribed “authentication” process with the PM3/PM4.
The DLL contains the definition and format of all of the supported PM-proprietary CSAFE commands/responses. When a command is issued by the calling application, the DLL indexes the appropriate command/response object, and passes it to the PM3/PM4 Interface. The PM3/PM4 Interface sends the command via the correct media interface, receives the response data, and then returns it back to the CSAFE DLL, which returns the data to the calling application.
User Application API
The PM3/PM4 User Application Programming Interface (API) is based upon and fully supports the CSAFE protocol (see http://www.fitlinxx.com/csafe/specification.htm). The PM3/PM4 User API is comprised of two DLLs: one is utilized to provide discovery functions (Version #’s, PM3/PM4 device discovery, addressing and status), and the other is used to implement the CSAFE command set, including an extended version of CSAFE to handle PM-proprietary functionality.
The DLL functions are detailed in the sections below.
PM3/PM4 Device Discovery & Interface API
(PM3DDICP.DLL, PM3DDICP.H, PM3DDICP.LIB)
Data Type Definitions
The following data types are utilized in this DLL:
unsigned char UINT8
unsigned short UINT16
unsigned long UINT32
short INT16
long INT32
unsigned char BOOLEAN
float32 FLOAT32
float64 FLOAT64
INT16_T ECODE_T
Function Reference
tkcmdsetDDI_init
About: Initializes the DLL error code interface and media interfaces (e.g. USB, 802.11, Async).
Inputs: None
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_init(void);
tkcmdsetDDI_shutdown
About: Shuts down the Command Set Toolkit functions on the specified port.
Inputs: UINT16_T port Communication port to shut down
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_shutdown(UINT16_T port);
tkcmdsetDDI_shutdown_all
About: Shuts down the Command Set Toolkit functions on all open ports.
Inputs: None
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_shutdown();
tkcmdsetDDI_discover_pm3s
About: Discover all PM3/PM4 devices connected to the PC via various media interfaces.
Create a PM3/PM4 device map that correlates consecutive unit identifiers to each device port number and media interface location. Note that the calling function provides the starting address of the unit ID.
Important note: This function can be called multiple times with different product strings. The number of devices found will always include ALL devices found previously, even those with different product strings. Call tkcmdsetDDI_init() before calling this function to reset the “num_units” count back to 0.
Inputs: INT8_T *product_name Name of product to discover
UINT16_T starting_address Address of first unit
Outputs: UINT16_T *num_units Number of devices found
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_discover_pm3s(INT8_T *product_name , UINT16_T starting_address, UINT16_T *num_units);
tkcmdsetDDI_find_devices
About: Gets port numbers of all USB HID devices that match the product name.
Note that this function shouldn’t generally be used directly by the application. tkcmdsetDDI_discover_pm3s calls this function as part of the discovery process on all media interfaces.
Inputs: INT8_T *product_name Name of USB device to open
Outputs: UINT8_T *num_found Number of devices that match name
UINT16_T port_list[] Port numbers of devices that match
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_find_devices(INT8_T *product_name, UINT8_T *num_found, UINT16_T port_list[])
tkcmdsetDDI_fw_version
About: Reads the firmware version information from the PM3/PM4
Inputs: UINT16_T unit_address Address of PM
UINT8_T ver_len Length of command in bytes
Outputs: UINT8_T * ver_ptr FW version string stored at this location
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_fw_version(UINT16_T unit_address, UINT8_T * ver_ptr, UINT8_T ver_len);
tkcmdsetDDI_hw_version
About: Reads the hardware version information from the PM3/PM4
Inputs: UINT16_T unit_address Address of PM
UINT8_T ver_len Length of command in bytes
Outputs: UINT8_T * ver_ptr HW version string stored at this location
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_hw_version(UINT16_T unit_address, UINT8_T * ver_ptr, UINT8_T ver_len);
tkcmdsetDDI_loader_fw_version
About: Reads loader firmware version information from the PM3/PM4.
SUPPORTED ONLY BY PM3 VERSIONS 95 OR GREATER.
Inputs: UINT16_T port Identifier for device
INT8_T ver_len Length of command in bytes
Outputs: UINT8_T * ver_ptr FW version string stored at this location
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_loader_fw_version(UINT16_T port, INT8_T * ver_ptr, UINT8_T ver_len);
tkcmdsetDDI_serial_number
About: Reads the serial number information from the PM3/PM4.
Inputs: UINT16_T unit_address Address of PM
UINT8_T ver_len Length of command in bytes
Outputs: UINT8_T * ser_ptr Serial number string stored at this location
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_serial_number(UINT16_T unit_address, UINT8_T * ser_ptr, UINT8_T ver_len);
tkcmdsetDDI_status
About: Reads status information from the PM3/PM4.
Inputs: UINT16_T port Identifier for device
Outputs: UINT32_T * stat_ptr Location to store status information
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_status(UINT16_T port, UINT32_T *stat_ptr);
tkcmdsetDDI_special
About: Performs special operations based on the command.
Inputs: UINT16_T unit_address Address of PM
UINT16_T cmd Special command to execute
UINT32_T in_data Value to send with command
Outputs: UINT32_T * out_data Location to store value returned with response
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_special(UINT16_T unit_address, UINT16_T cmd, UINT32_T in_data, UINT32_T *out_data);
tkcmdsetDDI_get_dll_version
About: Returns the current version number of this DLL.
Inputs: None
Outputs: None
Returns: UINT16_T ver_info High byte is major version number
Low byte is minor version number
Function Prototype:
PM3DDI_API UINT16_T tkcmdsetDDI_get_dll_version(void);
tkcmdsetDDI_get_error_name
About: Returns the name of the error associated with the code.
Inputs: ERRCODE_T ecode Code to be looked up
UINT16_T namelen Maximum length of name string
Outputs: char * nameptr Location to place name string
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_get_error_name(ERRCODE_T ecode,char * nameptr,UINT16_T namelen);
tkcmdsetDDI_get_error_text
About: Returns the text description of the error associated with the code.
Inputs: ERRCODE_T ecode Code to be looked up
UINT16_T namelen Maximum length of text description string
Outputs: char * nameptr Location to place text description string
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_get_error_text(ERRCODE_T ecode,char * textptr,UINT16_T textlen);
tkcmdsetDDI_init_protocol
About: Initialize a protocol engine that will be used for PM3/PM4
communications. This is typically called by an external
DLL to setup a specific communications protocol.
NOTE: This is not typically called by the application directly.
For example, use tkcmdsetCSAFE_init_protocol() instead.
Inputs: ERRCODE_T *frame_builder() Ptr to frame builder function
ERRCODE_T *frame_checker() Ptr to frame checker function
UINT16_T timeout Command/response time out in MS
UINT16_T buffer_size Max frame size
UINT8_T retries Number of command retries
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_init_protocol(ERRCODE_T (*) (UINT8_T *, UINT8_T *, UINT16_T *), ERRCODE_T (*) (UINT8_T *, UINT8_T *, UINT16_T *),UINT16_T timeout, UINT16_T buffer_size, UINT8_T retries);
tkcmdsetDDI_do_protocol
About: Utilizing the protocol engine that was previously setup
in tkcmdsetDDI_init_protocol(), build and send a command
frame, then receive and check a response frame.
If the frame is valid, return the data.
This is typically called by an external DLL to implement
a specific communications protocol. For example,
use tkcmdsetCSAFE_command() instead.
NOTE: This is not typically called by the application directly.
Inputs: UINT16_T port Identifier for device
UINT16_T *num_cmd_bytes Number of data bytes to send
UINT8_T *cmd_data Data bytes to send
Outputs:UINT16_T *num_rsp_bytes Number of received bytes
UINT8_T *response Response byte
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_do_protocol(UINT16_T port,
UINT16_T *num_cmd_bytes, UINT8_T *cmd_data,
UINT16_T *num_rsp_bytes, UINT8_T *response)
tkcmdsetDDI_do_command
About: Handle the command / response transaction with the device.
NOTE: This is not typically called by the application directly.
For example, use tkcmdsetCSAFE_command () instead.
Inputs: UINT16_T port Identifier for device
UINT8_T * tx_ptr Pointer to data block to be transmitted
UINT16_T tx_len Number of bytes in the command
UINT16_T timeout Time to wait for response in milliseconds
Outputs: UINT8_T * rx_ptr Pointer to data block to save received data
UINT16_T* rx_len Number of bytes in the response
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_do_command(UINT16_T port, UINT8_T *tx_ptr,
UINT16_T tx_len, UINT8_T *rx_ptr,
UINT16_T * rx_len, UINT16_T timeout);
tkcmdsetDDI_echo
About: Display a message on the PM3/PM4.
Inputs: UINT16_T port Identifier for device
UINT8_T * cmd_ptr Location of data to send to PM3/PM4
UINT16_T cmd_len Length of data to send
Outputs: Nothing
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_echo(UINT16_T port, UINT8_T * cmd_ptr,
UINT16_T cmd_len);
tkcmdsetDDI_max_report_size
About: Returns the largest USB report size available (buffer size).
Inputs: UINT16_T port Communication port to use
Outputs: size_ptr Maximum number of bytes available in USB report
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_max_report_size(UINT16_T port, UINT16_T
*size_ptr);
**NOTE: The following asynchronous commands have not been completely validated.
tkcmdsetDDI_do_protocol_async
About: Utilizing the protocol engine that was previously setup
in tkcmdsetDDI_init_protocol(), build and send a command
frame asynchronously.
Inputs: UINT16_T port Identifier for device
UINT16_T *num_cmd_bytes Number of data bytes to send
UINT8_T *cmd_data Data bytes to send
UINT16_T cmd_tag Identifier to tag this transaction with
Outputs: Nothing
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_do_protocol_async(UINT16_T port, UINT16_T *num_cmd_bytes, UINT8_T *cmd_data, UINT16_T cmd_tag);
tkcmdsetDDI_register_asyncio
About: Register a callback for asynchronous I/O functions.
Inputs: PM3ASYNC_PROC callback Callback function to receive events
UINT16_T timeout Time to wait for response in milliseconds
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_register_asyncio(PM3ASYNC_PROC callback,
UINT16_T timeout);
tkcmdsetDDI_unregister_asyncio
About: Unregister the asynchronous I/O callback
Inputs: None
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_unregister_asyncio();
tkcmdsetDDI_do_command_async
About: Handle the command transaction with the PM3/PM4 (async interface).
Inputs: UINT16_T port Identifier for device
UINT8_T * tx_ptr Pointer to data block to be transmitted
UINT16_T tx_len Number of bytes in the command
UINT16_T cmd_tag Identifier to tag this transaction with
Outputs: Nothing
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3DDI_API ERRCODE_T tkcmdsetDDI_do_command_async(UINT16_T port, UINT8_T
*tx_ptr, UINT16_T tx_len, UINT16_T cmd_tag);
CSAFE Interface API
(PM3CSAFECP.DLL, PM3CSAFECP.H, PM3CSAFECP.LIB)
After the DLL has been initialized, the CSAFE+ command set is implemented using a single generic API function. To accomplish this, the calling application maintains individual command and response buffers (comprised of arrays of 32-bit integers), passing the pointers to these buffers along with PM device addressing and command information (see tkcmdsetCSAFE_command below).
Using CSAFE extended frame addressing, the DLL handles packing CSAFE frames, validating response frames, and unpacking the data into the response array.
Important: The PM3CSAFECP DLL recognizes PM-proprietary CSAFE commands to determine the data types expected for commands and responses. The DLL presents data to the calling application in the return buffer according to type. For example, if a PM3/PM4 command returns six data bytes comprised as a 2-byte integer and a 4 byte float, the data will be packed in two locations in the return array (one location for each data type). The DLL also expects command data to be presented in this way, which makes it a simpler interface for the application.
The DLL takes care of formatting the CSAFE frame appropriately, so the application need only send commands and data (see examples below).
The DLL will pass standard CSAFE commands through without modification. Note however, that the calling application must pass the data unpacked, as no data type checking/packing is done by the DLL. Data count bytes must be included in standard CSAFE commands, whereas the count byte is not needed in PM-proprietary CSAFE commands.
Important: The CSAFE DLL does not currently allow extended CSAFE frames except with PM-proprietary commands. Extended CSAFE frames (non-PM proprietary) can be sent using the DDI DLL function, “tkcmdsetUSB_do_DDIcommand”.
tkcmdsetCSAFE_init_protocol
About: Initializes the DLL error code interface and configures the CSAFE protocol. Uses extended frame addressing.
Inputs: UINT16_T timeout Command/response timeout in MS
(defaults to 1000ms (1 sec) if NULL)
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3CSAFE_API ERRCODE_T tkcmdsetCSAFE_init_protocol(UINT16_T timeout);
tkcmdsetCSAFE_command
About: Sends a CSAFE command to a PM device and returns
the response data. Note: the unit address is previously determined
using the DiscoverPM3s function in the PM3DDI DLL.
Inputs: UINT16_T unit_address Address of PM device
UINT16_T cmd_data_size Size of cmd data
UINT32_T cmd_data[] Command data
Outputs:UINT16_T *rsp_data_size Size of rsp data
UINT32_T rsp_data[] Response data
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3CSAFE_API ERRCODE_T tkcmdsetCSAFE_command(UINT16_T unit_address,
UINT16_T cmd_data_size, UINT32_T cmd_data[],
UINT16_T *rsp_data_size, UINT32_T rsp_data[]);
tkcmdsetCSAFE_get_dll_version
About: Returns the current version number of this DLL.
Inputs: None
Outputs: None
Returns: UINT16_T ver_info High byte is major version number
Low byte is minor version number
Function Prototype:
PM3CMD_API UINT16_T tkcmdsetCSAFE_get_dll_version(void);
tkcmdsetCSAFE_get_error_name
About: Returns the name of the error associated with the code
Inputs: ERRCODE_T ecode Code to be looked up
UINT16_T namelen Maximum length of name string
Outputs: char * nameptr Location to place name string
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3CMD_API ERRCODE_T tkcmdsetCSAFE_get_error_name(ERRCODE_T ecode,char * nameptr,UINT16_T namelen);
tkcmdsetCSAFE_get_error_text
About: Returns the text description of the error associated with the code
Inputs: ERRCODE_T ecode Code to be looked up
UINT16_T namelen Maximum length of text description string
Outputs: char * nameptr Location to place text description string
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3CMD_API ERRCODE_T tkcmdsetCSAFE_get_error_text(ERRCODE_T ecode,char * textptr,UINT16_T textlen);
tkcmdsetCSAFE_get_status
About: Gets the CSAFE status byte from the previous transaction.
Inputs: Nothing
Outputs: Nothing
Returns: UINT8_T slave_status CSAFE status byte
Function Prototype:
PM3CSAFE_API UINT8_T tkcmdsetCSAFE_get_status(void);
**NOTE: The following asynchronous commands have not been completely validated.
tkcmdsetCSAFE_register_asyncio
About: Register a callback for asynchronous I/O functions.
Inputs: PM3ASYNC_PROC callback Callback function to receive events
UINT16_T timeout Time to wait for response in milliseconds
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3CSAFE_API ERRCODE_T tkcmdsetCSAFE_register_asyncio(PM3ASYNC_CSAFE_PROC callback, UINT16_T timeout);
tkcmdsetCSAFE_unregister_asyncio
About: Unregister the asynchronous I/O callback
Inputs: None
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3CSAFE_API ERRCODE_T tkcmdsetCSAFE_unregister_asyncio();
PM3 USB Interface API
(PM3USBCP.DLL, PM3USBCP.H, PM3USBCP.LIB)
The following is the API for the USB DLL. NOTE: The functions in this DLL are not typically called by the application (the API layer DDI DLL calls these functions). CALLING DIRECTLY TO THE USB DLL FUNCTIONS IS RECOMMENDED ONLY FOR ADVANCED USERS!
Note that the complete CSAFE frame must be properly formatted (including byte stuffing and checksum!) when using this direct interface to communicate with the PM3/PM4.
tkcmdsetUSB_get_dll_version()
About: Returns the current version number of this software.
Inputs: None
Outputs: None
Returns: UINT16_T ver_info High byte is major version number
Low byte is minor version number
Function Prototype:
PM3USB_API UINT16_T tkcmdsetUSB_get_dll_version(void);
tkcmdsetUSB_get_error_name
About: Returns the name of the error associated with the code
Inputs: ERRCODE_T ecode Code to be looked up
UINT16_T namelen Maximum length of name string
Outputs: char * nameptr Location to place name string
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API void tkcmdsetUSB_get_error_name(ERRCODE_T ecode,char * nameptr, UINT16_T namelen);
tkcmdsetUSB_get_error_text
About: Returns the text description of the error associated with the code
Inputs: ERRCODE_T ecode Code to be looked up
UINT16_T namelen Maximum length of text description string
Outputs: char * nameptr Location to place text description string
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API void tkcmdsetUSB_get_error_text(ERRCODE_T ecode,char * textptr, UINT16_T textlen);
tkcmdsetUSB_init
About: Initializes the Command Set Toolkit functions.
Inputs: None
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API ERRCODE_T tkcmdsetUSB_init();
tkcmdsetUSB_find_devices
About: Gets port numbers of all USB HID devices that match the product name.
Inputs: INT8_T * product_name Name of USB device to open
Outputs: UINT8_T * num_found Number of devices that match name
UINT16_T port_list[] Port numbers of devices that match
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API ERRCODE_T tkcmdsetUSB_find_devices(INT8_T *product_name, UINT8_T *num_found, UINT16_T port_list[]);
tkcmdsetUSB_do_DDIcommand
About: Handle the command / response transaction with the device.
Inputs: UINT16_T port Identifier for device
UINT8_T * tx_ptr Pointer to data block to be transmitted
UINT16_T tx_len Number of bytes in the command
UINT16_T timeout Time to wait for response in milliseconds
Outputs: UINT8_T * rx_ptr Pointer to data block to save received data
UINT16_T* rx_len Number of bytes in the response
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API ERRCODE_T tkcmdsetUSB_do_DDIcommand(UINT16_T port, UINT8_T
*tx_ptr, UINT16_T tx_len, UINT8_T *rx_ptr, UINT16_T * rx_len, UINT16_T timeout)
tkcmdsetUSB_status
About: Reads status information from the device
Inputs: UINT16_T port Identifier for device
Outputs: UINT32_T * stat_ptr Location to store status information
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API ERRCODE_T tkcmdsetUSB_status(UINT16_T port, UINT32_T *stat_ptr);
tkcmdsetUSB_fw_version
About: Reads the firmware version information from the PM3/PM4
Inputs: UINT16_T port Communication port to use
Outputs: UINT8_T * ver_ptr FW version string stored at this location
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API ERRCODE_T tkcmdsetUSB_fw_version(UINT16_T port, INT8_T * ver_ptr, UINT8_T ver_len);
tkcmdsetUSB_hw_version
About: Reads the hardware version information from the PM3/PM4
Inputs: UINT16_T port Communication port to use
Outputs: UINT8_T * ver_ptr HW version string stored at this location
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API ERRCODE_T tkcmdsetUSB_hw_version(UINT16_T port, INT8_T * ver_ptr, UINT8_T ver_len);
tkcmdsetDDI_serial_number
About: Reads the serial number information from the PM3/PM4
Inputs: UINT16_T port Communication port to use
Outputs: UINT8_T * ser_ptr Serial number string stored at this location
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API ERRCODE_T tkcmdsetUSB_serial_number(UINT16_T port, INT8_T * ser_ptr, UINT8_T ser_len);
tkcmdsetUSB_shutdown
About: Shuts down the Command Set Toolkit functions
Inputs: UINT16_T port Communication port to use
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API ERRCODE_T tkcmdsetUSB_shutdown(UINT16_T port);
**NOTE: The following asynchronous commands have not been completely validated.
tkcmdsetUSB_register_asyncio
About: Register a callback for asynchronous I/O functions.
Inputs: PM3ASYNC_PROC callback Callback function to receive events
UINT16_T timeout Time to wait for response in milliseconds
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API ERRCODE_T tkcmdsetUSB_register_asyncio(PM3ASYNC_PROC callback, UINT16_T timeout);
tkcmdsetUSB_unregister_asyncio
About: Unregister the asynchronous I/O callback
Inputs: None
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API ERRCODE_T tkcmdsetUSB_unregister_asyncio();
tkcmdsetUSB_send_command
About: Send an asynchronous command to the USB device.
Inputs: UINT16_T port Identifier for device
UINT8_T * tx_ptr Pointer to data block to be transmitted
UINT16_T tx_len Transmit buffer length
UINT16_T cmd_tag Identifier Tag to pass back to the caller on recv
Outputs: None
Returns: ERRCODE_T ecode Zero if successful
Error code otherwise
Function Prototype:
PM3USB_API ERRCODE_T tkcmdsetUSB_send_command(UINT16_T port, UINT8_T *tx_ptr, UINT16_T tx_len, UINT16_T cmd_tag);
Example Application Logic – CSAFE DLLs.
The following demonstrates setup and operation of the CSAFE DLLs.
/* Initialize the DLL and media (hardware) interfaces */
if (ecode = tkcmdsetDDI_init())
{
/* PM3 DLL init error */
}
/* Discover and get count of all discovered PM3s or PM4s. Tell DLL to start numbering at 0. */
else if((ecode = tkcmdsetDDI_discover_pm3s(TKCMDSET_PM3_PRODUCT_NAME2, 0, &num_units)
&&
(ecode = tkcmdsetDDI_discover_pm3s(TKCMDSET_PM4_PRODUCT_NAME, 0, &num_units))
{
/* PM discovery error */
tkcmdsetDDI_shutdown();
}
/* Initialize the CSAFE protocol engine. Leave timeout at default. */
else if (ecode = tkcmdsetCSAFE_init_protocol())
{
/* CSAFE DLL init error */
}
/* Program loop */
else
{
/* (PM initialization goes here, using CSAFE commands) */
while (program_is_running)
{
/*
* Example command : CSAFE_GETHORIZONTAL_CMD
*
* Where:
* unit_address = 0;
* cmd_data[] = {0xA1}; // (CSAFE_GETHORIZONTAL_CMD)
* cmd_size = 1;
*/
tkcmdsetCSAFE _command(unit_address, cmd_size, cmd_data, &rsp_size, rsp_data);
/*
* Example response data:
* rsp_data[] = {0xD0, 0x07, 0x24}; // (Horizontal LS byte,
// Horizontal MS byte,
* // Unit Specifier)
* rsp_size = 3;
*/
}
/* Clean up and exit */
tkcmdset_shutdown();
}
Example Application Logic – USB DLL (“direct interface”).
The following demonstrates calling directly into the USB DLL, bypassing the CSAFE and DDI DLLs. Note that the complete CSAFE frame must be properly formatted (including byte stuffing!) when using this direct interface to communicate with the PM3/PM4.
/* Initialize the USB DLL interface */
if ((ecode = tkcmdsetUSB_init()
{
/* USB init error – shut down DLL */
tkcmdsetUSB_shutdown();
}
/* Initialize and discover USB PM3 devices. Update device map structure.*/
/* usb_port[] is an array of USB port numbers for all PM3’s found - will get populated by this routine */
else if ((ecode = tkcmdsetUSB_find_devices (TKCMDSET_PM3_PRODUCT_NAME2, &usb_num_units, usb_port) &&
(ecode = tkcmdsetUSB_find_devices (TKCMDSET_PM4_PRODUCT_NAME, &usb_num_units, usb_port))
{
/* Find devices error – shut down DLL */
tkcmdsetUSB_shutdown();
}
else
{
/* (PM initialization goes here, using CSAFE commands) */
while (program_is_running)
{
/*
* Example command : GET STATUS (uses extended frame format)
* Where:
* usb_port[0] = 0;
* timeout = 70; (in ms)
* cmd_data[] = {0xF0, 0xFD, 0x00, 0x80, 0x80, 0xF2}; // GET STATUS
* cmd_len = 6;
* rsp_len = 100; (this is used by DLL to determine USB report size)
*
*/
ecode = tkcmdsetUSB_do_DDIcommand(usb_port[0], cmd_data, cmd_len, rsp_data, &rsp_len, timeout);
/* Example response data:
* rsp_data[] = { 0xF0, 0x00, 0xFD, 0x01, 0x80, 0x01, 0x01, 0x81, 0xF2};
*/
}
/* Clean up and exit */
tkcmdsetUSB_shutdown();
}
Appendix A
CSAFE Commands Implemented
Short Commands
Command Name | Command Identifier | Response Data |
CSAFE_GETSTATUS_CMD | 0x80 | Byte 0: Status |
CSAFE_RESET_CMD | 0x81 | N/A1 |
CSAFE_GOIDLE_CMD | 0x82 | N/A1 |
CSAFE_GOHAVEID_CMD | 0x83 | N/A1 |
CSAFE_GOINUSE_CMD | 0x85 | N/A1 |
CSAFE_GOFINISHED_CMD | 0x86 | N/A1 |
CSAFE_GOREADY_CMD | 0x87 | N/A1 |
CSAFE_BADID_CMD | 0x88 | N/A1 |
CSAFE_GETVERSION_CMD | 0x91 | Byte 0: Mfg IDByte 1: CIDByte 2: ModelByte 3: HW Version (LS)Byte 4: HW Version (MS)Byte 5: SW Version (LS)Byte 6: SW Version (MS) |
CSAFE_GETID_CMD | 0x92 | Byte 0: ASCII Digit 0 (MS)Byte 1: ASCII Digit 1Byte 2: ASCII Digit 22Byte 3: ASCII Digit 32Byte 4: ASCII Digit 42 (LS) |
CSAFE_GETUNITS_CMD | 0x93 | Byte 0: Units Type |
CSAFE_GETSERIAL_CMD | 0x94 | Byte 0: ASCII Serial # (MS)Byte 1: ASCII Serial #Byte 2: ASCII Serial #Byte 3: ASCII Serial #Byte 4: ASCII Serial #Byte 5: ASCII Serial #Byte 6: ASCII Serial #Byte 7: ASCII Serial #Byte 8: ASCII Serial # (LS) |
CSAFE_GETLIST_CMD | 0x98 | <Not implemented> |
CSAFE_GETUTILIZATION_CMD | 0x99 | <Not implemented> |
CSAFE_GETMOTORCURRENT_CMD | 0x9A | <Not implemented> |
CSAFE_GETODOMETER_CMD | 0x9B | Byte 0: Distance (LSB)Byte 1: DistanceByte 2: DistanceByte 3: Distance (MSB)Byte 4: Units Specifier |
CSAFE_GETERRORCODE_CMD | 0x9C | Byte 0: Error Code (LSB)Byte 1: Error CodeByte 2: Error Code (MSB) |
CSAFE_GETSERVICECODE_CMD | 0x9D | <Not implemented> |
CSAFE_GETUSERCFG1_CMD | 0x9E | <Not implemented> |
CSAFE_GETUSERCFG2_CMD | 0x9F | <Not implemented> |
CSAFE_GETTWORK_CMD | 0xA0 | Byte 0: HoursByte 1: MinutesByte 2: Seconds |
CSAFE_GETHORIZONTAL_CMD | 0xA1 | Byte 0: Horizontal Distance (LSB)Byte 1: Horizontal Distance (MSB)Byte 2: Units Specifier |
CSAFE_GETVERTICAL_CMD | 0xA2 | <Not implemented> |
CSAFE_GETCALORIES_CMD | 0xA3 | Byte 0: Total Calories (LSB)Byte 1: Total Calories (MSB) |
CSAFE_GETPROGRAM_CMD | 0xA4 | Byte 0: Programmed/Pre-stored Workout Number |
CSAFE_GETSPEED_CMD | 0xA5 | <Not implemented> |
CSAFE_GETPACE_CMD | 0xA6 | Byte 0: Stroke Pace (LSB)Byte 1: Stroke Pace (MSB)Byte 2: Units Specifier |
CSAFE_GETCADENCE_CMD | 0xA7 | Byte 0: Stroke Rate (LSB)Byte 1: Stroke Rate (MSB)Byte 2: Units Specifier |
CSAFE_GETGRADE_CMD | 0xA8 | <Not implemented> |
CSAFE_GETGEAR_CMD | 0xA9 | <Not implemented> |
CSAFE_GETUPLIST_CMD | 0xAA | <Not implemented> |
CSAFE_GETUSERINFO_CMD | 0xAB | Byte 0: Weight (LSB)Byte 1: Weight (MSB)Byte 2: Units SpecifierByte 3: AgeByte 4: Gender |
CSAFE_GETTORQUE_CMD | 0xAC | <Not implemented> |
CSAFE_GETHRCUR_CMD | 0xB0 | Byte 0: Beats/Min |
CSAFE_GETHRTZONE_CMD | 0xB2 | <Not implemented> |
CSAFE_GETMETS_CMD | 0xB3 | <Not implemented> |
CSAFE_GETPOWER_CMD | 0xB4 | Byte 0: Stroke Watts (LSB)Byte 1: Stroke Watts (MSB)Byte 2: Units Specifier |
CSAFE_GETHRAVG_CMD | 0xB5 | <Not implemented> |
CSAFE_GETHRMAX_CMD | 0xB6 | <Not implemented> |
CSAFE_GETUSERDATA1_CMD | 0xBE | <Not implemented> |
CSAFE_GETUSERDATA2_CMD | 0xBF | <Not implemented> |
CSAFE_GETAUDIOCHANNEL_CMD | 0xC0 | <Not implemented> |
CSAFE_GETAUDIOVOLUME_CMD | 0xC1 | <Not implemented> |
CSAFE_GETAUDIOMUTE_CMD | 0xC2 | <Not implemented> |
CSAFE_ENDTEXT_CMD | 0xE0 | <Not implemented> |
CSAFE_DISPLAYPOPUP_CMD | 0xE1 | <Not implemented> |
CSAFE_GETPOPUPSTATUS_CMD | 0xE5 | <Not implemented> |
Notes:
1. No specific response data, but the status byte will be returned
2. Depends on # ID digits configuration
Example CSAFE command/response frames using standard frame:
Get status using the CSAFE_GETSTATUS_CMD command -
Command Frame: 0xF1 0x80 0x80 0xF2
Response Frame: 0xF1 0x01 0x80 0x01 0x01 0x81 0xF2
Example CSAFE command/response frames using extended frames with the host PC address of 0x00 and the default PM (Erg) address of 0xFD:
Response Frame: 0xF0 0x00 0xFD 0x81 0x91 0x07 0x16 0x02 0x03 0xA4 0x01 0x84 0x03 0xA3 0xF2
Long Commands
Command Name | Command Identifier | Command Data | Response Data |
CSAFE_AUTOUPLOAD_CMD2 | 0x01 | Byte 0: Configuration | N/A |
CSAFE_UPLIST_CMD | 0x02 | <Not implemented> | N/A |
CSAFE_UPSTATUSSEC_CMD | 0x04 | <Not implemented> | N/A |
CSAFE_UPLISTSEC_CMD | 0x05 | <Not implemented> | N/A |
CSAFE_IDDIGITS_CMD | 0x10 | Byte 0: # of Digits | N/A |
CSAFE_SETTIME_CMD | 0x11 | Byte 0: HourByte 1: MinuteByte 2: Second | N/A |
CSAFE_SETDATE_CMD | 0x12 | Byte 0: YearByte 1: MonthByte 2: Day | N/A |
CSAFE_SETTIMEOUT_CMD | 0x13 | Byte 0: State Timeout | N/A |
CSAFE_SETUSERCFG1_CMD1 | 0x1A | One or more PM3 specific commands | <PM3 specific command identifer(s)> |
CSAFE_SETUSERCFG2_CMD | 0x1B | <Not implemented> | N/A |
CSAFE_SETTWORK_CMD | 0x20 | Byte 0: HoursByte 1: MinutesByte 2: Seconds | N/A |
CSAFE_SETHORIZONTAL_CMD | 0x21 | Byte 0: Horizontal Distance (LSB)Byte 1: Horizontal Distance (MSB)Byte 2: Units Specifier | N/A |
CSAFE_SETVERTICAL_CMD | 0x22 | <Not implemented> | N/A |
CSAFE_SETCALORIES_CMD | 0x23 | Byte 0: Total Calories (LSB)Byte 1: Total Calories (MSB) | N/A |
CSAFE_SETPROGRAM_CMD | 0x24 | Byte 0: Programmed or Pre-stored WorkoutByte 1: <don’t care> | N/A |
CSAFE_SETSPEED_CMD | 0x25 | <Not implemented> | N/A |
CSAFE_SETGRADE_CMD | 0x28 | <Not implemented> | N/A |
CSAFE_SETGEAR_CMD | 0x29 | <Not implemented> | N/A |
CSAFE_SETUSERINFO_CMD | 0x2B | <Not implemented> | N/A |
CSAFE_SETTORQUE_CMD | 0x2C | <Not implemented> | N/A |
CSAFE_SETLEVEL_CMD | 0x2D | <Not implemented> | N/A |
CSAFE_SETTARGETHR_CMD | 0x30 | <Not implemented> | N/A |
CSAFE_SETMETS_CMD | 0x33 | <Not implemented> | N/A |
CSAFE_SETPOWER_CMD | 0x34 | Byte 0: Stroke Watts (LSB)Byte 1: Stroke Watts (MSB)Byte 2: Units Specifier | N/A |
CSAFE_SETHRZONE_CMD | 0x35 | <Not implemented> | N/A |
CSAFE_SETHRMAX_CMD | 0x36 | <Not implemented> | N/A |
CSAFE_SETCHANNELRANGE_CMD | 0x40 | <Not implemented> | N/A |
CSAFE_SETVOLUMERANGE_CMD | 0x41 | <Not implemented> | N/A |
CSAFE_SETAUDIOMUTE_CMD | 0x42 | <Not implemented> | N/A |
CSAFE_SETAUDIOCHANNEL_CMD | 0x43 | <Not implemented> | N/A |
CSAFE_SETAUDIOVOLUME_CMD | 0x44 | <Not implemented> | N/A |
CSAFE_STARTTEXT_CMD | 0x60 | <Not implemented> | N/A |
CSAFE_APPENDTEXT_CMD | 0x61 | <Not implemented> | N/A |
CSAFE_GETTEXTSTATUS_CMD | 0x65 | <Not implemented> | N/A |
CSAFE_GETCAPS_CMD | 0x70 | Byte 0: Capability Code | Capability Code 0x00:Byte 0: Max Rx Frame Byte 1: Max Tx FrameByte 2: Min InterframeCapability Code 0x01:Byte 0: 0x00Byte 1: 0x00Capability Code 0x02:Byte 0: 0x00Byte 1: 0x00Byte 2: 0x00Byte 3: 0x00Byte 4: 0x00Byte 5: 0x00Byte 6: 0x00Byte 7: 0x00Byte 8: 0x00Byte 9: 0x00Byte 10: 0x00 |
CSAFE_SETPMCFG_CMD3 | 0x76 | 1 or more PM3 CSAFE commands | See PM3 proprietary commands |
CSAFE_SETPMDATA_CMD3 | 0x77 | 1 or more PM3 CSAFE commands | See PM3 proprietary commands |
CSAFE_GETPMCFG_CMD3 | 0x7E | 1 or more PM3 CSAFE commands | See PM3 proprietary commands |
CSAFE_GETPMDATA_CMD3 | 0x7F | 1 or more PM3 CSAFE commands | See PM3 proprietary commands |
Notes:
1. Used for PM-specific functionality as command wrapper
2. Although implemented, this command currently has no affect
3. Added for PM proprietary functionality as command wrappers (not available for public use except for specifically designated public commands)
Example CSAFE command/response frame using standard frame:
Command Frame: 0xF1 0x20 0x03 0x00 0x07 0x1E 0x3A 0xF2
Response Frame: 0xF1 0x01 0x05 0x80 0x02 0x00 0x01 0xF9 0xF2
Example CSAFE command/response frame using extended frame with the host PC address of 0x00 and the default PM (Erg) address of 0xFD:
Get device protocol parameter capabilities with the CSAFE_GETCAPS_CMD command -
Command Frame: 0xF0 0xFD 0x00 0x70 0x01 0x00 0x71 0xF2
Response Frame: 0xF0 0x00 0xFD 0x81 0x70 0x03 0x60 0x60 0x032 0x41 0xF2
CSAFE PM3-Specific Commands Implemented
Short Commands
Command Name | Command Identifier | Response Data |
CSAFE_PM_GET_WORKOUTTYPE | 0x89 | Byte 0: Workout Type |
CSAFE_PM_GET_DRAGFACTOR | 0xC1 | Byte 0: Drag Factor |
CSAFE_PM_GET_STROKESTATE | 0xBF | Byte 0: Stroke State |
CSAFE_PM_GET_WORKTIME | 0xA0 | Byte 0: Work Time (LSB)Byte 1: Work TimeByte 2: Work TimeByte 3: Work Time (MSB)Byte 4: Fractional Work Time |
CSAFE_PM_GET_WORKDISTANCE | 0xA3 | Byte 0: Work Distance (LSB)Byte 1: Work DistanceByte 2: Work DistanceByte 3: Work Distance (MSB)Byte 4: Fractional Work Distance |
CSAFE_PM_GET_ERRORVALUE2 | 0xC9 | Byte 0: Error Value (LSB)Byte 1: Error Value (MSB) |
CSAFE_PM_GET_WORKOUTSTATE | 0x8D | Byte 0: Workout State |
CSAFE_PM_GET_WORKOUTINTERVALCOUNT | 0x9F | Byte 0: Workout Interval Count |
CSAFE_PM_GET_INTERVALTYPE | 0x8E | Byte 0: Interval Type |
CSAFE_PM_GET_RESTTIME | 0xCF | Byte 0: Rest Time (LSB)Byte 1: Rest Time (MSB) |
Notes:
1. The above commands are sent using the CSAFE_SETUSERCFG1_CMD command wrapper discussed in PM3 Extensions.
2. The ERRORVALUE command will serve to clear the latched error value in the PM3 when the Screen Error Display Mode is DISABLED
Example CSAFE command/response frame using standard frame:
Get higher resolution work time (2:30.85 seconds) using the CSAFE_SETUSERCFG1_CMD command wrapper with a CSAFE_PM_GET_WORKTIME command -
Command Frame: 0xF1 0x1A 0x01 0xA0 0xBB 0xF2
Response Frame: 0xF1 0x81 0x1A 0x07 0xA0 0x05 0x98 0x3A 0x00 0x00 0x55 0x4F 0xF2
Example CSAFE command/response frames using extended frames with the host PC address of 0x00 and the default PM (Erg) address of 0xFD:
Get workout type (fixed distance w/ splits) and drag factor (128) using the CSAFE_SETUSERCFG1_CMD command wrapper with a CSAFE_PM_GET_WORKOUTTYPE and CSAFE_PM_GET_DRAGFACTOR commands -
Command Frame: 0xF0 0xFD 0x00 0x1A 0x02 0x89 0xC1 0x50 0xF2
Response Frame: 0xF0 0x00 0xFD 0x01 0x1A 0x06 0x89 0x01 0x03 0xC1 0x01 0x80 0xD7 0xF2
Long Commands
Command Name | Command Identifier | Command Data | Response Data |
CSAFE_PM_SET_SPLITDURATION | 0x05 | Byte 0: Time/Distance duration(0: Time, 128: Distance)Byte 1: Duration (LSB)Byte 2: DurationByte 3: DurationByte 4: Duration (MSB) | N/A |
CSAFE_PM_GET_FORCEPLOTDATA2 | 0x6B | Byte 0: Block length in bytes | Byte 0: Bytes readByte 1: 1st data read (LSB)Byte 2: 1st data read (MSB)Byte 3: 2nd data read (LSB) . . .Byte 33: 16th data read (MSB) |
CSAFE_PM_SET_SCREENERRORMODE | 0x27 | Byte 0: Mode(0: Disable, 1: Enable) | N/A |
CSAFE_PM_GET_HEARTBEATDATA3 | 0x6C | Byte 0: Block length in bytes | Byte 0: Bytes readByte 1: 1st data read (LSB)Byte 2: 1st data read (MSB)Byte 3: 2nd data read (LSB) . . .Byte 33: 16th data read (MSB) |
Notes:
1. The above commands are sent using the CSAFE_SETUSERCFG1_CMD command wrapper discussed in PM3 Extensions.
2. A maximum block length of 32 bytes (16 words) can be read. Fewer words can be read by specifying the block length accordingly, but a complete 33 bytes of response data will be returned. The first byte of the response will indicate how many valid data bytes are returned.
3. A maximum block length of 32 bytes (16 words) can be read. Fewer words can be read by specifying the block length accordingly, but a complete 33 bytes of response data will be returned. Only data samples recorded since the last read will be returned. The first byte of the response will indicate how many valid data bytes are returned.
Example CSAFE command/response frame using standard frame:
Set the split duration (100 m) using the CSAFE_SETUSERCFG1_CMD command wrapper with a CSAFE_PM_SET_SPLITDURATION command -
Command Frame: 0xF1 0x1A 0x07 0x05 0x05 0x80 0x64 0x00 0x00 0x00 0xF9 0xF2
Response Frame: 0xF1 0x81 0x1A 0x01 0x05 0x1E 0xF2
Appendix B
PM3 Data Conversions
Watts <-> Pace
Pace is in sec/meter:
Watts = (2.8 / ( pace * pace * pace ))
Calories/Hr <-> Pace
Pace is in sec/meter:
Calories/Hr = (((2.8 / ( pace * pace * pace )) * ( 4.0 * 0.8604)) + 300.0)
Pace <-> /500m Pace
Pace is in sec/meter:
Pace/500m = (pace * 500)
Appendix C
Pre-programmed workout definitions for standard list and custom list are defined below. Note that the "Custom List" and "Favorites" workouts can vary from PM to PM depending on actions taken by the user.
Standard List Workouts
Program # / Description
1 - 2000m Fixed Distance with 500m splits
2 - 5000m Fixed Distance with 1000m splits
3 - 10000m Fixed Distance with 2000m splits
4 - 30:00 Fixed Time w/ 6:00 splits
5 - 500m Fixed Distance Interval with 1:00 rest between intervals (500m/1:00r)
Custom List Workouts
Program # / Description
6 - 00:30 Fixed Time Interval w/ 00:30 rest between intervals (:30/:30r)
7 - 7 Interval Variable (1:00/1:00r, 2:00/2:00r, 3:00/3:00r, 4:00/4:00r, 3:00/3:00r, 2:00/2:00r, 1:00/1:00r)
8 - 4 Interval Variable (2000m/3:00r, 1500m/3:00r, 1000m/3:00r, 500m/3:00r)
9 - 9 Interval Variable (1:40/:20r, 1:40/:20r, 1:40/:20r, 1:40/:20r, 1:40/2:00r, 1:40/:20r, 1:40/:20r, 1:40/:20r, 1:40/:20r)
10 - 42195 Fixed Distance with 2000m splits
Appendix D
The PM3/PM4 error display format is a combination of error code and screen number as defined below:
<Error Code> - <Screen Number>
The error codes and their descriptions are provided in Table 19.
PM3/PM4 Error Codes
Table 19 - PM3/PM4 Error Code Descriptions
Internal Name | Value | Description |
APMAIN_TASKCREATE_ERR | 1 | Operating system task creation error |
APMAIN_TASKDELETE_ERR | 2 | Operating system task deletion error |
APMAIN_VOLTSUPPLY_ERR | 3 | <Not Used> |
APMAIN_USERKEY_STUCK_ERR | 4 | One or more user input keys are asserted during power-up and not released within 2 seconds |
APMAIN_TASK_INVALID_ERR | 5 | One or more operating system tasks that should be active during normal operation are determined to be inactive |
APCOMM_INIT_ERR | 10 | <Not Used> |
APCOMM_INVALIDPW_ERR | 11 | Invalid interface authentication password |
APLOG_INIT_ERR | 20 | <Not Used> |
APLOG_INVALIDUSER_ERR | 21 | User number provided by the screen content is out of range |
APLOG_USERSTATINFO_STORAGE_ERR | 22 | User static information not successfully stored on logcard |
APLOG_USERSTATINFO_RETRIEVE_ERR | 23 | User static information not successfully retrieved from logcard |
APLOG_USERDELETE_ERR | 24 | Unsuccessful deletion of user from logcard |
APLOG_USERDYNAMINFO_STORAGE_ERR | 25 | User dynamic information not successfully stored on logcard |
APLOG_USERDYNAMINFO_RETRIEVE_ERR | 26 | User dynamic information not successfully retrieved from logcard |
APLOG_CUSTOMWORKOUT_STORAGE_ERR | 27 | Custom workout information not successfully stored on logcard |
APLOG_CUSTOMWORKOUT_RETRIEVE_ERR | 28 | Custom workout information not successfully retrieved from logcard |
APLOG_CUSTOMWORKOUT_INSUFFMEM_ERR | 29 | Insufficient logcard memory exists to store the custom workout information |
APLOG_CUSTOMWORKOUT_INVALID_ERR | 30 | Specific custom workout information is invalid |
APLOG_INVALIDCARDOPERATION_ERR | 31 | Screen content performed invalid logcard operation |
APLOG_INVALIDUSERCARDDATA_ERR | 32 | <Not Used> |
APLOG_INVALIDCUSTOMWORKOUT_ERR | 33 | Custom workout number provided by the screen content is out of range |
APLOG_INVALIDWORKOUTIDENT_ERR | 34 | Workout type provided by the screen content is out of range |
APLOG_INVALIDLISTLENGTH_ERR | 35 | <Not Used> |
APLOG_INVALIDINPUTPARAM_ERR | 36 | Special function input parameter provided by screen content is invalid |
APLOG_INVALIDWORKOUTNUM_ERR | 37 | Workout number provided by the screen content is out of range |
APLOG_CARDNOTPRESENT_ERR | 38 | Logcard access unsuccessful because card not present |
APLOG_INVALIDINTLOGADDR_ERR | 39 | Logcard workout log address provided by the screen content was out of range |
APLOG_INVALIDLOGHDRPTR_ERR | 40 | Accessing the logcard workout log section was unsuccessful because some of the contents are invalid |
APLOG_MAXSPLITSEXCEEDED_ERR | 41 | Unable to store the split/interval data in internal log memory because the maximum # of splits has been exceeded |
APLOG_NODATAAVAILABLE_ERR | 42 | Searching for the requested logcard workout log data has returned no information |
APLOG_INVALIDCARDSTRUCTREV_ERR | 43 | Logcard card information structure revision is invalid |
APLOG_CARDOPERATIONTIMEOUT_ERR | 44 | Logcard operations requested by the screen content timed-out waiting for the logcard to become available |
APLOG_INVALIDLOGSIZE_ERR | 45 | Detected invalid data set size while storing workout results to logcard |
APLOG_LOGENTRYVALIDATE_ERR | 46 | Failure to validate workout results written to logcard |
APLOG_USERDYNAMICVALIDATE_ERR | 47 | Failure to validate updated user dynamic data written to logcard |
APLOG_CARDINFOVALIDATE_ERR | 48 | Failure to validate updated card information data written to logcard |
APLOG_CARDACCESS_ERR | 49 | Unable to communicate with logcard while its status is present and valid |
APPM3_INVALIDWORKOUTNUM_ERR | 60 | Workout number provided by screen content or host PC for configuring the PM3 is out of range |
APPM3_NOPLOTDATA_ERR | 61 | No pace plot data available for collection by the host PC |
APPM3_INVALIDMFGINFO_ERR | 62 | Manufacturing information structure stored in non-volatile memory does not pass its integrity check |
APPM3_INVALIDCALINFO_ERR | 63 | Calibration information structure stored in non-volatile memory does not pass its integrity check |
APPM3_INVALIDWORKOUTDURATION_ERR | 64 | Programmed workout duration out of range |
APPM3_INVALIDSPLITDURATION_ERR | 65 | Programmed split duration out of range, causes max splits to be exceeded, or exceeds workout duration |
APPM3_INVALIDRESTDURATION_ERR | 66 | Programmed rest duration out of range |
APPM3_INVALIDINTERVALCNT_ERR | 67 | Programmed interval count out of range |
APPM3_INVALIDWORKOUTTYPE_ERR | 68 | Programmed workout type invalid |
APHEADER_INVALIDFONTHDR_ERR | 80 | Font information header structure stored in Flash memory does not pass its integrity check |
APHEADER_INVALIDSCRNHDR_ERR | 81 | Screen content information header structure stored in Flash memory does not pass its integrity check |
APHEADER_INVALIDLDRHDR_ERR | 82 | USB Loader information header structure stored in Flash memory does not pass its integrity check |
APHEADER_INVALIDAPPHDR_ERR | 83 | Application information header structure stored in Flash memory does not pass its integrity check |
AP_NETWORK_GENESISMODE_ERR | 1230 | |
AP_NETWORK_PRIMFWDWNLOAD_ERR | 1250 | |
AP_NETWORK_READPDA_ERR | 1251 | |
AP_NETWORK_LOADBLOCKS_ERR | 1252 | |
AP_NETWORK_VERIFYBLOCKS_ERR | 1253 | |
AP_NETWORK_APPLYPDA_ERR | 1254 | |
AP_NETWORK_RUNFW_ERR | 1255 | |
AP_NETWORK_RESET_ERR | 1256 | |
AP_NETWORK_PRESENT_ERR | 1257 | |
AP_NETWORK_SECFWDWNLOAD_ERR | 1350 | |
AP_NETWORK_READPDA_ERR | 1351 | |
AP_NETWORK_LOADBLOCKS_ERR | 1352 | |
AP_NETWORK_VERIFYBLOCKS_ERR | 1353 | |
AP_NETWORK_APPLYPDA_ERR | 1354 | |
AP_NETWORK_RUNFW_ERR | 1355 | |
AP_NETWORK_RESET_ERR | 1356 | |
AP_NETWORK_PRESENT_ERR | 1357 | |
AP_NETWORK_DRIVERINIT_ERR | 1400 | |
AP_NETWORK_NETWORKINIT_ERR | 1401 | |
AP_NETWORK_UDPSERVERINIT_ERR | 1402 | |
AP_NETWORK_COMMSQUALITY_ERR | 1500 | |
AP_NETWORK_PACKETSTATS_ERR | 1501 | |
AP_NETWORK_POWERMANAGECFG_ERR | 1502 | |
TKCMDPR_INVALIDMSGTYPE_ERR | 120 | <Not Used> |
TKCMDPR_INVALID_CMD_ERR | 121 | Command received from host PC is invalid |
TKCMDPR_INVALID_CMD_ADDR_ERR | 122 | CSAFE command frame address is invalid |
TKCMDPR_INVALID_DEST_ADDR_ERR | 123 | CSAFE command frame routing destination address is invalid |
TKCMDPR_INVALID_DEST_INTF_ERR | 124 | CSAFE command/response frame routing table entry has conflicting destination interface with existing entry |
TKCMDPR_INVALID_INTF_ERR | 125 | CSAFE command/response processing specified an invalid communication interface |
TKCMDPR_ROUTE_TABLE_FULL_ERR | 126 | Command/response frame routing table full |
TKCMDPR_UNAUTHORIZED_CMD_ERR | 127 | Command received from host PC is not supported in the current PM3 operating mode |
TKCMDPR_REFUSE_CMD_ERR | 128 | Broadcast command from host PC refused in the current PM3 operating mode |
TKCMDPR_INVALID_RSP_ERR | 129 | Command frame received from host PC is valid but at least one of the individual commands within the frame is invalid/unsupported so no response is generated |
TKDATALOG_INIT_ERR | 130 | Data logging toolkit functions not initialized |
TKDATALOG_DEVICE_INVALID_ERR | 131 | Selected data logging device invalid |
TKDATALOG_CARD_INIT_ERR | 132 | Failure of data logging device to pass integrity check |
TKDATALOG_DEVICE_SIZE_ERR | 133 | Data logging devices size is not supported |
TKDATALOG_MULTI_STRUCT_ERR | 134 | Failure to confirm integrity or repair data logging device mult-structure information |
TKDATALOG_READ_ERR | 135 | Data logging device read failure |
TKDATALOG_WRITE_ERR | 136 | Data logging device write failure |
TKDATALOG_RECORDIDENTIFIER_ERR | 137 | Data logging device record identifier invalid |
TKDATALOG_INSUFFMEM_ERR | 138 | Data logging device insufficient memory |
TKDATALOG_CARD_CORRUPT_ERR | 139 | Logcard data logging device corrupted |
TKDISP_INVALID_CHAR_ERR | 140 | Display character provided by screen content or host PC is out of range |
TKDISP_INVALIDPARAM_ERR | 141 | Display coordinate provided by screen content or host PC is out of range |
TKDISP_STRING_TOO_LONG_ERR | 142 | Display string and coordinates provided by screen content or host PC is exceeds display capability |
TKDISP_STRING_TOO_HIGH_ERR | 143 | Display string and coordinates provided by screen content or host PC exceeds display capability |
TKDISP_INVALID_LANG_ERR | 144 | Display language provided by screen content or host PC is out of range |
TKEEPROM_INIT_ERR | 150 | EEPROM toolkit functions not initialized |
TKEEPROM_ACK_ERR | 151 | Failure to receive ACK from EEPROM during read or write operation |
TKEEPROM_STOP_ERR | 152 | Failure to receive ACK from EEPROM during stop operation |
TKEEPROM_INVALID_END_ADDR | 153 | EEPROM address exceeds size of device |
TKEEPROM_WRITE_TIMEOUT_ERR | 154 | <Not Used> |
TKEEPROM_WRITE_READ_ERR | 155 | Timeout waiting for EEPROM write cycle to complete |
TKEEPROM_WRITE_VERIFY_ERR | 156 | Failure to verify data written to EEPROM after write cycle has completed |
TKEEPROM_CHKSM_READ_ERR | 157 | Failure to read EEPROM during checksum computation |
TKFRAME_CSAFE_FRAME_STUFF_ERR | 160 | Failure in CSAFE frame processing during byte-unstuffing |
TKFRAME_CSAFE_FRAME_CHKSM_ERR | 161 | CSAFE frame checksum failure |
TKFRAME_NO_SCI_FRAME_ERR | 162 | No complete CSAFE frame detected during serial interface character processing |
TKFRAME_NO_USB_FRAME_ERR | 163 | No complete CSAFE frame detected during USB interface character processing |
TKFRAME_CSAFE_INVALID_SHORT_CMD_ERR | 164 | Invalid short command present in CSAFE frame |
TKFRAME_CSAFE_INVALID_LONG_CMD_ERR | 165 | Invalid long command present in CSAFE frame |
TKFRAME_CSAFE_FRAME_TOO_LONG_ERR | 166 | CSAFE frame exceeds maximum allowable frame length |
TKFRAME_NO_EXPRF_FRAME_ERR | 167 | No complete CSAFE frame detected during 802.11 interface character processing |
TKFRAME_CSAFE_INVALID_LONG_RSP_ERR | 168 | Invalid CSAFE frame length in slave response |
TKHDW_EVENT_BURST_STACK_OVF_ERR | 170 | Burst stack overflow error |
TKHDW_EVENT_BURST_STACK_UNF_ERR | 171 | Burst stack underflow error |
TKHRTMON_INVALID_NUM_MEAS_ERR | 180 | Number of heartrate monitor measurements requests exceeds maximum |
TKHRTMON_TOO_FEW_MEAS_ERR | 181 | Number of available heartrate monitor measurements is fewer than the requested number of measurements |
TKMEM_INVALID_MEMTYPE_ERR | 200 | Requested memory operation specified invalid memory type |
TKMEM_INVALID_START_ADDR_ERR | 201 | Requested memory operation specified invalid start address for the memory type |
TKMEM_INVALID_END_ADDR_ERR | 202 | Requested memory operation specified invalid end address for the memory type |
TKMEM_FLASH_WRITE_ERR | 203 | Flash memory write failure |
TKRTTIMER_INVALID_MONTH_ERR | 210 | Invalid month specified in date structure during date format conversion |
TKRTTIMER_INVALID_DAY_ERR | 211 | Invalid day specified in date structure during date format conversion |
TKRTTIMER_INVALID_TIMER_NUM_ERR | 212 | Invalid task timer number specified during timer configuration |
TKRTTIMER_INVALID_TIMER_MODE_ERR | 213 | Invalid task timer mode specified during timer configuration |
TKSCI_INVALID_PORT_ERR | 220 | Invalid serial communication interface port specified |
TKSCI_TX_SEND_ERR | 221 | Failure during serial communication interface transmission |
TKSCI_RX_TIMEOUT_ERR | 222 | Receive timeout on serial communication interface |
TKSCRN_INVALID_SPECFUNCTYPE | 230 | Special function type provided by the screen content or host PC is out of range |
TKSCRN_ILLEGAL_SPLITDURATION | 231 | Illegal split duration was detected and fixed |
TKSMCD_ACK_ERR | 240 | Failure to receive ACK from smart card during read operation |
TKSMCD_STOP_ERR | 241 | Failure to receive ACK from smart card during stop operation |
TKSMCD_INVALID_END_ADDR | 242 | Smart card address exceeds size of device |
TKSMCD_WRITE_TIMEOUT_ERR | 243 | <Not Used> |
TKSMCD_WRITE_READ_ERR | 244 | Timeout waiting for smart card write cycle to complete |
TKSMCD_WRITE_VERIFY_ERR | 245 | Failure to verify data written to smart card after write cycle has completed |
TKSMCD_CHKSM_READ_ERR | 246 | Failure to read smart card during checksum computation |
TKSMCD_ACK_ERR_WRITE | 247 | Failure to receive ACK from smart card during write operation |
TKTACH_INVALID_NUM_MEAS_ERR | 250 | Number of flywheel tach measurements requests exceeds maximum |
TKTACH_TOO_FEW_MEAS_ERR | 251 | Number of available flywheel tach measurements is fewer than the requested number of measurements |
TKTIME_INVALID_MONTH_ERR | 260 | Invalid month specified in date structure during date format conversion |
TKTIME_INVALID_DAY_ERR | 261 | Invalid day specified in date structure during date format conversion |
TKUSER_INIT_ERR | 260 | <Not Used> |
TKCRC_ERR | 300 | <Not Used> |
TKUSB_BAD_DESC_RQT_ERR | 330 | USB communication interface bad descriptor request |
TKUSB_INVALID_EPNUM_ERR | 331 | Invalid USB communication interface endpoint specified |
TKUSB_RX_TIMEOUT_ERR | 332 | <Not Used> |
TKUSB_EPNUM_RX_OVERRUN | 333 | USB communication interface endpoint receive overrun |
TKUSB_INIT_EPNUM_ERR | 334 | USB communication interface endpoint initialization failure |
TKUSB_GET_RX_CHAR_ERR | 335 | Failure to get character from the USB communication interface endpoint |
TKUSB_BUS_DISABLE_ERR | 336 | <Not Used> |
TKUSB_BUS_RESET_ERR | 337 | <Not Used> |
TKUSB_NO_FEATURE_REPORT_ERR | 338 | No feature report available on the USB communication interface |
TKUSB_INVALID_STRING_ID_ERR | 339 | Invalid string descriptor ID request on the USB communication interface |
TKUSB_EP_TX_OVERRUN_ERR | 340 | USB communication interface endpoint transmit overrun |
TKUSB_INVALID_TX_LEN_ERR | 341 | Length of transmit data for USB communication interface exceeds buffer size |
TKDIAG_DIAGFAIL_ERR | 500 | One or more diagnostic tests failed |
TKDIAG_FLSHFONTDIAG_BADHDRCRC_ERR | 501 | Flash font information header CRC failure |
TKDIAG_FLSHFONTDIAG_CRCCALC_ERR | 502 | Flash font information CRC calculation unsuccessful |
TKDIAG_FLSHFONTDIAG_BADFONTCRC_ERR | 503 | Flash font information CRC failure |
TKDIAG_FLSHSCRNDIAG_BADHDRCRC_ERR | 510 | Flash screen content information header CRC failure |
TKDIAG_FLSHSCRNDIAG_CRCCALC_ERR | 511 | Flash screen content information CRC calculation unsuccessful |
TKDIAG_FLSHSCRNDIAG_BADSCRNCRC_ERR | 512 | Flash screen content information CRC failure |
TKDIAG_FLSHAPPDIAG_BADHDRCRC_ERR | 520 | Flash application information header CRC failure |
TKDIAG_FLSHAPPDIAG_CRCCALC_ERR | 521 | Flash application information CRC calculation unsuccessful |
TKDIAG_FLSHAPPDIAG_BADAPPCRC_ERR | 522 | Flash application information CRC failure |
TKDIAG_UARTDIAG_UART1_INIT_ERR | 530 | Serial communication UART1 initialization failure |
TKDIAG_UARTDIAG_UART1_WRITE_ERR | 531 | Serial communication UART1 loopback write failure |
TKDIAG_UARTDIAG_UART1_READ_ERR | 532 | Serial communication UART1 loopback read failure |
TKDIAG_UARTDIAG_UART2_INIT_ERR | 533 | Serial communication UART2 initialization failure |
TKDIAG_UARTDIAG_UART2_WRITE_ERR | 534 | Serial communication UART2 loopback write failure |
TKDIAG_UARTDIAG_UART2_READ_ERR | 535 | Serial communication UART2 loopback read failure |
TKDIAG_ADCONVDIAG_INIT_ERR | 540 | Analog-to-digital converter initialization failure |
TKDIAG_ADCONVDIAG_NOTREADY_ERR | 541 | <Not Used> |
TKDIAG_ADCONVDIAG_ADCINPUT_ERR | 542 | Analog-to-digital converter conversion out of range failure |
TKDIAG_SWUSERCONFIRM_ERR | 550 | User switch confirmation timeout failure |
TKDIAG_SWSHORT_ERR | 551 | User switch short failure |
TKDIAG_SW0_ERR | 552 | User switch 0 assertion failure |
TKDIAG_SW1_ERR | 553 | User switch 1 assertion failure |
TKDIAG_SW2_ERR | 554 | User switch 2 assertion failure |
TKDIAG_SW3_ERR | 555 | User switch 3 assertion failure |
TKDIAG_SW4_ERR | 556 | User switch 4 assertion failure |
TKDIAG_SW5_ERR | 557 | User switch 5 assertion failure |
TKDIAG_SW6_ERR | 558 | User switch 6 assertion failure |
TKDIAG_SW7_ERR | 559 | User switch 7 assertion failure |
TKDIAG_AMUXDIAG_NOTREADY_ERR | 560 | Analog mux analog-to-digital conversion not available failure |
TKDIAG_AMUXDIAG_ANALOGVREFCHAN_ERR | 561 | Analog mux reference channel conversion out of range failure |
TKDIAG_AMUXDIAG_ANALOGGNDCHAN_ERR | 562 | Analog mux ground channel conversion out of range failure |
TKDIAG_VSUPPLYDIAG_VEXPDIAG_ERR | 570 | Expansion module voltage supply out of range failure (PM3 only) |
TKDIAG_VSUPPLYDIAG_GENINDIAG_ERR | 571 | Flywheel generator input voltage out of range failure (PM3 only) |
TKDIAG_VSUPPLYDIAG_VBATEXPDIAG_ERR | 572 | Battery expansion module voltage out of range failure (PM3 only) |
TKDIAG_VSUPPLYDIAG_VBATPROTDIAG_ERR | 573 | Battery protected voltage out of range failure (PM3 only) |
TKDIAG_VSUPPLYDIAG_VUSBDIAG_ERR | 574 | USB input voltage out of range failure (PM3 only) |
TKDIAG_VSUPPLYDIAG_VREFDIAG_ERR | 575 | Reference voltage out of range failure (PM3 only) |
TKDIAG_VSUPPLYDIAG_VBIASDIAG_ERR | 576 | LCD bias voltage supply out of range failure (PM3 only) |
TKDIAG_VSUPPLYDIAG_VBATDIAG_ERR | 570 | Alkaline battery voltage out of range failure (PM4 only) |
TKDIAG_VSUPPLYDIAG_VNIMHDIAG_ERR | 571 | NiMH (rechargeable) battery voltage out of range failure (PM4 only – Will occur on cold boot if no alkaline or NiMH battery present and powered by USB) |
TKDIAG_VSUPPLYDIAG_GENINDIAG_ERR | 572 | Flywheel generator input voltage out of range failure (PM4 only) |
TKDIAG_VSUPPLYDIAG_VEXPDIAG_ERR | 573 | Expansion module voltage supply out of range failure (PM4 only) |
TKDIAG_VSUPPLYDIAG_VREFDIAG_ERR | 574 | Reference voltage out of range failure (PM4 only) |
TKDIAG_VSUPPLYDIAG_EXPDIAG_ERR | 575 | Expansion module voltage supply out of range failure (PM4 only) |
TKDIAG_VSUPPLYDIAG_VBIASDIAG_ERR | 576 | LCD bias voltage supply out of range failure (PM4 only) |
TKDIAG_EXTEEDIAG_RDDATA1_ERR | 580 | EEPROM read data location 1 failure (PM3 only) |
TKDIAG_EXTEEDIAG_INVALIDCRC1_ERR | 581 | EEPROM manufacturing structure CRC validity failure (PM3 only) |
TKDIAG_EXTEEDIAG_RDDATA2_ERR | 582 | EEPROM read data location 2 failure (PM3 only) |
TKDIAG_EXTEEDIAG_INVALIDCRC2_ERR | 583 | EEPROM calibration structure CRC validity failure (PM3 only) |
TKDIAG_EXTEEDIAG_WRDATA1_ERR | 584 | EEPROM write data location 1 failure (PM3 only) |
TKDIAG_EXTEEDIAG_WRDATA2_ERR | 585 | EEPROM write data location 2 failure (PM3 only) |
TKDIAG_EXTEEDIAG_DATA1_ERR | 586 | EEPROM write/read verify data location 1 failure (PM3 only) |
TKDIAG_EXTEEDIAG_DATA2_ERR | 587 | EEPROM write/read verify data location 2 failure (PM3 only) |
TKDIAG_EXTEEDIAG_RDDATA1_ERR | 580 | EEPROM read data location 1 failure (PM4 only) |
TKDIAG_EXTEEDIAG_INVALIDCRC1_ERR | 581 | EEPROM manufacturing structure CRC validity failure (PM4 only) |
TKDIAG_EXTEEDIAG_RDDATA2_ERR | 582 | EEPROM read data location 2 failure (PM4 only) |
TKDIAG_EXTEEDIAG_INVALIDCRC2_ERR | 583 | EEPROM calibration structure CRC validity failure (PM4 only) |
TKDIAG_EXTEEDIAG_RDDATA3_ERR | 584 | EEPROM read data location 3 failure (PM4 only) |
TKDIAG_EXTEEDIAG_INVALIDCRC3_ERR | 585 | EEPROM user structure CRC validity failure (PM4 only) |
TKDIAG_EXTEEDIAG_RDDATA4_ERR | 586 | EEPROM read data location 4 failure (PM4 only) |
TKDIAG_EXTEEDIAG_WRDATA1_ERR | 587 | EEPROM write data location 1 failure (PM4 only) |
TKDIAG_EXTEEDIAG_WRDATA2_ERR | 588 | EEPROM write data location 2 failure (PM4 only) |
TKDIAG_EXTEEDIAG_WRDATA3_ERR | 589 | EEPROM write data location 3 failure (PM4 only) |
TKDIAG_EXTEEDIAG_WRDATA4_ERR | 590 | EEPROM write data location 4 failure (PM4 only) |
TKDIAG_EXTEEDIAG_DATA1_ERR | 591 | EEPROM read verify of write data location 1 failure (PM4 only) |
TKDIAG_EXTEEDIAG_DATA2_ERR | 592 | EEPROM read verify of write data location 2 failure (PM4 only) |
TKDIAG_EXTEEDIAG_DATA3_ERR | 593 | EEPROM read verify of write data location 3 failure (PM4 only) |
TKDIAG_EXTEEDIAG_DATA4_ERR | 594 | EEPROM read verify of write data location 4 failure (PM4 only) |
TKDIAG_TACHDIAG_USERCONFIRM_ERR | 590 | Tach confirmation timeout failure (PM3 only) |
TKDIAG_TACHDIAG_TACHUNPLUG_ERR | 591 | <Not Used> (PM3 only) |
TKDIAG_TACHDIAG_TACHPLUG_ERR | 592 | Tach input is active or flywheel spinning failure (PM3 only) |
TKDIAG_TACHDIAG_TACHSPINNING_ERR | 593 | Tach input flywheel not spinning failure (PM3 only) |
TKDIAG_TACHDIAG_USERABORT_ERR | 594 | Tach user diagnostic abort failure (PM3 only) |
TKDIAG_TACHDIAG_USERCONFIRM_ERR | 595 | Tach confirmation timeout failure (PM4 only) |
TKDIAG_TACHDIAG_TACHUNPLUG_ERR | 596 | <Not Used> (PM4 only) |
TKDIAG_TACHDIAG_TACHPLUG_ERR | 598 | Tach input is active or flywheel spinning failure (PM4 only) |
TKDIAG_TACHDIAG_TACHSPINNING_ERR | 599 | Tach input flywheel not spinning failure (PM4 only) |
TKDIAG_TACHDIAG_USERABORT_ERR | 594 | Tach user diagnostic abort failure (PM4 only) |
TKDIAG_HRTMONDIAG_USERCONFIRM_ERR | 600 | Heartrate montor confirmation timeout failure |
TKDIAG_HRTMONDIAG_HRTUNPLUG_ERR | 601 | <Not Used> |
TKDIAG_HRTMONDIAG_HRTPLUG_ERR | 602 | Heartrate monitor is active or pulses present failure |
TKDIAG_HRTMONDIAG_HRTACTIVE_ERR | 603 | Heartrate monitor no pulses present failure |
TKDIAG_HRTMONDIAG_USERABORT_ERR | 604 | Heartrate monitor user diagnostic abort failure |
TKDIAG_GENINPUTDIAG_USERCONFIRM_ERR | 610 | Generator confirmation timeout failure |
TKDIAG_GENINPUTDIAG_THRESHMAX_ERR | 611 | Generator voltage above max threshold failure |
TKDIAG_GENINPUTDIAG_THRESHMIN_ERR | 612 | Generator voltage below min threshold failure |
TKDIAG_GENINPUTDIAG_USERABORT_ERR | 613 | Generator user diagnostic abort failure |
TKDIAG_SCDIAG_USERCONFIRM_ERR | 620 | Smart card confirmation timeout failure |
TKDIAG_SCDIAG_ILLEGALDETECT_ERR | 621 | Smart card detect if no card present failure |
TKDIAG_SCDIAG_DETECT_ERR | 622 | Smart card no detect if card present failure |
TKDIAG_SCDIAG_COMM_ERR | 623 | Smart card communication failure |
TKDIAG_SCDIAG_USERABORT_ERR | 624 | Smart card user diagnostic abort failure |
TKDIAG_EXPCFREG_NOTPRESENT_ERR | 660 | Expansion configuration register module not present failure (PM3 only) |
TKDIAG_EXPCFREG_LO_ERR | 661 | Expansion configuration register low loopback signal failure (PM3 only) |
TKDIAG_EXPCFREG_HI_ERR | 662 | Expansion configuration register high loopback signal failure (PM3 only) |
TKDIAG_EXPSTSLED_NOTPRESENT_ERR | 670 | Expansion status LED module not present failure (PM3 only) |
TKDIAG_EXPFLASH_NOTPRESENT_ERR | 680 | Expansion Flash memory module not present failure (PM3 only) |
TKDIAG_EXPFLASH_FILLNORMALDATA_ERR | 681 | Expansion Flash memory fill normal data failure (PM3 only) |
TKDIAG_EXPFLASH_NORMALDATA_ERR | 682 | Expansion Flash memory normal data verify failure (PM3 only) |
TKDIAG_EXPFLASH_FILLINVERTEDDATA_ERR | 683 | Expansion Flash memory fill inverted data failure (PM3 only) |
TKDIAG_EXPFLASH_INVERTEDDATA_ERR | 684 | Expansion Flash memory inverted data verify failure (PM3 only) |
TKDIAG_EXPSRAM_NOTPRESENT_ERR | 690 | Expansion static RAM module not present failure (PM3 only) |
TKDIAG_EXPSRAM_NORMALDATA_ERR | 691 | Expansion static RAM normal data write/read verify failure (PM3 only) |
TKDIAG_EXPSRAM_INVERTEDDATA_ERR | 692 | Expansion static RAM inverted data write/read verify failure (PM3 only) |
TKDIAG_EXPEEDIAG_NOTPRESENT_ERR | 700 | Expansion EEPROM module not present failure (PM3 only) |
TKDIAG_EXPEEDIAG_INVALIDCRC_ERR | 701 | Expansion EEPROM manufacturing information CRC valid check failure (PM3 only) |
TKDIAG_EXPEEDIAG_RDDATA1_ERR | 702 | Expansion EEPROM read failure (PM3 only) |
TKDIAG_EXPEEDIAG_WRDATA1_ERR | 703 | Expansion EEPROM write failure (PM3 only) |
TKDIAG_EXPEEDIAG_DATA1_ERR | 704 | Expansion EEPROM write/read verify failure (PM3 only) |
TKDIAG_EXP232DIAG_NOTPRESENT_ERR | 710 | Expansion RS232 interface module not present failure (PM3 only) |
TKDIAG_EXP232DIAG_CONFIG_ERR | 711 | Expansion RS232 configuration failure (PM3 only) |
TKDIAG_EXP232DIAG_TXCHAR_ERR | 712 | Expansion RS232 loopback transmit failure (PM3 only) |
TKDIAG_EXP232DIAG_LOOPBACK_TO_ERR | 713 | Expansion RS232 loopback receive timeout failure (PM3 only) |
TKDIAG_EXP232DIAG_LOOPBACK_DATA_ERR | 714 | Expansion RS232 loopback data verify failure (PM3 only) |
TKDIAG_EXP232DIAG_USERCONFIRM_ERR | 715 | Expansion RS232 confirmation timeout failure (PM3 only) |
TKDIAG_EXP232DIAGDIAG_USERABORT_ERR | 716 | Expansion RS232 user diagnostic abort failure (PM3 only) |
TKDIAG_EXP485DIAG_NOTPRESENT_ERR | 720 | Expansion RS485 interface module not present failure (PM3 only) |
TKDIAG_EXP485DIAG_CONFIG_ERR | 721 | Expansion RS485 configuration failure (PM3 only) |
TKDIAG_EXP485DIAG_FORMATFRAME_ERR | 722 | Expansion RS485 CSAFE frame format failure (PM3 only) |
TKDIAG_EXP485DIAG_SENDCMD_ERR | 723 | Expansion RS485 CSAFE frame send failure (PM3 only) |
TKDIAG_EXP485DIAG_UNFORMATFRAME_ERR | 724 | Expansion RS485 CSAFE frame unformat failure (PM3 only) |
TKDIAG_EXP485DIAG_USERCONFIRM_ERR | 725 | Expansion RS485 confirmation timeout failure (PM3 only) |
TKDIAG_EXP485DIAGDIAG_USERABORT_ERR | 726 | Expansion RS485 user diagnostic abort failure (PM3 only) |
TKDIAG_EXP485DIAG_NORESPONSE_ERR | 727 | Expansion RS485 no command response failure (PM3 only) |
TKDIAG_EXPWIFIDIAG_NOTPRESENT_ERR | 730 | Expansion 802.11 module not present failure (PM3 only) |
TKDIAG_EXPWIFIDIAG_CFINIT_ERR | 731 | Expansion 802.11 initialization failure (PM3 only) |
TKDIAG_EXPWIFIDIAG_RECONFIG_ERR | 732 | Expansion 802.11 task reconfiguration failure (PM3 only) |
TKDIAG_EXPWIFIDIAG_USERABORT_ERR | 733 | Expansion 802.11 user diagnostic abort failure (PM3 only) |
TKDIAG_EXPWIFIDIAG_DHCP_TO_ERR | 734 | Expansion 802.11 DHCP timeout failure (PM3 only) |
TKDIAG_EXPWIFIDIAG_CFNOTPRESENT_ERR | 735 | Expansion 802.11 correct CF card present failure (PM3 only) |
TKDIAG_EXPWIFIDIAG_NOTAVAILABLE_ERR | 736 | Expansion 802.11 diagnostic not available in this mode (PM3 only) |
TKDIAG_GPIOCFREG_NOTPRESENT_ERR | 740 | <Not Used> (PM4 only) |
TKDIAG_GPIOCFREG_LO_ERR | 741 | Expansion GPIO register loopback low failure (PM4 only) |
TKDIAG_GPIOCFREG_HI_ERR | 742 | Expansion GPIO register loopback high failure (PM4 only) |
TKDIAG_STSLED_NOTPRESENT_ERR | 750 | <Not Used> (PM4 only) |
TKDIAG_ANTRFDIAG_NOTPRESENT_ERR | 760 | <Not Used> (PM4 only) |
TKDIAG_ANTRFDIAG_CONFIG_ERR | 761 | ANT RF device configuration failure (PM4 only) |
TKDIAG_ANTRFDIAG_FORMATFRAME_ERR | 762 | ANT RF frame format failure (PM4 only) |
TKDIAG_ANTRFDIAG_SENDCMD_ERR | 763 | ANT RF send command failure (PM4 only) |
TKDIAG_ANTRFDIAG_UNFORMATFRAME_ERR | 764 | ANT RF unformat frame failure (PM4 only) |
TKDIAG_ANTRFDIAG_USERCONFIRM_ERR | 765 | ANT RF device user confirm failure (PM4 only) |
TKDIAG_ANTRFDIAG_USERABORT_ERR | 766 | ANT RF user abort failure (PM4 only) |
TKDIAG_ANTRFDIAG_NORESPONSE_ERR | 767 | ANT RF no command response failure (PM4 only) |
TKDIAG_ANTRFDIAG_EXCESSERRORRATE_ERR | 768 | ANT RF excessive command/response error rate failure (PM4 only) |
TKDIAG_RS485DIAG_NOTPRESENT_ERR | 770 | <Not Used> (PM4 only) |
TKDIAG_RS485DIAG_CONFIG_ERR | 771 | RS485 interface configuration failure (PM4 only) |
TKDIAG_RS485DIAG_FORMATFRAME_ERR | 772 | RS485 frame format failure (PM4 only) |
TKDIAG_RS485DIAG_SENDCMD_ERR | 773 | RS485 send command failure (PM4 only) |
TKDIAG_RS485DIAG_UNFORMATFRAME_ERR | 774 | RS485 unformat frame failure (PM4 only) |
TKDIAG_RS485DIAG_USERCONFIRM_ERR | 775 | RS485 user confirm failure (PM4 only) |
TKDIAG_RS485DIAG_USERABORT_ERR | 776 | RS485 user abort failure (PM4 only) |
TKDIAG_RS485DIAG_NORESPONSE_ERR | 777 | RS485 no command response failure (PM4 only) |
TKDIAG_RS485DIAG_TXCHAR_ERR | 778 | RS485 transmit character failure (PM4 only) |
TKDIAG_RS485DIAG_LOOPBACK_TO_ERR | 779 | RS485 loopback character timeout failure (PM4 only) |
TKDIAG_RS4852DIAG_LOOPBACK_DATA_ERR | 780 | RS485 loopback character data failure (PM4 only) |
TKDIAG_RS4852DIAG_NOCABLECONNECT_ERR | 781 | RS485 no cable connected failure (PM4 only) |
TKEXP_RS232_INVALID_ERR | 1000 | <Not Used> (PM3 only) |
TKEXP_CF_NOTPRESENT_ERR | 1001 | Expansion module CF card not present (PM3 only) |
TKEXP_CF_CIRQINVALID_ERR | 1002 | Expansion module CF IRQ invalid state (PM3 only) |
TKEXP_CF_CARDNOTREADY_ERR | 1003 | Expansion module CF card not ready (PM3 only) |
TKEXP_CF_MEMTEST_ERR | 1004 | Expansion module memory test failure (PM3 only) |
TKEXP_CF_INVALIDSTATE_ERR | 1005 | Expansion module invalid state (PM3 only) |
TKEXP_CF_RFVENDORSTRING_ERR | 1006 | Expansion module invalid 802.11 vendor string (PM3 only) |
TKEXP_INVALIDLEDMODE_ERR | 1007 | Expansion module invalid status LED mode (PM3 only) |
TKEXP_INVALIDLEDCOLOR_ERR | 1008 | Expansion module invalid status LED color (PM3 only) |
TKDEBUG_INIT_ERR | 2000 | <Not Used> |
IOADCONV_BG_TIMEOUT_ERR | 810 | Analog-to-digital converter bandgap reference ready timeout |
IOADCONV_RESET_TIMEOUT_ERR | 811 | Analog-to-digital converter reset timeout |
IOADCONV_INVALID_CHAN_ERR | 812 | Analog-to-digital converter invalid channel |
IOADCONV_NOT_RDY_ERR | 813 | Analog-to-digital converter not ready |
IOADCONV_INVALID_REF_ERR | 814 | Analog-to-digital converter invalid reference level |
IOADCONV_INIT_ADC_ERR | 815 | <Not Used> |
IODMA_INVALID_MEM_CHAN_ERR | 820 | DMA invalid memory channel requested |
IODMA_INVALID_IO_RQST_CHAN_ERR | 821 | DMA invalid IO channel requested |
IODMA_INIT_DMA_ERR | 822 | DMA initialization unsuccessful |
IODMA_QUEUE_FULL_ERR | 823 | DMA queue full |
IOHDW_MEM_INVALID_CS_ERR | 830 | Memory chip select invalid |
IOHDW_INVALID_DMACLK_ERR | 831 | DMA clock invalid |
IOHDW_INVALID_SYSCLK_ERR | 832 | System clock invalid |
IOI2C_NOACK_ERR | 840 | I2C no ACK on read or write |
IOI2C_INIT_WDR_TIMOUT_ERR | 841 | I2C initialization wait for data ready timeout |
IOI2C_INIT_XMIT_TIMOUT_ERR | 842 | I2C initialize transmit data timeout |
IOI2C_SEND_XMIT_TIMOUT_ERR | 843 | I2C send transmit data timeout |
IOI2C_GET_RECV_TIMOUT_ERR | 844 | I2C get receive data timeout |
IOI2C_STOP_TIMEOUT_ERR | 845 | I2C stop condition timeout |
IOI2C_WDR_TIMOUT_ERR | 846 | I2C wait for data ready timeout |
IOI2C_INVALID_BAUD | 847 | I2C invalid baud rate |
IOLCD_DISPINIT_ERR | 860 | LCD display initialization unsuccessful |
IOLCD_INVALIDPARAM_ERR | 861 | LCD invalid display parameter specified |
IOMEM_FLASH_ERASE_TIMEOUT_ERR | 870 | Flash memory erase timeout |
IOMEM_FLASH_WRITE_TIMEOUT_ERR | 871 | Flash memory write timeout |
IORTCLOCK_WRITE_TIME_ERR | 880 | Real-time clock write timeout |
IOSCI_INVALID_PORT_ERR | 890 | Serial communication interface invalid port |
IOSCI_INVALID_BAUD_ERR | 891 | Serial communication interface invalid baud |
IOSCI_INVALID_CNT_ERR | 892 | Serial communication interface characters requested out of range |
IOSCI_INIT_PORT_ERR | 893 | Serial communication interface unsuccessful port initialization |
IOSCI_TXOVERRUN_ERR | 894 | Serial communication interface transmit overrun |
IOSCI_RXOVERRUN_ERR | 895 | Serial communication interface receive overrun |
IOSCI_RXFRAME_ERR | 896 | Serial communication interface framing failure |
IOSCI_RXPARITY_ERR | 897 | Serial communication interface parity failure |
IOSCI_RXBREAK_ERR | 898 | Serial communication interface break condition failure |
IOTIMER_INVALID_TIMERID_ERR | 910 | Timer ID invalid |
IOUSER_SEMAPHORE_PEND_ERR | 920 | <Not Used> |
IOUSER_SEMAPHORE_POST_ERR | 921 | <Not Used> |
IOUSB_RST_TIMOUT_ERR | 930 | USB interface reset timeout |
IOUSB_CFG_TIMOUT_ERR | 931 | USB interface configuration timeout |
IOUSB_CFG_ENDPT_ERR | 932 | USB interface endpoint configuration timeout |
IOUSB_SETUP_ERR | 933 | USB interface control endpoint packet setup failure |
IOUSB_FIFO_RD_ERR | 934 | USB interface FIFO read failure |
IOUSB_NULL_PTR_ERR | 935 | USB interface null pointer |
IOUSB_BUS_INIT_ERR | 936 | USB interface bus initialization failure |
IOUSB_TX_BUFFER_ERR | 937 | USB interface null Tx buffer pointer |
IOUSB_EP_BUSY_ERR | 938 | USB interface endpoint busy |
IOUSB_EP_INVALID_ERR | 939 | USB interface invalid endpoint specified |
IOUSB_WAKEUP_DISABLE_ERR | 940 | USB interface bus unable to resume |
IOUSB_BAD_FRAMENUM_ERR | 941 | USB interface bad frame number |
IOUSB_CFG_DEV_ERR | 942 | USB interface not configured |
IOUSB_BAD_IFCNUM_ERR | 943 | USB interface invalid interface number |
Appendix E
PMSDKDemo Application
The SDK provides a PMSDKDemo application to demonstrate some of the PM3/PM4 functionality (See Figure 8 – Demo Application Screen Shot Figure 8 for a screen shot).
The Demo application works as follows:
1. When the Reset button is pressed, the application attempts to communicate with a PM3/PM4 on the USB port. If the communication is successful, the Unit Serial number will be displayed.
2. A command is sent to the PM3/PM4 by selecting the command from the pull down menu, entering any required data in the data edit box, then pressing “Send”.
3. The response is shown in the “Response” display box. (The DLL returns the response data in 32-bit words, thus the leading zeros). The actual response time in milliseconds is shown to the right of the “Response” text.
4. For debug purposes, the “Repeat” and “Save To File” checkboxes can be set individually or together. The “Repeat” repeats the command once the “Send” is selected at the rate entered in the “Rate(ms) edit box or as fast as the PM3/PM4 will respond, whichever is slower. The “Save To File” saves the command and response data to a text file “Cmd_Rsp Data.txt” until the checkbox is unselected. The file is created in the same directory as the API Demonstration executable.
5. The status from the last successful response is shown in the lower right of the display.
Command Example #1 – Get Horizontal Command
See Figure 8 – Demo Application Screen Shot Figure 8 for an example of a CSAFE command 0x1A (CSAFE_GETHORIZONTAL_CMD). The response has 3 bytes of data: 2 bytes for the horizontal distance (0x07d0 or 2000), and 1 for the unit specifier (0x24).
Figure 8 – Demo Application Screen Shot – CSAFE Get Horizontal Command
Command Example #2 – Get PM3Worktime and Get PM3Workdistance Command
The example in Figure 9 shows the use of the use of the CSAFE command wrapper 0x1A to concatenate two PM-specific commands: CSAFE_PM_GET_WORKTIME (0xA0), and CSAFE_PM_GET_WORKDISTANCE (0xA3). Each of these commands has a 5-byte response with the first 4-bytes comprising a 32-bit value and the final byte an 8-bit value. Notice that the commands and the number of response bytes is each command is included in the response. The “2” following the command (1A) designates the number of parameters in the command. Any command that has parameters must include a byte designating the number of command parameters in order for the command to be sent properly.
Figure 9 – Demo Application Screen Shot – Get PMWorkTime & Get PMWorkDistance
Command Example #3 – Set Programmed Workout Command
The example in Figure 9 shows the use of the CSAFE command CSAFE_GOHAVEID_CMD (0x83) and CSAFE_SETPROGRAM_CMD (0x24), followed by CSAFE_GOINUSE_CMD (0x85). The Set Programmed Workout command includes two 1-byte parameters: 1). Workout number and 2). (unused: future). Note that there is no response to these commands. The “2” following the command (24) designates the number of parameters in the command. Any command that has parameters must include a byte designating the number of command parameters in order for the command to be sent properly.
Figure 10 – Demo Application Screen Shot – Set Programmed Workout
Appendix F
PM4 Status LED State Definitions
The following table defines the various status LED states encountered during operation. Note that LED blink rates are interpreted as 50% duty cycle between on and off. The blink specified blink rate refers to a complete on/off cycle. For example, a 0.25 Hz blink rate means the LED will be on for 2 seconds and off for 2 seconds.
Table 20 - Status LED State Definitions
Operation | Color | Behavior | Description |
Restart | | | Reset or Wake-up from sleep |
| Yellow | One-Shot (1 sec) | RS485 interface successfully configured after reset/wake-up |
| Red | Blink (0.5 sec) | RS485 interface configuration failure |
PCless Racing | | | PM-to-PM racing |
| Yellow | One-Shot (20 msec) | Application message processing active on cable (RS485) or wireless (RF) interface |
| | One-Shot (0.5 sec) | Wireless (RF) interface configuration complete |
| Red | One-Shot (0.5 sec) | Wireless (RF) interface disable complete |
| | On | Wireless (RF) interface configuration failure |
Venue Racing | | | PC-to-PM racing |
| Yellow | One-Shot (20 msec) | Application message processing active on USB or cable (RS485) interface |
HR Belt | | | Suunto HR belt |
| Yellow | One-Shot (0.5 sec) | HR (RF) interface configuration complete |
| | Blink (1.0 sec) | Actively receiving HR data from belt |
| Red | One-Shot (0.5 sec) | HR (RF) interface disable complete |
| | On | HR (RF) interface configuration failure |
Cable Test | | | |
| Yellow | Blink (50 msec) | At least one error has occurred since the cable test was started, but the connection has returned |
| Red | One-Shot (0.5 sec) | Individual error event |
| | On | Connection lost after test start |
| Green | Blink (50 msec) | No errors |
| | Blink (0.2 sec) | Test signal source |
| | On | No connection |