1
\$\begingroup\$

I bought an USB RFID reader/writer module from local store, it is not well known and branded, It connect to computer with USB port , and i want to write a program for it in Linux Ubuntu.

I find out (from CD with module) it use:

Silicon Laboratories CP210x USB to RS232 serial adaptor

I install the Driver from CD on Ubuntu and i compiled and run the example C++ file is in this link.

Now i want to send charachter message to it and receive proper massage from it but the example just send HEX value and if i put char in ioctl, it wont work, i tried this:

static const char HELLO3[] = "Howdy";
ret_val = ioctl(fd, HELLO3, &gpio);
cout << ret_val ;

It(ioctl) only get long unsigned int, I guess this integers should be in library but i don't know how to use them. How can i send massage to device and receive massage like response from it ?

The datasheet is not in English but it have some example for c# it is like :

serialport.writeline("W0abcdef65\r\n");

It mean write abcdef65 on Block 0 and it receive ‫‪Msg0000001‬‬ which means the command run perfectly. How can i get same functionality in C or C++ in Linux.

PS :

1-The library or driver is in the same folder as example link in github which i mentioned before.

2-The device works properly with the application carried with its package in Windows but i want to program it in Linux with C++ or C.

\$\endgroup\$
  • 1
    \$\begingroup\$ The C# example looks like it's accessing it as a serial port which makes sense because it's based on a USB to RS232 serial adapter. Rather than ioctl you probably should have a /dev/ttyUSBn port you could open with a terminal program for testing or access something like this: cmrr.umn.edu/~strupp/serial.html \$\endgroup\$ – PeterJ Aug 31 '15 at 11:34
  • \$\begingroup\$ @PeterJ thank you sir, the reference you mentioned is rather long, i'm going to read it and see whether it solve my issue. \$\endgroup\$ – chosipa Aug 31 '15 at 11:36
  • \$\begingroup\$ Definitely not on topic for EE. \$\endgroup\$ – Passerby Aug 31 '15 at 12:04
1
\$\begingroup\$

Read the readme files for the headers on Github Readme.Serial.

Although the interface connects to the serial port, it doesn't utilise the RS-232 serial protocol and instead I/O is performed with bit banging. Data output bits are sent through the DTR line and clocked on the falling edge of RTS.
The Tx line is utilised to enable the application of the high programming voltage on !MCLR/VPP and not for sending data bits.
Data input bits are read from the CTS line using the same clock as for output with the data output line taken high for correct circuit operation.

I guess you will have find another way.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.