PDA

View Full Version : Serial out packaging issue....?



Ollie
04-25-2006, 01:04 AM
I am trying to send the following hex data as a command to a RFID reader: 01 0b 00 03 04 62 00 00 00 6f 90
I'm using the bs2
I've tried sending it as:

serout so, baud, ($01, $0b......

I'm not getting a response from the RFID reader...?

Any ideas?

Thanks, Ollie

Jon Williams
04-25-2006, 01:08 AM
Does the reader want the bytes as hex text? (not likely) Do you have the correct baud setting? (the most likely problem) It would be helpful to know the model of the device you're attempting to connect to and a link to technical data for it, otherwise everything you get will be educated guesses.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

Ollie
04-25-2006, 01:22 AM
The reader is a TI MFR S4100. The packet that I'm sending it is listed in TI's 15693 standard as a slotted inventory request. TI won't give any support because I'm interfacing with the BS. A link to the pdf from TI is:[url]http://www.ti.com/rfid/docs/manuals/refmanuals/RF-MGR-MNMN-15693-refGuide.pdf

page 21 is where the specific packet info is we are using....

allanlane5
04-25-2006, 01:44 AM
First question -- okay, what platform WILL TI provide support for?

If it's a PC with a serial port, get the thing working that way with TI's help, then port it to a BS2 without their help.

Second question: Why didn't you use the "01 0B 00 03 04 62 01 00 00 6E 91" from the example?
·

Jon Williams
04-25-2006, 01:56 AM
I don't think the packet is the issue, I think your baud value probably is. What baud rate/mode are you using? In another doc it's clear that the serial is TTL level, so you should be using TRUE mode. That same doc says it can go up to 38.4 kbaud, but it also mentions auto-synchronization (auto-baud?) -- though I couldn't find any other details. Also, are you connected to the correct pins and have a common ground between the Stamp and the module?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

Ollie
04-25-2006, 02:22 AM
I have the following code to send the packet out and then once received properly I will add code later.

RX pin 6
TX pin 7

BAUD con 84

cmd var byte


Main:

DO

serout TX, BAUD, [$01,$0b,$00,$03,$04,$62,$01,$00,$00,$00,$6E,$90] <------ This packet is for a slotted inventory request. page 20 of above mentioned link.
debug "sent"
Pause 2000
serin RX, BAUD, [cmd] <----- never receive response from TI RFID READER
debug HEX ? cmd <------- Just to see the value
LOOP

END

allanlane5
04-25-2006, 02:36 AM
You REALLY don't want that "Pause 2000" in there, nor the "send" output before the SERIN. The BS2 is not "Listening" for a response UNTIL you enter the "SERIN" command. Thus, your current code will drop any response returned to you in the 2 seconds that you're "not listening".

Now, you might give the SERIN command a 2 second timeout.

Just remember, the BS2 has NO UART buffer of any kind. It can ONLY recieve 232 when the code is sitting in a SERIN statement, waiting for it.

Ollie
04-25-2006, 03:12 AM
We have code written in VB that works with this reader and it looks like from a text box it take the "package hex value" and converts it to a binary string and sends that to the reader and then it looks like the vb code gets in a binary string and re converts it back to hex and displays that to the screen.

I am not a huge VB guy but it seems we have to send our hex out as a binary string.
value = %convertedValue <------ value eqaul to hex [$01,$0b,$00,$03,$04,$62,$01,$00,$00,$00,$6E,$90]

serout TX,BAUD,[value]

allanlane5
04-25-2006, 03:20 AM
Now, for the serin, you probably want something like:

Resp VAR BYTE(6)

SEROUT SerPin, baudmode, [$01,$0b,$00,$03,$04,$62,$01,$00,$00,$00,$6E,$90]

SERIN SerPin2, baudmode, [STR Resp\6]

And make sure you enter the SERIN immediately.

then you can print:

FOR I = 0 to 5
· DEBUG ? Hex Resp(I)
NEXT
DEBUG 13
·

Ollie
04-25-2006, 03:54 AM
When we write

serout· TX,BAUD,[$01,$0b,$00,$03,$04,$62,$01,$00,$00,$00,$6E,$90]

what or how are these hex values getting sent?· Meaning does basic stamp convert them into binary, ascii or what?

With the following code we are stopped on the SERIN command waiting for some serial data.



·SEROUT· so, baud, [$01,$0b,$00,$03,$04,$62,$01,$00,$00,$00,$6E,$90]·· <---- still think·how we are sending this data is the·issue.···························· 1
··· SERIN·· si, baud, [STR Resp\6]
··· FOR I = 0 TO 5
····· DEBUG ? HEX Resp(I)·· <-------·DOES NOT WORK HERE
····· NEXT
···· DEBUG 13· <---- what was this debug for that you put here?

allanlane5
04-25-2006, 04:17 AM
Hmm. Well, you COULD serin a single value, just to see if you're getting something.

The "DEBUG 13" was to insert a carriage return in your output.

And the result of your SEROUT would be the byte value for 1, the byte value for $0b, the byte value for $00, etc.
In other words, it would match what the spec is requesting.

The various "HEX" or "DEC" modfiers take the value and convert it into the String version of itself.

So, SEROUT .... [13] will output a CR character.
SEROUT ... [DEC 13] will output the string "13".

You might single-step the VB version to determine what EXACTLY (including checksum) is being sent by the program. It's also possible the device is returning data to you so fast that the SERIN misses the first character.

Ollie
04-25-2006, 04:26 AM
THanks a bunch the final code works below. You were a huge help.

SEROUT so, baud, [$01,$0b,$00,$03,$04,$62,$00,$00,$00,$6F,$90]
SERIN si, baud, [STR Resp\9]
FOR x = 0 TO 8
DEBUG HEX ? Resp(x)
NEXT
DEBUG 13

Chris Savage
04-25-2006, 08:36 AM
Ollie said...(trimmed)
When we write
serout· TX,BAUD,[$01,$0b,$00,$03,$04,$62,$01,$00,$00,$00,$6E,$90]
what or how are these hex values getting sent?· Meaning does basic stamp convert them into binary, ascii or what?
This question comes up a lot...The data is stored in binary no matter what.· That is the only language the BASIC Stamp (or any microcontroller for that matter) understands.· The way you choose to express it (Binary, Hex or Decimal) does not change how it is stored.· So sending %00000001, $01 or 1 is always going to send the same data.· In this case, a binary 1.· Now if you needed an ASCII 1 (one) then you would use the DEC formatter.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

Tom Walker
04-25-2006, 08:28 PM
...and if it helps you to visualize things, think about the physical way that data is sent...a typical serial digital communication scheme can only impose a high (+5, +12, mark, etc) or a low (0, -12, space, etc). How would something like "5" be sent WITHOUT using "binary".

Remember, EVERYTHING in the digital world is only 1s and 0s. Microprocessors, themseves, can be thought of as streams with "gates" that direct the flows of 1s and 0s (sorry for the over-simplification, Chip, but my analogy generator is on the fritz). Anything else you see (even programs) is just a presentation of those 1s and 0s that makes more sense to our brains...

I need sleep...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...

allanlane5
04-26-2006, 02:09 AM
Yay! I always love it when people figure out their problems.