Go Down

Topic: Using Arduino with linked serial port pair (Read 2209 times) previous topic - next topic

rhhollin

Is there a way to use a linked serial port pair with an Arduino Uno? I am trying to retrieve frequency data from the application SDRUno, which works with an SDR receiver called an SDRPlay RSP1A. The data is exchanged using the Computer Aided Transceiver (CAT) protocol, developed for use with amateur radio transceivers. The SDRUno User Manual specifies that in order to exchange info, the SDRUno application must be assigned to one serial port in a linked pair, and the requesting device is assigned to the other linked port. However, I can't find a way to get the Arduino to work with a linked serial port.

You have to create the linked pair with third party software. I am able to assign the Arduino to one of the linked serial ports using the IDE tools, but when I try to upload my sketch, I get an error message saying that the port is already open or in use by another device. It appears that the Arduino will only work with a serial port that is assigned to it when the USB cable is attached. I have tried deleting the automatically assigned port and then assigning the Arduino to a linked serial port, but I get the same error message.

If anyone knows how to get the Arduino to accept assignment to a linked serial port I would greatly appreciate your assistance!!

Robin2

#1
Jun 19, 2020, 10:56 pm Last Edit: Jun 19, 2020, 10:56 pm by Robin2
I know a little about Serial but I have never heard of a "linked serial port pair" - what does it mean?

Please post a link to "The SDRUno User Manual"

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

rhhollin

This is the link to the SDR User Manual: https://www.sdrplay.com/docs/SDRplay_SDRuno_User_Manual_1.23.pdf

The info on CAT control and the use of linked serial ports is on page 53, which reads:

"In order to achieve this, we need a way to interconnect programs; one common solution is using special
software tools to create "virtual com ports" pairs interconnected with "virtual null modem" cables. Then
applications can see the virtual com ports as real ones, using them for communication.
More on virtual ports later."

An example for an application called Ham Radio Deluxe (HRD) is given on the following page. Third party tools , such as Eltima Software's Virtual Serial Port Driver 9.0 can create the type of linked serial ports described. My issue is that once created, and the Arduino assigned to one of the ports in the IDE tools section, the sketch cannot be loaded, an error message saying the port is already open.

Robin2

"In order to achieve this, we need a way to interconnect programs; one common solution is using special
software tools to create "virtual com ports" pairs interconnected with "virtual null modem" cables. Then
applications can see the virtual com ports as real ones, using them for communication.
More on virtual ports later."

That sounds like something that is commonly done with an Arduino Mega. A serial device is connected to Serial and another serial device is connected to Serial1. When a byte arrives on Serial it is written to Serial1 and vice versa. Something like

Code: [Select]
if (Serial.available >0) {
  byte recByte = Serial.read();
  Serial1.write(recByte);
}


Is that what you have in mind?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

rhhollin

Yes, that might work. I thought about a Mega as an alternate, but both serial lines need to go to the PC via USB. I saw that Arduino sells a USB to serial adapter that was made to use with the Arduino variants that have no USB connection on the board. Could that be used on the Mega?

Robin2

USB-TTL cables (or just modules) are widely available and can be used to connect the Rx1 and Tx1 pins to a PC. I find the cables more convenient to use. Best to get one that has 6 connections at the TTL end - mine have GND, CTS, 5v, Tx, Rx and RTS.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

rhhollin

Well, using the MEGA did not change anything. The application on the PC is assigned to its own COM port. With the mega, I have two COM ports assigned, one for serial and one for serial1. Neither of them will connect to the application com port. This is what the "linked"ports are for. There are several applications that can create these linked ports, the one I am using is called "Virtual Serial Port Driver Pro" by Eltima Software. It creates a pair of virtual ports that are interconnected, so that two apps can communicate.

The problem is that the Arduino boards will not recognize the linked ports. For instance, I can create a linked pair of virtual serial ports, say COM 10 & COM 11, which show up in the Device Manager as "Eltima Virtual Serial Port (COM10->COM11)" and "Eltima Virtual Serial Port (COM11->COM10)". If I then attach the USB cable to the Arduino board, it will assign a regular COM port to the Arduino, say COM3. I then go into the Device Manager and change the Arduino COM port to COM 10, but the device manager then comes back showing a separate COM10 port, labeled as USB Serial Port COM10, i.e. a different port than the Eltima port previously created, which still shows in the Device Manager.

If I try to upload the sketch, I get an error message saying: "avrdude stk500v2_get sync(): timeout communicating with programmer". Any further suggestions gratefully accepted!!

Paul_KD7HB

You wrote " It creates a pair of virtual ports that are interconnected, so that two apps can communicate.". These are called virtual ports because they are not REAL ports. Your Arduino serial connection can only exist with a real physical electrical connection.

Your virtual ports are the same as virtual audio cables between two programs on your PC.

Paul

Robin2

The problem is that the Arduino boards will not recognize the linked ports. For instance, I can create a linked pair of virtual serial ports, say COM 10 & COM 11, which show up in the Device Manager as "Eltima Virtual Serial Port (COM10->COM11)" and "Eltima Virtual Serial Port (COM11->COM10)". If I then attach the USB cable to the Arduino board, it will assign a regular COM port to the Arduino, say COM3. I then go into the Device Manager and change the Arduino COM port to COM 10, but the device manager then comes back showing a separate COM10 port, labeled as USB Serial Port COM10, i.e. a different port than the Eltima port previously created, which still shows in the Device Manager.
I get the impression you are confusing a virtual serial port link created with the ELTIMA program and real physical serial port link created with a Mega.

