serialsend does no write to serial pins

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Soulman
New user
Posts: 4
Joined: 12 Sep 2021, 21:44

serialsend does no write to serial pins

#1 Post by Soulman » 13 Sep 2021, 10:46

Hello all,
I am very confused now.
Using 80210802 version.

What is the intention of serialsend ? Just a write to the tcp port ?

What I want is write the time via serial line to an Arduino.
I 've done everything written on the internet: setup a serial device and in the tools section : serial on ( not sure that is necessary )
When I connect with putty on the tcp port , data is coming through on the usb port ( monitoring with arduino ide ) AND on the serial pins to Arduino ( nice ! )

But when giving the command serialsend nothing appears on the arduino. Then I give a longer string and some garbage comes in ( just 2 bytes or so )

Looks like serialsend only writes to tcp port, or to serial pins with wrong baud rate ??

Greetings,
Gert
Last edited by Soulman on 13 Sep 2021, 10:55, edited 1 time in total.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: serialwrite does no write to serial pins

#2 Post by TD-er » 13 Sep 2021, 10:51

I searched through the source code but I cannot find the "serialwrite" command.
Where did you find this suggestion?

Soulman
New user
Posts: 4
Joined: 12 Sep 2021, 21:44

Re: serialsend does no write to serial pins

#3 Post by Soulman » 13 Sep 2021, 10:56

Sorry , abuse must be serialsend

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: serialsend does no write to serial pins

#4 Post by TD-er » 13 Sep 2021, 11:10

"serialsend" is a command belonging to the "Ser2Net" plugin.
It does allow to send data from the TCP port to the serial port.

Code: Select all

    case PLUGIN_WRITE:
    {
      String command  = parseString(string, 1);
      P020_Task *task = static_cast<P020_Task *>(getPluginTaskData(event->TaskIndex));

      if (nullptr == task) {
        break;
      }

      if (command == F("serialsend")) {
        task->ser2netSerial->write(string.substring(11).c_str());
        task->ser2netSerial->flush();
        success = true;
      }

      if ((command == F("ser2netclientsend")) && (task->hasClientConnected())) {
        task->ser2netClient.print(string.substring(18));
        task->ser2netClient.flush();
        success = true;
      }
      break;
    }
There is however a rather "strange" part in this code, as it does send whatever is put in the command string starting at position 11 and further. ("serialsend," is 11 chars)
But strictly speaking sending "serialsend ,...." (thus space and a comma) is valid too and what if you try to wrap the command argument in quotes, then those are sent too.

A task with the Ser2Net plugin assigned to it must be present and enabled, to send something to the serial port.
You don't need to have it connected to another host.

Currently the only way to send something to the serial port, without using the Ser2Net plugin, is sending via the "logitem" command. But this will add some clutter like the uptime in msec, whether it is an "info" logentry, etc. (along with all other log items)

Soulman
New user
Posts: 4
Joined: 12 Sep 2021, 21:44

Re: serialsend does no write to serial pins

#5 Post by Soulman » 13 Sep 2021, 11:38

A task with the Ser2Net plugin assigned to it must be present and enabled, to send something to the serial port.
So you say "it can"
Currently the only way to send something to the serial port....
"It can't "

I'll try later with "logitem"

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: serialsend does no write to serial pins

#6 Post by Ath » 13 Sep 2021, 12:40

Soulman wrote: 13 Sep 2021, 11:38 "It can't "
Please read the original sentence again, you missed the "without using the Ser2Net plugin" part. So it can, as that plugin is included in the normal and test builds (and some hardware specific ones too)
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: serialsend does no write to serial pins

#7 Post by TD-er » 13 Sep 2021, 12:53

Sorry, my posts are almost always a memory-dump and I often have to go through them several times to make them more readable for others that don't fork their thoughts into another thread on every other word, like I do :)

But like Ath already suggested, it can be done with the Ser2Net plugin active and enabled.
If you don't want to use that one, or can't use it (e.g. due to all task slots already used), you can still send out logs.


TL;DR
In order to use that command, you have to have the Ser2Net plugin assigned to a task and have it enabled.

Soulman
New user
Posts: 4
Joined: 12 Sep 2021, 21:44

Re: serialsend does no write to serial pins

#8 Post by Soulman » 13 Sep 2021, 13:30

Hmmmm,
setup a serial device
bij writing that in the 1st post I meant the Ser2Net plugin assigned to a task and have it enabled.

So I have plugin assigned !

Then start putty and send some data -> Succes data comes in in Arduino ( So baudrate , wiring tx/rx pins all are okay )

Send some data with serialsend -> Bad Luck No data !!!

je1981
New user
Posts: 1
Joined: 14 Nov 2021, 22:47

Re: serialsend does no write to serial pins

#9 Post by je1981 » 14 Nov 2021, 22:57

Soulman wrote: 13 Sep 2021, 13:30 Hmmmm,
setup a serial device
bij writing that in the 1st post I meant the Ser2Net plugin assigned to a task and have it enabled.

So I have plugin assigned !

Then start putty and send some data -> Succes data comes in in Arduino ( So baudrate , wiring tx/rx pins all are okay )

Send some data with serialsend -> Bad Luck No data !!!
I have the same issue, the command serialsend doesn't work, no data in the TX pin, I tryed both configuration on the Communication - Serial Server with HW Serial0 and SoftwareSerial and got nothing.

The hardware it's ok because when I use the command ser2netclientsend it's work fine. Only whith this way I can send data to TX pins.

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests