Jump to content

[DCS-BIOS v0.5.3] SOCAT 32 panel limitation

GSS Rain

Recommended Posts



I was adding one more panel to my A-10C Cockpit and when I executed my 33rd socat file it gave me the following error message:


*** fatal error - console device allocation failure - too many consoles in use, max console is 32



Is there a way around this limitation or a way to increase this to say 48?




Link to comment
Share on other sites

I don't know. If you have that many panels going, you should grab some MAX487 chips, an Arduino Mega and build an RS-485 bus instead. Even if there is a way to overcome this particular limitation, you don't want to mess around with dozens of COM ports when Windows randomly decides to renumber them...


This problem will probably also be solved by DCS-BIOS 2.0 if I get there eventually (because that will ditch socat entirely). My problem is that I keep redesigning the thing because this is my chance to add features that require backwards-incompatible changes and I want to get the fundamentals right so I don't have to do that again in the future.


Unfortunately, RS-485 is pretty much an undocumented feature right now. It works, but I don't understand it enough to come up with a series of steps to follow that will definitely work. I don't know whether one Mega can support three or just two RS-485 buses yet, and until recently did not understand why some people had problems with MAX485 (instead of MAX487) chips.


Here's a quote that's buried on page 20 of the DCS-BIOS discussion thread:

Ian;2636130']Quick RS-485 How To:


  • Flash the RS-485 Master example sketch to an Arduino Mega.
  • Connections on the Mega (MAX487 is the transceiver chip I use):
    TX1 ---- DI on first MAX487
    RX1 ---- RO on first MAX487
    2 ---- /RE and DE on first MAX487
    TX2 ---- DI on secondMAX487
    RX2 ---- RO on secondMAX487
    3 ---- /RE and DE on secondMAX487
    TX3 ---- DI on third MAX487
    RX3 ---- RO on third MAX487
    4 ---- /RE and DE on third MAX487
    If you do not connect a second or third transceiver, comment out the corresponding #define UARTn_TXENABLE_PIN line in the sketch.
    I think that up to two transceivers on the Mega should work without problems, I am not sure about three yet.
  • For the slave device, start with the RS485Slave example sketch.
    TX ---- DI on MAX487
    RX ---- RO on MAX487
    2 ---- /RE and DE on MAX487


Between all transceiver chips, daisy-chain GND, A and B pins.

Run the connect-to-serial.cmd script with the Mega's COM port.


If you have a sketch that works in IRQ_SERIAL mode, you can change it to an RS-485 slave by commenting out the "#define DCSBIOS_IRQ_SERIAL" line and adding the #defines for RS485_SLAVE <address> and TXENABLE_PIN from the RS485Slave example sketch.


If you use the MAX487 chip, do not add any resistors to the bus, and keep the total wiring length below 12 meters, you can add 126 devices to one bus in theory. I don't know where the practical limitations are.

Link to comment
Share on other sites

I like the detailed engineering you did in regards to laying out the RS-485 (EIA-485) bus. Most people at work don't even bother to calculate anything. I'm on a project now where the engineer bought a RS485 driver (from company A) for the host to drive about a dozen devices (from company B) related to the visual projectors. They have no idea how many devices the driver can support. It could be 40 or it could be 5. They don't use 120 impedance matched wire, clueless in regards to termination resistors, clueless in regards to bias resistors, clueless weather to use 100 ohm resistor to stop ground loop currents, etc, etc.


Anyways, yes I was managing by not moving the USB connections around to avoid windows reassigning the com ports.


The main issue I had was that the Arduino Mega never worked with DCS BIOS for some reason. I tried the authentic one and the Chinese version and both drivers. Driver CH341 for the clone and arduino for the real one. It works if I use generic sketches like blink, or other stuff, but not with DCS BIOS sketches. I looked at the properties of the driver and maybe there is a settings there I need to tweak. Also have the Atmel-ICE Basic brand new in the box, but I'll open another thread to troubleshoot that one.


At worse case for now, I may try and use the arduino Nano with the MAX487 chips, or maybe there is a quick fix for my Mega issue.


It would have been awesome if there were a quick fix for socat being that I think I only needed about 3 more Nano(s) to complete the Left and Right Consoles. Maybe another 4 would finish the main instrument panel.

Link to comment
Share on other sites

The main issue I had was that the Arduino Mega never worked with DCS BIOS for some reason.


There is an issue where the Mega hangs in the bootloader because it receives DCS-BIOS data right after it has been reset so it never times out waiting for a program upload, even though the data is no valid program. Warhog and I first encountered this issue while developing the RS-485 Master sketch.


A while ago I found a fix for that. I just wanted to look up which release of DCS-BIOS I fixed that in. Apparently I never did. Oops...


Can you try the following connect-serial-port.cmd script with a Mega?


@echo off
REM Specify the COM port number to connect to in the following line.
REM If set to the default value of ASK, the script will ask you to type it in each time.

REM Set PROTOCOL to "TCP" if UDP does not work for you. When using TCP,
REM you have to start the script after you have started the mission and the simulation
REM has been unpaused, otherwise the connection will fail ("Connection refused").

set VERBOSE=-v
if "%1" == "/Q" (

if not "%1" == "" set COMPORT=%1
if "%COMPORT%" == "ASK" set /p COMPORT=Enter a COM Port Number:

if "%MODE_OUTPUT_REDIR%" == "NUL" echo Connecting to COM port %COMPORT%
timeout 2
if "%PROTOCOL%" == "UDP" socat\socat %VERBOSE% UDP4-RECV:5010,ip-add-membership=,reuseaddr!!udp-sendto:localhost:7778 /dev/ttyS%TTYNUM%
if "%PROTOCOL%" == "TCP" socat\socat %VERBOSE% TCP4-CONNECT: /dev/ttyS%TTYNUM%



The script will ask you for a COM port number to connect to. It will also wait two seconds between setting the baud rate and running socat (this should fix the issue mentioned above).


The script also accepts a COM port number as a parameter and supports the "/Q" option to suppress some of the output. This means you should be able to run the following script to connect to several ports in parallel:

@echo off
REM The COMPORTS variable should be set to a space-separated list of COM port numbers:
set COMPORTS=4 3

for %%i in (%COMPORTS%) do start /b cmd /c connect-serial-port.cmd /Q %%i

Link to comment
Share on other sites

Thanks Ian.


I have windows 10 as my operating system. I noticed in the forums some difference in syntax between windows 10 and other versions when trying to install that Normandy Map and WWII Asset pack using cmd prompt. So I tried both regular cmd prompt and then entered powershell and pasted the code. I attached the error message I got when in powershell.


When executed from cmd prompt, it counted down to 0 and then infinite pause. I included the snap shot as pic 2.



Edited by GSS Rain
Link to comment
Share on other sites

I named a text file connect-serial-port.cmd and saved it in my documents.


It counted down when executed and nothing. Then I noticed the name was exactly like the one in DCS BIOS folder, so I renamed the original something else and dropped this one in.


Got a heart beat.


At first it wasn't working the LED13 would not come on at all (Master Caution sketch) then I started to execute the normal socat where in that one, LED13 would just stay on steady.


So I went back to execute the new file to compare what I'm seeing and it just started working.


LED13 blinks with the master caution now. Well, late for work so got to go.


Thanks Ian. You did it again.

Link to comment
Share on other sites

Sorry, I forgot to mention that it needs to be saved in the same directory as the original script because it references socat by a relative path.


Is the Mega now working reliably for you? (If it is not, you can try to increase the timeout in the script a bit, for example from "timeout 2" to "timeout 5".)

Link to comment
Share on other sites

It may take a few clicks to get it work. But was figuring a longer delay was the answer. What I'm still unclear on is operating them simultaneously. I haven't tried this yet but what I usually do is assign a com port number in the script then save the script with that specific com name. I usually make com3 to say com40. Under this new script, if I execute say com 9 and then after it starts I execute com 11, will they both run? I don't use a single script to open more than one com port at the moment. Reason being is when you running more than 30, I visually check each one as it comes online rather than trying to figure out later which one didn't come on. Loose USB connector for example.


Thanks again.

Link to comment
Share on other sites

I visually check each one as it comes online rather than trying to figure out later which one didn't come on. Loose USB connector for example.


The multiple-port version runs the following line for each COM port:

start /b cmd /c connect-serial-port.cmd /Q %%i

That will start the connection script in the background (so they all run in parallel) and without creating a new window. The output from all of the connect-serial-port.cmd instances will land in that one window. If one of the USB ports was not available, you should at least see a "no such device or address" error.


It's certainly not a good solution for 30+ devices, since all the "cannot compute FAST_CWD" warnings will make the actual error messages difficult to spot, but I thought about including this in DCS-BIOS 1.0 as a convenient way to run a handful of panels -- one or two connections to a Mega acting as RS-485 bus master plus maybe one or two panels that cannot be an RS-485 slave (for example because they use an Arduino-compatible board with a different, faster processor to control a large display or something, so they will only work in DEFAULT_SERIAL mode).


That should work as a stopgap measure until DCS-BIOS 2.0 is ready.

  • Like 1
Link to comment
Share on other sites

The code below ended up working best for me. I took your timeout line and added it to the connect-serial-port original file. I execute about 30 of them and added the new line only to the one the Mega is on. In the mean time I've ordered some MAX487 chips to prepare for DCS BIOS 2.0. Wish I could have edited the title of this thread to include Arduino Mega USB Com fix. Thanks.


REM Specify the number of the COM port your Arduino is connected to:






timeout 3

socat\socat -v UDP4-RECV:5010,ip-add-membership=,reuseaddr!!udp-sendto:localhost:7778 /dev/ttyS%TTYNUM%



Link to comment
Share on other sites

In the mean time I've ordered some MAX487 chips to prepare for DCS BIOS 2.0.


I would suggest to try out the MAX487 chip right away. Considering how much you have already achieved then implementing those should not give you any trouble. Just take a prototype PCB and attach the chip. Here is my current setup I am running with


On the cable:

Brown - GND

White - +5VDC

Pink - +12VDC

Grey - for panel light later

Yellow - A line

Green - B line


The 12VDC goes to the Arduino Nano. The Nano then supplies the MAX487 with 5VDC. I then have a break-out board on top;


Which I found on Ebay but I could have made it myself. It just comes handy with the terminals http://www.ebay.com/itm/400387932408?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT


So far only got 5 boards running like this. Did have an issue with the last one. It flooded the communication but turned out there was a short between GND and A-line.


Let me if you need any assistance.




Edited by Hansolo
Corrected sentence
Link to comment
Share on other sites

Thanks Hans. Those Max487 chips came in the other day. I like your cable selection. Instead of buying expensive data bus cable, some use CAT5 network cable. You can pick-up Ethernet cable at your local retail store and a lot of brands are 100 ohm impedance which is close to what EIA-485 spec is looking for.




But yeah that looks way cool. Definitely the way to go and it sounds like you have them working using the Arduino Nano too.

Link to comment
Share on other sites

I'm posting this new issue here because maybe its related or similar existing topic?? Not sure If I should start new thread or look for existing thread with same topic.


[DCS-BIOS v0.5.5]

When I execute the connect-serial-port file to open up the com port it freezes. It does this every time when I first go to use it. The work around I found was to drop in the old file from before in the same directory as the new file. I run the old file and it freezes. I then close the old file and then run the new file. The new file now works as it should. I made a video and a little report to better capture the details of issue.


Discrepancy Report :A10C-DR002



Short Video

Problem demo at minute 1:25 mark.


I'm not sure if anybody else experience that but just wanted to bring it to your attention.



Edited by GSS Rain
Link to comment
Share on other sites

I will change the timeout from 2 seconds to 3 seconds and try the new file that way. I noticed this on my test bench computer. But the other computer that runs the simulator, I think that one was fine. I copied over the old socat files (some modified with 3 sec delay) and they run as normal. But the test bench computer, if I run the old socat file it just freezes after the count down. So I switched to the new socat with v0.5.5 and use that file. But I have to do the procedure in the post above to get it to work. I'll run some more test. If I have no luck I'll try a re-install on the test bench computer. I'll keep you posted.


Thanks Ian.

Link to comment
Share on other sites

I re-booted the test bench PC and the issue went away. I can run the old and new connect-serial-Port and they both start up on the first try with the 2 sec delay. Well the old version was modified to put in the 2 sec delay. So I'm thinking it was something with my PC.



Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...