You are on page 1of 16

Communikation ECG-Loop_Event Prod

Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

Content:
1 Purpose ............................................................................................................... 3
2 Application ........................................................................................................... 3
3 Description .......................................................................................................... 3
3.1 Parameter: ................................................................................................... 3
3.2 Synchronisation: ........................................................................................... 3
3.3 Communication block: .................................................................................. 3
3.4 Checksum: ................................................................................................... 4
4 Commands: ......................................................................................................... 5
4.5 Time/Date..................................................................................................... 5
4.5.1 Set time/date ......................................................................................... 5
4.5.2 Read time/date ...................................................................................... 5
4.6 Tests ............................................................................................................ 6
4.6.1 Buzzers test .......................................................................................... 6
4.6.2 Battery Voltage...................................................................................... 6
4.6.3 Firmware Version .................................................................................. 6
4.7 Patient Keys ................................................................................................. 6
4.7.1 Programming patient keys .................................................................... 6
4.7.2 Read patient keys ................................................................................. 6
4.8 Serialnumber ................................................................................................ 7
4.8.1 Set serialnumber ................................................................................... 7
4.8.2 Read serialnumber ................................................................................ 7
4.9 Boardnumber ............................................................................................... 7
4.9.1 Set Boardnumber .................................................................................. 7
4.9.2 Read Boardnumber ............................................................................... 7
4.10 Bluetooth Settings ........................................................................................ 8
4.10.1 Set Bluetooth_Pin ................................................................................. 8
4.10.2 Read Bluetooth _Pin ............................................................................. 8
4.10.3 Set Bluetooth_Config ............................................................................ 8
4.10.4 Read Bluetooth _Config ........................................................................ 8
4.10.5 Set Gateway Name ............................................................................... 8
4.10.6 Read Gateway Name ............................................................................ 8

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 1 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4.11.1 Set GPRS APN ..................................................................................... 9


4.11.2 Read GPRS APN .................................................................................. 9
4.11.3 Set GPRS Name ................................................................................... 9
4.11.4 Read GPRS Name ................................................................................ 9
4.11.5 Set GPRS Password ............................................................................. 9
4.11.6 Read GPRS Password .......................................................................... 9
4.11.7 Set GPRS DNS ................................................................................... 10
4.11.8 Read GPRS DNS ................................................................................ 10
4.11.9 Set GPRS Pin ..................................................................................... 10
4.11.10 Read GPRS Pin............................................................................... 10
4.11.11 Set GPRS Port ................................................................................ 10
4.11.12 Read GPRS Port ............................................................................. 10
4.11.13 Set GPRS IP.................................................................................... 10
4.11.14 Read GPRS IP ................................................................................ 10
4.12 Make EKG Setting ...................................................................................... 11
4.13 Read History Table Counter ....................................................................... 12
4.14 Read complete History Table ..................................................................... 12
4.15 Read History Table..................................................................................... 12
4.15.1 Read all items ..................................................................................... 12
4.15.2 Read only measurement items ........................................................... 12
4.16 UpdateEkgHistory ...................................................................................... 13
4.17 Read number of measurements ................................................................. 13
4.18 Erase all measurements ............................................................................ 13
4.19 Read Ekg ................................................................................................... 14
4.20 Set Measurements times and sending options .......................................... 15
4.21 Read Measurements times and sending options ....................................... 15
5 List of errors / codes .......................................................................................... 16
5.1 Codes ......................................................................................................... 16
5.2 Errors ......................................................................................................... 16

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 2 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

1 Purpose
This document describes the communication interface for the I.E.M ECG Loop-Event
Recorder.

2 Application
It is described how data has to be handled between the PC and the Loop-Event
Recorder. The data is transferred using a Bluetooth dongle connected to the PC.

Note: All numbers mentioned in this Transmission Protocol are decimal numbers.

3 Description
The Loop-Event Recorder will be named as LER in the rest of the document.

3.1 Parameter:
115200 baud, 1 startbit, 1 stopbit, no parity

3.2 Synchronisation:
PC sends 5, ENQ LER returns 6, ACK

3.3 Communication block:


A communication block consists of 25 bytes with the following construction:

1. Start byte always = 2, STX


2. Command byte
3.
bis Data bytes
23.
24. checksum of bytes 2 to 23
25. End byte always = 3, ETX

Any communication block which was received by the LER correctly, is confirmed by
6, ACK, in case of transmission errors, the LER will returned 21, NAK.
The return of ACK does only mean the block was received correctly NOT that the
command could be executed by the LER in the correct way!

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 3 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

3.4 Checksum:
The checksum is calculated by addition of the command byte and all data bytes. This
simply can be done by the following function:

#define BLOCK_SIZE 25

static unsigned char CheckSum( unsigned char *Buffer) {


//======================================================
// relevant bytes : 2. - 23.

int i;
unsigned char Check; //checksum
Check=0;
for (i=1; i<(BLOCK_SIZE-2); Check += Buffer[i++]) ;
return Check;
}

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 4 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4 Commands:
Syntax : <z> represents a comunication block with command byte z!

4.5 Time/Date

4.5.1 Set time/date


PC sends <41> or <141> with
1. data byte = hour
2. data byte = minute
3. data byte = second
4. data byte = day
5. data byte = month
6. data byte = year -2000

4.5.2 Read time/date


PC sends <27> or <127>
LER sends <27> with
1-5. data byte: time/date
1. data byte = year mod 100
2. data byte = month
3. data byte = day
4. data byte = hour
5. data byte = minute

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 5 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4.6 Tests

4.6.1 Buzzers test


PC sends <56> or <156>
LER switches the buzzer on briefly.

4.6.2 Battery Voltage


PC sends <51> or <151>
LER answers <53> with
1. data byte = high byte of battery voltage in mV
2. data byte = low byte of battery voltage in mV

4.6.3 Firmware Version


PC sends 60> or <160>
LER sends <61> mit
1. - 21. data bytes: version (ASCII-charaters)

4.7 Patient Keys

4.7.1 Programming patient keys


PC sends < 21 > or < 121 > and the patient key (15 ASCII characters) in the first 15
data bytes.

4.7.2 Read patient keys


PC sends <22> or <122>
LER answers with < 22 > and the current patient key (15-ASCII characters) in the
first 15 data bytes

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 6 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4.8 Serialnumber

4.8.1 Set serialnumber


PC sends <23> or <123> and 15 byte serialnumber in the first data bytes
15 byte ASCII + 1 byte CRC

4.8.2 Read serialnumber


PC sends <24> or <124>
LER answers <24>
And 15 byte serialnumber in the first data bytes
15 byte ASCII + 1 byte CRC

4.9 Boardnumber

4.9.1 Set Boardnumber


PC sends <125> and 15 byte Boardnumber in the first data bytes
15 byte ASCII + 1 byte CRC

4.9.2 Read Boardnumber

PC sends <126>
LER answers <126>
And 15 byte Boardnumber in the first data bytes
15 byte ASCII + 1 byte CRC

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 7 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4.10 Bluetooth Settings


ALL data bytes represent ASCII values.

4.10.1Set Bluetooth_Pin

PC sends <235> and Pin in the data bytes

4.10.2Read Bluetooth _Pin

PC sends <236>
LER answers <236>
And Bluetooth Pin in the data bytes

4.10.3Set Bluetooth_Config

PC sends <237> and Config byte in the first data byte

BIT0: passive pairing if set to 1


BIT1: passive connection if set to 1
BIT2: SPP profile if set to 1
BIT3 to 7: not used

4.10.4Read Bluetooth _Config

PC sends <238>
LER answers <238>
And Bluetooth Config byte in the first data byte

4.10.5Set Gateway Name

PC sends <239> and Name in the data bytes

4.10.6Read Gateway Name

PC sends <240>
LER answers <240>
And Bluetooth gateway name in the data bytes

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 8 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4.11 GPRS Settings


