Help RS232 Communication with Omnikey 5513 RFID

Hello,

I have a small problem with the COM communication with this device. Opening the port is not the problem. But sending successfull data :slight_smile:

here is the describtion : www.trider-net.de/TAGnology_UserManual_HF_MIFARE_Easy.pdf

page 22 - 27

This Omnikey has 2 possible transfer modes.

  1. ASCII. I dont know if it is possible. If yes how does it work?
  2. Binary communication (more difficult)

the frame looks like this :

STX = 0x02
Station ID = 0x01 (default)
Length = length of data
Data = Command + data
BCC = Block Check Character (BCC = ID XOR Length XOR data(0) XOR data(n))
ETX = 0x03

So my problem is in this binary command. I dont understand the example :

STX 02h
Station ID 64h
Length 01h
Data 78h = ‘x’
BCC 1Dh
ETX 03h

This example should do the following : “This instruction frame will reset the reader module with the station ID 64h.”

Currently i am not sending correct data to the omnikey. but he allways replys me a byte array with a sequence of 2 bytes : [96] [121]

Is this something special?

For example if i send ‘l’ to login i get this as response : [96] [121] [96] [121]
And after this 2 rs232 errors from the event with no data.

Is this something special?

I would be very glad if someone could help me. I am completly stuck…

Thanks,
Trider

I have just figured out some more parameters.

But the reply’s still strange. Especially the errors with no data inside.

The example i posted i have now understood (except the algorythem for the BCC, but i havent took a closer look there yet).

Especially the reply seems to be decimal… Or i encode something wrong. The raw data is [96] [121] like written above…

My first step in this case would be to plug a serial cable into a terminal program and see what you’re sending from the Fez, to see if it seems sensible. Basic tests to make sure you have baud rate etc set as expected.

The way I read this (and having NO experience with it other than opening that PDF) is that the example sends a Start (0x02) to station ID 0x64, one byte of data (0x01), with the command ‘x’ (0x78) with a data checksum of 0x1d, and then the End (0x03).

Output of [96][121] (I’m assuming you’re looking at this in debug mode in a watch?) is:

'y

What that means, great question! According to section 4.4.3.19 of the document, in ASCII mode you should get the MiFare response, or nothing in binary. What do your green and red LEDs tell you when you issue a command?

The other “easy” way to start working with a device like this is just connect it to your PC and use a terminal program to give it instructions and see what happens! Once you can get the V command to work, you know you’ve made some progress!

Thanks for your time.

I will try this out tomorrow, today i have no time (work).

The checksum is defined in article 4.2.5
It is called : BCC and gets build up like this :

BCC = ID XOR Length XOR data(0) XOR data(n)

I have never used XOR or shift operations in C#. Can someone give me a hand how this gets handled?

does the code look like this? :


byte bcc = ID | Length | data(0) | data(n);

//or like this :

byte bcc = ID & Length & data(0) & data(n);

I am new to operations like this…

Shift and bitwise operators are shown here with links to explanations of each…It would have helped if I actually included the link :-[

[url]Microsoft Learn: Build skills that open doors in your career

well,

google should be your friend, if you wanna be a programmer :slight_smile: (i mean me with this) :-[

sry for the question. First result :


a = a^c;

Sometimes i ask before i risk a long search, sry…