LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   windows application -> dial in -> linux embedded -> rs485 -> external device (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/windows-application-dial-in-linux-embedded-rs485-external-device-791258/)

Hark28 02-24-2010 08:40 AM

windows application -> dial in -> linux embedded -> rs485 -> external device
 
Dear forum members,

i'm new to this forum and also beginner if it comes to linux. What i want to achieve is the following:

Currently i'm trying to establish a connection between a windows application and a linux embedded computer connected to a external rs485 device. The external rs485 device, an energy meter, needs to be read out by the windows application.
The embedded computer has an internal modem ttyM2 and two rs485 ports ttyM0 and ttyM1.
Current status is that i have established connection from the application to the embedded computer. I added a command line in /etc/inittab to accept the incoming call -> 1:123:respawn:/sbin/getty –I “ATS0=1” 115200 ttyM2 vt100
When i'm dialing in the internal modem of the embedded computer answers the call and then i have connection.
The following task is to connect the internal modem with the rs485 device to read out the energy meter.
Is it possible to make some sort of symbolic link of the modem serial port with the external rs485 port?
Can somebody put me on the right way to achieve this?

Looking forward for any suggestions.

Mark

smoker 02-25-2010 07:21 AM

You can get the embedded computer to read the data from the meter first. Then you can manipulate the data so that the windows computer can access it. Or, once you have a connection, you can send commands to access data on the embedded computer, or access ports that are linked to the meter.

Mainly you need to understand the input/output interface that the meter provides. Without that you are fishing. Has it got a manual ?

michaelk 02-25-2010 08:24 AM

Did you write the windows application or is it something you purchased i.e. came with the energy meter?

Hark28 02-25-2010 09:33 AM

The windows application comes with the energy meter. With this application i can call to the embedded computer and make a connection. Only now i need to make some sort of route from internal modem to external rs485 port.

michaelk 02-25-2010 09:39 AM

As smoker suggested you need to know how the application communicates with the meter.

smoker 02-25-2010 10:25 AM

1)Was the embedded computer something that came with the meter ?
2)Why are you doing things this way ?
3)Can't you connect the windows computer directly to the meter ?

If (1) is true, then they must have given you some protocols to communicate with.

Are you trying to set it up to access remotely on a phoneline ?

Have you got a web link for the meter manufacturer/provider ?

Hark28 02-26-2010 01:55 AM

Smoker,

1) The embedded computer did not came with the meter;
2) The embedded computer has more funcionalities then the existing modem;
3) No i can't connect it directly to windows;

Maybe my description was not completly clear.

The standard situation is as follows:
- windows application (from meter manufacturer);
- energymeter;
- modem for energy meter (modem is special for this meter);

Custom situation:
So what i want is to replace the existing modem that comes with the energy meter with the embedded computer that has an internal modem and external rs232/rs485 port.
The energy meter has a external rs485 port because, in the standard situation, you can connect multiple meters on this bus and read them out with one modem.

smoker 02-26-2010 05:42 AM

You still need to find out what the API is for accessing the meter. The windows software obviously knows it, but you need to find out what commands it responds to.

Have you got a web link for the meter ?

If so, then maybe I can dig something up.
If you have and you keep it quiet, I don't know what to look for.

schneidz 02-26-2010 10:58 AM

assumming that the windows software is not open source, there is no easy way to mimic that functionality in linux.
is it possible to cat the serial port that the meter is connecting to and od dump/ grep that info to a text file ?

we can worry about windows later but i would imagine it would be like transferring that text file to windows and using it as input to your energy meter software.

smoker 02-26-2010 04:10 PM

I would have thought that there has to be some input to the meter to make it start transmitting data.
It doesn't just "know" when to output some data, it has to be queried. The windows software dials up the modem and the modem passes the commands through to the meter, and the meter responds. But what are those commands ? How is the meter storing the data ?


I suggest you get something like this http://www.analogx.com/CONTENTS/down...twork/pmon.htm
and capture all the data that's passed by the software when you have connected the meter to its normal modem.
Once you have an idea what's happening, you can duplicate it on the linux board.

Hark28 02-28-2010 03:42 AM

1 Attachment(s)
Thanks for the great response guys.

I can't check it at the moment, but I did this cat of the serial port before on which i could see what the program was sending. The communication protocol is dlms and the commands are as in the attachment.

When i did "cat /dev/ttyM2" (modem) i could see that the windows program was sending the request message.

michaelk 02-28-2010 06:22 AM

It appears that it is basic command response except for maybe programming so all you are doing is repeating incomming messages to the other port. It would be possible to add some message error checking. What special functionality do you want to accomplish with the embedded computer?

Hark28 03-01-2010 07:26 AM

Oke that sounds good!
So is there a way to just connect the internal modem port with the external serial port? Isn't there a standard setup for this?

smoker 03-01-2010 08:20 AM

Quote:

Originally Posted by Hark28 (Post 3880942)
Oke that sounds good!
So is there a way to just connect the internal modem port with the external serial port? Isn't there a standard setup for this?

http://www.linuxquestions.org/questi...o-tty2-480257/

But all you are doing is passing data straight through. Pretty pointless really. If you want to use the advanced functionality of the embedded computer you need to do some processing before you output to the other port.

Hark28 03-01-2010 10:13 AM

Thank you smoker,

Of course i'm not using the embedded computer only for this operation, but i first need to be able just use it as modem for the meter.
As far as i can understand of the post you pointed me, the mknod command is making a new symbolic link of the existing port?

I have a external port ttyM0 with the rs485 device connected to it and ttyM2 which is the internal modem.
I found "socat" command to link serial ports but is not working on the embedded computer.


All times are GMT -5. The time now is 03:47 PM.