ALL data bytes represent ASCII values.

4.11.1Set GPRS APN

PC sends <241> and APN in the data bytes

4.11.2Read GPRS APN

PC sends <242>
LER answers <242>
And GPRS APN in the data bytes

4.11.3Set GPRS Name

PC sends <243> and Name in the data bytes

4.11.4Read GPRS Name

PC sends <244>
LER answers <244>
And GPRS Name in the data bytes

4.11.5Set GPRS Password

PC sends <245> and Password in the data bytes

4.11.6Read GPRS Password

PC sends <246>
LER answers <246>
And GPRS Password in the data bytes

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 9 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4.11.7Set GPRS DNS

PC sends <247> and DNS in the data bytes

4.11.8Read GPRS DNS

PC sends <248>
LER answers <248>
And GPRS DNS in the data bytes

4.11.9Set GPRS Pin

PC sends <249> and Pin in the data bytes

4.11.10 Read GPRS Pin

PC sends <250>
LER answers <250>
And GPRS Pin in the data bytes

4.11.11 Set GPRS Port

PC sends <251> and Port in the data bytes

4.11.12 Read GPRS Port


PC sends <252>
LER answers <252>
And GPRS Port in the data bytes

4.11.13 Set GPRS IP

PC sends <253> and IP in the data bytes

4.11.14 Read GPRS IP


PC sends <254>
LER answers <254>
And GPRS IP in the data bytes

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 10 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4.12 Make ECG Setting


PC sends <105>
LER answers <104> with one block of 25 bytes with
11. data byte = error number
12. data byte = battery voltage in mV/20

Without error LER sends ECG data in consecutive afterwards.


1. data byte = channel 1 low byte
2. data byte = channel 1 high byte
3. data byte = channel 2 low byte
4. data byte = channel 2 high byte

Each channel represents a 12 bit ADC value. (0 to 4095)

The highest nibble of each channel contains the channel flag in highest bit.

The channel flag is located in bit 15: 0 marks channel 1 and 1 marks channel 2.

The channel values represent the signal in upside down direction.


Each value is an 12 bit ADC value with a voltage reference of 3,3 Volt and a gain of
1010.

Signal voltage = (ADC * 3300 / 4095)/1010

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 11 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4.13 Read History Table Counter

PC sends <07> or <113>


LER answers <113> with the number of items in databyte 1.

4.14 Read complete History Table

Every errors, Event/Loop measurements or erasing of measurements are stored in a


history table permanently. The table can include 0 to 147 items consisting of 7 bytes
each.
Each entry will be send in a complete 25 byte block.

This table can be read out by the following command:

PC sends <08< or <114>


LER answers <114> and

databytes 0 to 3: date/time, low to high byte


databyte 4: code: see erro codes in the last chapter
databyte 5: pretime in seconds
databyte 6: posttime in seconds

4.15 Read History Table


This commands reads only the History Table until an erasing of measurement was
stored. The result is the number of items after the last device preparation.

4.15.1 Read all items


All items including errors can be read out:
PC sends <06> or <112> with <0> in the first databyte
LER sends <112> with data like described in 4.15.

4.15.2Read only measurement items


Only Loop/Event items will be send.
PC sends <06> or <112> with <1> in the first databyte
LER sends <112> with data like described in 4.15.

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 12 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4.16 UpdateECGHistory
PC sends <10> or <116> with the number of the measurement in the first databyte
different from 0!
The measurement will be marked as sent via Bluetooth. Code 100 indicates Loop
and Code 200 indicates Event.

4.17 Read number of measurements


PC sends <03> or <102>
LER sends <103> with number of stored measurments in the first two databytes.
Order high-low byte!

4.18 Erase all measurements


PC sends <225>
LER answers <06>

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 13 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4.19 Read ECG


PC sends <04> or <104> with the number of the desired measurement in the first
databyte different from 0!

LER sends <90> followed by 4 bytes time/date low to high byte.

The next bytes are as following:


Absolute value Channel 2, 2 Bytes

Data BYTE 0 Channel CRC CRC CRC BIT11 BIT10 BIT9 BIT8
Data BYTE 1 BIT7 BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0

CRC = (BIT7 BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0) XOR (BIT11 BIT10 BIT9 BIT8)
CRC = (CRC High Nibble) XOR (CRC Low Nibble)

Absolute value Channel 1, 2 Bytes

Data BYTE 2 Channel CRC CRC CRC BIT11 BIT10 BIT9 BIT8
Data BYTE 3 BIT7 BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0

CRC = (BIT7 BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0) XOR (BIT11 BIT10 BIT9 BIT8)
CRC = (CRC High Nibble) XOR (CRC Low Nibble)
CRC = CRC AND (BIT2 BIT1 BIT0)

Each channel represents a 12 bit ADC value. (0 to 4095)


The highest bit of each channel contains the channel flag.
1 = Channel 2, 0 = Channel 1
The channel values represent the signal in upside down direction!
Each value is an 12 bit ADC value with a voltage reference of 3,3 Volt and a gain of
1010.
Signal voltage = (ADC * 3300 / 4095)/1010

Difference Values, 3 Bytes: K1=Channel 1, K2=Channel 2, VZ=Prefix, 1 = (-), 0 = (+)

Data BYTE 4 VZ K2 VZ K1 CRC CRC BIT9 K2 BIT8 K2 BIT7 K2 BIT6 K2


Data BYTE 5 BIT5 K2 BIT4 K2 BIT3 K2 BIT2 K2 BIT1 K2 BIT0 K2 BIT9 K1 BIT8 K1
Data BYTE 6 BIT7 K1 BIT6 K1 BIT5 K1 BIT4 K1 BIT3 K1 BIT2 K1 BIT1 K1 BIT0 K1
[] until number of points was sent

CRC (K1) = (K1) BIT7 BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0) XOR (BIT9 BIT8)
CRC (K2) = (K2) BIT7 BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0) XOR (BIT9 BIT8)
CRC = CRC (K1) XOR CRC (K2)
CRC = CRC AND (BIT1 BIT0)

Difference values to previous point in consecutive until number of points of ECG


have been sent.

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 14 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

4.20 Set Measurements times and sending options


PC sends <86> with
Databyte 1: Loop Pretime
Databyte 2: Loop Posttime
Databyte 3: Event Time
Databyte 4: BIT 0 : Loop, BIT 1 Event
If Bit is set, Bluetooth will be switched on automatically

LER answers <06>

4.21 Read Measurements times and sending options


PC sends <87>

LER answers <87> with

Databyte 1: Loop Pretime


Databyte 2: Loop Posttime
Databyte 3: Event Time
Databyte 4: BIT 0 : Loop, BIT 1 Event
If Bit is set, Bluetooth will be switched on automatically

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 15 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09
Communikation ECG-Loop_Event Prod
Product Name:
Autor: Harald Eer
ECG-Loop-Event-Recorder

5 List of errors / codes

5.1 Codes

LOOP_SENT 100
LOOP 101

EVENT_SENT 200
EVENT 201

DELETED 202

5.2 Errors

ERR_POSITIONING 1
ERR_LEADS_OFF 2

ERR_BATT_LOW 10

bad configuration / preparation


ERR_NO_FLASH_SPACE 20
ERR_NO_KONFIG 21

Hardware error
ERR_WRITE_START_DATA 70
ERR_WRITE_EKG_TIME 71
ERR_WRITE_PUFFER2FLASH 72
ERR_STORE_HIST_DATA 73
ERR_RAM_WRITE 74
ERR_RAM_READ 75
ERR_RAM_START 76
ERR_FLASH_START 77
ERR_FLASH_READ 78
ERR_FLASH_WRITE 79

File: EKG_LoopEventRecorder_Communication_Prod_1.0 Created: 18.02.14


Page 16 of 15 I.E.M. GmbH Cockerillstr. 69, D-52222 Stolberg, Germany Last Rev.: 23.03.09

You might also like