Memory management and upload protocol


M210 device save notes in flash memory.

Each note contain note header and data (XY coordinates, Pen up)


Note structure description:


Note header: 14 Bytes.


Byte number

Byte description

7

6

5

4

3

2

1

0

1

Pointer to next note address

Low

2


3

High

4

Flags

Note open

Note closed

Note closed (software)

1

1

1

1

1

5

Note number


6

Total note number


7

Reserved


8

9

10

11

12

13

14



Note open:

0 – There is XY coordinates in this note.

1 – Empty note.


Note closed:

0 – The note closed by user or software.

1 – Note not closed.


Note closed (software):

0 – Note not closed by user.

1 – else.


Data:


XY coordinates: 4 Bytes

Byte number

Byte description

7

6

5

4

3

2

1

0

1

X coordinate

Low

2

High

3

Y coordinate

Low

4

High


Pen up: 4 Bytes


Byte number

Byte description

7

6

5

4

3

2

1

0

1

Pen up

0

0

0

0

0

0

0

0

2

0

0

0

0

0

0

0

0

3

0

0

0

0

0

0

0

0

4

1

0

0

0

0

0

0

0




Memory data structure example:


Note 1 header

XY

XY

XY

XY

….

Pen up

XY

XY


XY

Pen up

Note 2 header

XY

….

Pen up

Note N header






Remark:


1. The last note will be empty note and the pointer for next note = 0xFFFFFF

Upload:

Upload data from device memory.


Upload Sequence:


  1. Request start of upload


Host Device


Upload

Command

(1 Byte)

0xB5


  1. Device sends the number of data packets to host.


Device Host

Signature

(5 Bytes)

Number of packets

(2 Bytes)

Signature

(2 Bytes)

0xAA

0xAA

0xAA

0xAA

0xAA

High

Low

0x55

0x55


  1. Host sends an ACK for receiving the data packets or NACK for cancel upload to device.


Host Device


ACK

(1 Byte)

0xB6


NACK

(1 Byte)

0xB7


  1. Device sends upload data to host.


Device Host


Packet number

(2 Bytes)

Data

(62 Bytes)

N

Upload Data

High

Low

N – Sequence number, each packet gets a sequence number(starting with 1), e.g. the first packet gets sequence number 1, the second 2 etc..


Upload Data – Data of all notes (header and data) from memory.

e.g. packet number 1 will contain data form address 0 to 61 in the memory, packet number will contain data form address 62 to 123 in the memory etc.


  1. Packets retransmission.


Host Device


5.a. In case all packets have been received successfully, the host sends an ACK

response and the upload sequence is complete.


ACK

(1 Byte)

0xB6


5.b. In case some packets have been lost the host sends a NACK response with

the lost packet number.


NACK

(1 Byte)

Lost packet number

(2 Byte)

0xB7

X

High

Low

X – Lost packet number.


  1. Device send the lost packet to host (return to stage 5).


Device Host


Packet number

(2 Bytes)

Data

(62 Bytes)

X

Upload Data

High

Low

X – Lost packet number.