I suspect that if you have two devices connected to the Mega you should not be trying to use the ELTIMA program at all.

Please go back to basics and provide a diagram showing what you are trying to connect to what.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

markd833

I think I understand what you are trying to do.

SO:
SDRUno = a piece of software that runs on a Windows PC.
SDRPlay RSP1A = a Software Defined Radio - a piece of hardware.

I found an image of the SDRPlay RSP1A and it looks like it has a USB port to connect to the Windows PC running the SDRUno software. You mention serial port so I assume that when you plug the SDRPlay RSP1A into your PC via the USB cable, it appears as a standard COM port.

From what I understand of your requirements, you want to listen in on the "serial" communications between the hardware and the PC in order to pick out a message containing frequency data.

If so, then in theory, you would need a virtual serial port (that SDRUno software connects to) that is connected to a real USB serial port that the SDRPlay RSP1A connects to, and also a real serial port that the Arduino UNO connects to. A software Y-lead from a virtual COM port to 2 real COM Ports.

Your Arduino UNO would already have to have the sketch loaded and the IDE disconnected. It would also have to ensure that it didn't transmit anything as that would interefere with the real communicatiosn going on.

The question then becomes - what do you want to do with the frequency when you decode it? You could display it on an LCD or OLED, but you can't print it over the standard serial port. You could use a software serial port on another pin if you needed to communicate the frequency to another device.

rhhollin

markd833,

Thanks for your response, you are mostly spot on in describing what I am trying to accomplish. The additional part is that the SDRUno software has a capability built in that allows it to respond to the Ham Radio "CAT" (computer Aided Transceiver) protocol. Per the SDRUno manual, the program uses the "Kenwood" implementation of the CAT protocol (Kenwood is a manufacturer of Ham Radio transceivers, along with other electronics). When the SDRUno software is assigned a COM port in it's receiver control settings, it is intended to listed for CAT commands on that COM port. In the Kenwood implementation, sending the command FA; to the SDRUno should result in a response from the SDRUno software sending the frequency the SDRPlay receiver is set to.

So, I am trying to route that FA; command from the Arduino to the SDRUno software running on the PC, then read the frequency data from the SDRUno software. This info would then be used to set the frequency of a transmitter being run by the Arduino in conjunction with the SDRPlay receiver.

The SDRUno manual can be downloaded from https://www.sdrplay.com/downloads/. The relevant info is on pages 61 & 62.

Thanks so much for your assistance!

markd833

I just watched a Youtube video called "Kenwood ts590sg CAT control" and now I see what it's all about!

Ok, so in the video the guy had 1 radio connected to COM1 on his PC. He had 3 different applications running on 3 different virtual COM ports - say COM12, COM13 & COM14. COM12, COM13 & COM14 are virtual serial ports - i.e. they don't exist on the outside of a box with say a standard 9-pin D-Conn.

The virtual serial port software links real COM1 with virtual COM12, COM13 & COM14 so that any characters appearing on any COM port (either real or virtual) are automatically shared with the other COM ports.

So, what I think you need is an application that will do all that + allow a second real COM port, like, say  COM2 to join in the conversation.

I had a look the Virtual Serial Port Emulator that is mentioned in the video and it looks like it doesn't have a configuration with 2 real COM ports and 1 or more virtual COM ports.

So i'm not sure how you would go about doing this.

rhhollin

I found a third party tool that would allow a virtual port to be linked to a real port, but even that would not work. As soon as a virtual port was involved in any way, the Arduino IDE could not communicate with the Arduino board. So, I finally gave up on trying to use virtual serial ports with the Arduino boards and SDRUno software.

I tried a different software defined radio (SDR) program, called SDR-Console, that also provides for CAT communication. With SDR-Console, I was able to successfully get both the Arduino board and the SDR-Console app on the same COM port successfully. The good news is that the SDR-Console recognized that there was activity on the shared COM port, the bad news is that it never showed that it received the command being sent from the Arduino. I could monitor the output of the Arduino on COM 10 using the Arduino IDE Serial Monitor, and it clearly shows the Arduino outputting the required command, FA; . Unfortunately, the  I/O Monitor built in to the SDR-Console software showed activity on the COM port every 4 seconds (the correct delay), but it never showed it receiving the FA; command.

The Arduino code I am using is shown below:

-----------------------------------------------------------------
/*
  Arduino CAT Command to SDR-Console- REV2
*/

int inByte = 0;         // incoming serial byte

void setup() {
  // start serial port at 9600 bps:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  while (Serial.available() <= 0) {
    Serial.print("FA;");   // sends CAT Frequency Read command
    delay(4000);  // delay value is arbitrary, just repeats command till it receives a response
  }


void loop() {
  // if we get a valid byte, read value
  if (Serial.available() > 0) {
    // get incoming byte:
    inByte = Serial.read();
    Serial.write(inByte);
  }
}

------------------------------------------------------------------

The code in the loop is only set up to read the first byte of the multi-byte frequency data as I was at this stage just trying to verify that the requested frequency command was received and responded to.

I would appreciate any guidance on what I need to change in order to get the SDR-Console software to receive and respond to the CAT command the Arduino is sending. Thanks!!

ieee488

Is this a work project for your employer?

.

Go Up