VOGONS

Common searches


Serial port on linux

Topic actions

First post, by nicola

User metadata
Rank Newbie
Rank
Newbie

Hi,
I must make a program (Siemens STEP5) work with dosbox, but I need the serial port to work on linux. I saw the support only for win32 and os/2. 🙁

Could you suggest something ?
Thanks, Nicola.

Reply 1 of 23, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

http://sourceforge.net/tracker/index.php?func … 551&atid=467234

You need cvs sources for this patch, if it doesn't apply to the current
cvs sources try to checkout those with timestamp a few weeks ago.

Reply 2 of 23, by nicola

User metadata
Rank Newbie
Rank
Newbie

Thanks.
I tried the patch and I put
serial1=directserial realport:0
in my confing file.
Unlucky, I get this error:
Invalid type for COM1.
🙁
Nicola.

Reply 4 of 23, by nicola

User metadata
Rank Newbie
Rank
Newbie

Yes, 😀
you're right, I changed C_DIRECTSERIAL.
I tried step5 to connect with another pc (minicom) because I have'nt a PLC now.
So step5 freeze when I try to connect but I see some chars on minicom terminal.
Tomorrow I want to connect step5 to a real PLC.
Thanks, Nicola.

Reply 8 of 23, by nicola

User metadata
Rank Newbie
Rank
Newbie

This not change the result.
I tried a connection with a real plc but whitthe same result.
I compiled dosbox with --enable-debug=heavy option and when step5 freeze I have:

45874779: DOSMISC:DOS:Multiplex Unhandled call B700
46090868: PIC:0 mask E8
46091213: PIC:0 mask ED
81734391: PIC:0 mask E8

Nicola.

Reply 10 of 23, by nicola

User metadata
Rank Newbie
Rank
Newbie
h-a-l-9000 wrote:

Does it work on a Windows computer? I have Step5 V3.0 which works with a PLC (Windows).

Yes, with windows and the same usb2serial adapter step5 work.
With linux, dosbox report:
Serial port at 3f8: Opening "/dev/ttyUSB0"

(I'm change from ttyS to ttyUSB)
but when I try to get step5 online it freeze.
Thanks, Nicola.

Reply 12 of 23, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

There is something important missing in the posix patch.

Add the ByteTransmitted in CDirectSerial::transmitByte:

void CDirectSerial::transmitByte(Bit8u val) {
int bytes = write (fileId, &val, 1);
if (bytes == -1) {
LOG_MSG ("UART 0x%x: NO BYTE WRITTEN!", base);
// error!
}
ByteTransmitted();
}

Reply 13 of 23, by nicola

User metadata
Rank Newbie
Rank
Newbie

Ok, now step5 not freeze, but I can't connect with PLC. 😀
I'm get timeout by step5. 🙁
My config file for serial port is:

serial1=directserial realport:0 startbps:9600 parity:E stopbits:1 bytesize:8

I think this is corret.
Thanks, Nicola.

Reply 14 of 23, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The startbps parity ... should not be neccessary.

Did you try to repower the PLC? It might be insulted now because of the previous incomplete communication attempts. Also replug the USB-serial they are not perfect.

1+1=10

Reply 15 of 23, by nicola

User metadata
Rank Newbie
Rank
Newbie
h-a-l-9000 wrote:

The startbps parity ... should not be neccessary.

serial1=directserial realport:0 stopbits:1 bytesize:8

I tried with windows and it works without reboot PLC. 😠
Thanks, Nicola.

Reply 16 of 23, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

There is another one in CDirectSerial::CDirectSerial:

InstallationSuccessful = false;
InstallTimerHandler(th);
lastChance = 0;

Don't know if it has an effect though.

Reply 17 of 23, by nicola

User metadata
Rank Newbie
Rank
Newbie
h-a-l-9000 wrote:
There is another one in CDirectSerial::CDirectSerial: […]
Show full quote

There is another one in CDirectSerial::CDirectSerial:

InstallationSuccessful = false;
InstallTimerHandler(th);
lastChance = 0;

There are InstallationSuccessful and InstallTimerHandler(th), but there isn't
lastChance (I put it)
Tomorrow I will try another time.
Thanks, Nicola.

Reply 18 of 23, by nicola

User metadata
Rank Newbie
Rank
Newbie

I'm still not able to make step5 online. In debug mode there aren't significant
messages. Now I'm testing S5 V3.2 but I have some problem with my keyboard. 😠
Nicola.

Reply 19 of 23, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Another thing... add the VMIN and VTIME lines in CDirectSerial::CDirectSerial

              termInfo.c_cflag |= CSTOPB;
}

termInfo.c_cc[VMIN] = 0;
termInfo.c_cc[VTIME] = 0;

termInfo.c_iflag = IGNPAR;

If it still doesn't work you'll have to investigate on your own from there, I don't have Linux. I.E. put some logging messages in the send/receive functions or watch the error return values.[/code]