Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem reading output from device #2

Closed
jakubgondek opened this issue Oct 5, 2016 · 14 comments
Closed

Problem reading output from device #2

jakubgondek opened this issue Oct 5, 2016 · 14 comments

Comments

@jakubgondek
Copy link

My device is based on USB-COM converter by FTDI CHip. Maker of the device (our inhouse electronics guy) assured me, that on command "@rel#1@" device should respond with "@rel#ON@", but nothing comes out of library. When sending "@rel#1@" the device does what it's supposed. How can I know what's the problem? Is there any other way, to recieve data from the device with the library?

@dwilches
Copy link
Owner

dwilches commented Oct 5, 2016

Have you tried with Putty to debug the communications protocol?
If in Putty your device responds with "@rel#ON@" but not with SerialCommUnity, then it may be your device doesn't respond with a newline at the end of the response. Could you check if it is that?

@jakubgondek
Copy link
Author

I'm quite new to the hardware layer :) I tried connecting to the device with Putty, but nothing happens. there is no prompt. When I set the wrong COM port, Putty says it cannot connect, but when I enter the correct one nothing happens.

@dwilches
Copy link
Owner

dwilches commented Oct 5, 2016

There will be no prompt, it doesn't work exactly as when you use Putty to connect to a Linux server where a shell welcomes you.
In the case of COM ports, it will show an empty screen once connected, and everything you type in there will be forwarded to the COM port. So just go ahead and start typing your command.
You will find out if you need to pass a newline or not, and how the returned data looks.

@jakubgondek
Copy link
Author

Nothing happens when I write my command "@rel#1@", the device doesn't respond, nor behave like it should.

@dwilches
Copy link
Owner

dwilches commented Oct 5, 2016

If you selected "Serial" as the "Connection type" in Putty, and are using the correct COM port, then the problem may be the command you are sending. You may check the manual for that device to know what it actually expects, it may be it expects a new line at the end, a null character, or to have a prefix before sending the message.

@jakubgondek
Copy link
Author

Putty is sending diffrent line endings than the one that my device is expecting, so it's not processing my messages. I don't have the time to diagnose it more - it's not key feature of my app :)

@dwilches
Copy link
Owner

OK, if you later need it, in Putty you can press Ctrl+J to send a line-feed, and Ctrl+M for a carriage return. So instead of pressing the ENTER key, you make any combination of those two.

@jakubgondek
Copy link
Author

I'm trying to use SerialComm to retrieve data from barcode scanner. When I connect to it via Putty and scan a barcode the code appears on the screen. When I use included JustRead example, app succesfully connects to the device, but after scanning nothing shows up. What might be the problem? I'm using Datalogic Quickscan QD2430.

@dwilches
Copy link
Owner

Hi Jakub,

The Unity part of SerialCommUnity needs a '\n' at the end of each message your hardware sends, it's with that line terminator that it decides where a message ends. Are you sure your hardware is sending that? If not, then the code that reads from the COM port in Unity needs to be changed so it knows when a message ends.

That's the first reason I could think on top of my head about why the library doesn't work with your hardware.

You mentioned a JustRead example, is that an example for your specific hardware? I couldn't find it online to take a look to that device's protocol.

@jakubgondek
Copy link
Author

You were right. It was all about the line terminator. I found this example:
https://code.msdn.microsoft.com/windowsdesktop/SerialPort-brief-Example-ac0d5004#content
with reading data by bytes and the data is read but it waits for the terminator to dispatch. Probably that was also the case with my previous question. By JustRead example I meant DemoSceneUserPoll_JustRead scene you provided.

@dwilches
Copy link
Owner

OK, in that case, it is all about changing the line of the library how to detect an end-of-message. For some devices, all messages are of a fixed length; in others, there is special char terminating the message (like a '#', '.', '\n', etc.).

@Salma175
Copy link

Salma175 commented Jul 4, 2017

I was able to send data to my USB Based Micro controller (Maple Mini) but can not receive data from it . Tested with the Demo scene DemoScene_AutoPoll from the package . Tested it on putty and it works fine was able to log the data recieved from Port .

@Salma175
Copy link

Salma175 commented Jul 4, 2017

Hey thanks solved it be enabling DtrEnabled flag .. which is by default set to false :-)

@dwilches
Copy link
Owner

dwilches commented Jul 4, 2017

Good to hear it's working :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants