Controlling RFID reader.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Controlling RFID reader.

iceyj21
Hello, I’m currently having major issues trying to control a RFID reader through octave using serial communication. I know how to do some serial communication, as I’ve done it with an arduino before but now when trying to send data to the RFID reader I’m having issues. I know that srl_write() sends strings but i need it to be in hex as that is what the rfid reader accepts as commands.


http://www.phychips.com/wp-content/uploads/2016/06/RED_RCP_20160513.pdf This is the guide for the rfid reader as some reference. Im trying to command it to go into auto read mode 2.


Thank you.

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Controlling RFID reader.

Doug Stewart-4


On Tue, Jun 20, 2017 at 3:50 AM, Joe Rodrigues <[hidden email]> wrote:
Hello, I’m currently having major issues trying to control a RFID reader through octave using serial communication. I know how to do some serial communication, as I’ve done it with an arduino before but now when trying to send data to the RFID reader I’m having issues. I know that srl_write() sends strings but i need it to be in hex as that is what the rfid reader accepts as commands.


http://www.phychips.com/wp-content/uploads/2016/06/RED_RCP_20160513.pdf This is the guide for the rfid reader as some reference. Im trying to command it to go into auto read mode 2.


Thank you.



Can you show us what you tried? 
--
DASCertificate for 206392


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Controlling RFID reader.

Kire Pudsje


On Tue, Jun 20, 2017 at 4:08 PM, Doug Stewart <[hidden email]> wrote:



On Tue, Jun 20, 2017 at 3:50 AM, Joe Rodrigues <[hidden email]> wrote:
Hello, I’m currently having major issues trying to control a RFID reader through octave using serial communication. I know how to do some serial communication, as I’ve done it with an arduino before but now when trying to send data to the RFID reader I’m having issues. I know that srl_write() sends strings but i need it to be in hex as that is what the rfid reader accepts as commands.


http://www.phychips.com/wp-content/uploads/2016/06/RED_RCP_20160513.pdf This is the guide for the rfid reader as some reference. Im trying to command it to go into auto read mode 2.


Thank you.

Are you sure that you need to send hex data?
From a quick look, although the examples are presented in hex, the data needs to be send as binary data.
The set reader power mode command:
msg = hex2dec(['bb';'00';'01';'00';'01';'00';'7e']);
crcmsg = add_crc16(msg);
srl_write(serial, char(crcmsg));

the add_crc16 function you have to write yourself.

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Controlling RFID reader.

iceyj21
In reply to this post by Doug Stewart-4
Heres my current code. its sending properly to the reader and the reader is scanning tags, the issue now is getting octave to read the output from the reader. using CuteCom i was able to check and make sure the reader actually has an output, and it does. So the issue is receiving that output with octave.


clc;
clear;

s3 = serial("/dev/cu.SLAB_USBtoUART",115200,2);
set(s3, "dataterminalready", "off");
set(s3, "requesttosend", "off");


tag = [];



pkt = [0xBB, 0x00, 0x08, 0x00, 0x00, 0x7E, 0x0B, 0x96];

auto_read = [0xBB,0x00,0x38,0x00,0x05,0x02,0x00,0x00,0x00,0x00,0x7E,0x51,0x7A];






i=1;
j=1;
k=1;
while (i<9)


srl_write(s3,uint8(pkt(i)));

i = i+1;
srl_flush(s3);
endwhile
pause(1);
while (j<14)


srl_write(s3,uint8(auto_read(j)));

j = j+1;
srl_flush(s3);
endwhile  

disp(pkt);

disp(auto_read);

pause(2);
while (k<52)
[tag(k)] = srl_read(s3,1000000);
k++;
endwhile
srl_flush(s3);
tag_hex = dec2hex(tag,52);
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Controlling RFID reader.

iceyj21
and here is the output of that


  187     0     8     0     0   126    11   150
   187     0    56     0     5     2     0     0     0     0   126    81   122
error: rfidv0: A(I) = X: X must have the same size as I
error: called from
    rfidv0 at line 49 column 9
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Controlling RFID reader.

Doug Stewart-4


On Thu, Jun 22, 2017 at 3:45 AM, iceyj21 <[hidden email]> wrote:
and here is the output of that


  187     0     8     0     0   126    11   150
   187     0    56     0     5     2     0     0     0     0   126    81
122
error: rfidv0: A(I) = X: X must have the same size as I
error: called from
    rfidv0 at line 49 column 9


-- 
What is the code on line 49??
DAS


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Controlling RFID reader.

iceyj21
The code is : [tag(k)] = srl_read(s3,1000000);

what I'm trying to do here is add each value read to an array. so it'll be in the same form as the data written; pkt or auto_read
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Controlling RFID reader.

Doug Stewart-4


On Thu, Jun 22, 2017 at 4:34 AM, iceyj21 <[hidden email]> wrote:
The code is : [tag(k)] = srl_read(s3,1000000);

what I'm trying to do here is add each value read to an array. so it'll be
in the same form as the data written; pkt or auto_read



to help you debug this try changing:

this
 [tag(k)] = srl_read(s3,1000000);
to this:
 srl_read(s3,1000000)

and see what shows up on the screen.
It might be reading more than 1 number at a time.


--
DAS


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Controlling RFID reader.

iceyj21
ans = [](1x0)

this is the output its giving. So its not receiving any data when trying to read.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Controlling RFID reader.

Andreas Weber-6
Am 22.06.2017 um 10:48 schrieb iceyj21:
> ans = [](1x0)
> this is the output its giving. So its not receiving any data when trying to
> read.

You don't have to loop over an vector to send it with srl_write. Just do

srl_write(s3,uint8(pkt));

Same for srl_read which reads until the given chars are received (most
of the time you'll know how much bytes will be in the answer) or a
timeout occours.

For this basic debugging I suggest you make a hardware loopback between
RX and TX:
Disconnect your reader from the SUB-D 9-pol and make a wire connection
between pin 2 and 3.

If your octave code is fine you'll now receive the same bytes as sended.
When this works reattach your RFID reader...

-- Andy

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Loading...