<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Raspberry 3 + Arduino Uno USB + MODBus RTU</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/</id><updated>2020-02-27T17:14:43.662000Z</updated><subtitle>Recent posts to Raspberry 3 + Arduino Uno USB + MODBus RTU</subtitle><entry><title>Raspberry 3 + Arduino Uno USB + MODBus RTU</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/?limit=25#0f41" rel="alternate"/><published>2020-02-27T17:14:43.662000Z</published><updated>2020-02-27T17:14:43.662000Z</updated><author><name>elconfa</name><uri>https://forge.codesys.com/u/elconfa/</uri></author><id>https://forge.codesys.comec50899dae0325f1364b78867afc55c988957018</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;span&gt;[SOLVED]&lt;/span&gt;&lt;br/&gt;
Hi, I'm trying to connect Raspberry 3 B + to Arduino Mega via USB cable. In Arduino I loaded the sample program of the Modbusino library. I added the inscription:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;[SysCom]&lt;/span&gt;&lt;br/&gt;
Linux.Devicefile = / dev / ttyUSB&lt;br/&gt;
portnum: = COM.SysCom.SYS_COMPORT1;&lt;/p&gt;
&lt;p&gt;in the CODESYSControl.cfg file.&lt;/p&gt;
&lt;p&gt;Arduino is programmed directly by Raspberry and the Arduino IDE sees the card connected on the /dev/ttyUSB0 port.&lt;br/&gt;
I tried at various speeds, but I can not read or write anything.&lt;/p&gt;
&lt;p&gt;Could someone post a sample code for Arduino and for Raspberry Codesys to try?&lt;/p&gt;
&lt;p&gt;In next post I will submit all my project.&lt;/p&gt;
&lt;p&gt;Thanks in advance to everyone that would help me.&lt;/p&gt;
&lt;p&gt;Massimo&lt;/p&gt;
&lt;p&gt;&lt;span&gt;[SOLVED]&lt;/span&gt; Now it work. From Raspberry to Arduino Mega it is possible to control all Input and Output&lt;/p&gt;
&lt;p&gt;The code for Arduino:&lt;/p&gt;
&lt;p&gt;/&lt;em&gt;&lt;em&gt;&lt;br/&gt;
 *  Modbus slave example 2:&lt;br/&gt;
 *  The purpose of this example is to link the Arduino digital and analog&lt;br/&gt;
 *  pins to an external device.&lt;br/&gt;
&lt;/em&gt;&lt;br/&gt;
 *  Recommended Modbus Master: QModbus&lt;br/&gt;
 *  &lt;a class="" href="http://qmodbus.sourceforge.net/" rel="nofollow"&gt;&lt;/a&gt;&lt;a href="http://qmodbus.sourceforge.net/" rel="nofollow"&gt;http://qmodbus.sourceforge.net/&lt;/a&gt;&lt;br/&gt;
&lt;/em&gt;&lt;br/&gt;
 *  Editado al español por LuxARTS&lt;br/&gt;
 */&lt;/p&gt;
&lt;p&gt;//Incluye la librería del protocolo Modbus&lt;br/&gt;
#include &amp;lt;modbusrtu.h&amp;gt;&lt;br/&gt;
#define ID   1&amp;lt;/modbusrtu.h&amp;gt;&lt;/p&gt;
&lt;p&gt;//Crear instancia&lt;br/&gt;
Modbus slave(ID, 0, 0); //ID del nodo. 0 para el master, 1-247 para esclavo&lt;br/&gt;
                        //Puerto serie (0 = TX: 1 - RX: 0)&lt;br/&gt;
                        //Protocolo serie. 0 para RS-232 + USB (default), cualquier pin mayor a 1 para RS-485&lt;br/&gt;
boolean led;&lt;br/&gt;
int8_t state = 0;&lt;br/&gt;
unsigned long tempus;&lt;/p&gt;
&lt;p&gt;uint16_t au16data&lt;span&gt;[8]&lt;/span&gt;; //La tabla de registros que se desea compartir por la red&lt;/p&gt;
&lt;p&gt;/&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;br/&gt;
 Configuración del programa&lt;br/&gt;
&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;/em&gt;/&lt;br/&gt;
void setup() {&lt;br/&gt;
  io_setup(); //configura las entradas y salidas&lt;/p&gt;
&lt;p&gt;slave.begin(19200); //Abre la comunicación como esclavo&lt;br/&gt;
  tempus = millis() + 100; //Guarda el tiempo actual + 100ms&lt;br/&gt;
  digitalWrite(13, HIGH ); //Prende el led del pin 13 (el de la placa)&lt;br/&gt;
}&lt;/p&gt;
&lt;p&gt;/&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;br/&gt;
 Inicio del programa&lt;br/&gt;
&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;/em&gt;/&lt;br/&gt;
void loop() {&lt;br/&gt;
  //Comprueba el buffer de entrada&lt;br/&gt;
  state = slave.poll( au16data, 8 ); //Parámetros: Tabla de registros para el intercambio de info&lt;br/&gt;
                                     //            Tamaño de la tabla de registros&lt;br/&gt;
                                     //Devuelve 0 si no hay pedido de datos&lt;br/&gt;
                                     //Devuelve 1 al 4 si hubo error de comunicación&lt;br/&gt;
                                     //Devuelve mas de 4 si se procesó correctamente el pedido&lt;/p&gt;
&lt;p&gt;if (state &amp;gt; 4) { //Si es mayor a 4 = el pedido fué correcto&lt;br/&gt;
    tempus = millis() + 50; //Tiempo actual + 50ms&lt;br/&gt;
    digitalWrite(13, HIGH);//Prende el led&lt;br/&gt;
  }&lt;br/&gt;
  if (millis() &amp;gt; tempus) digitalWrite(13, LOW );//Apaga el led 50ms después&lt;/p&gt;
&lt;p&gt;//Actualiza los pines de Arduino con la tabla de Modbus&lt;br/&gt;
  io_poll();&lt;br/&gt;
} &lt;/p&gt;
&lt;p&gt;void io_setup() {&lt;br/&gt;
  pinMode(13, OUTPUT);&lt;br/&gt;
  digitalWrite(13, HIGH ); //Led del pin 13 de la placa&lt;br/&gt;
}&lt;/p&gt;
&lt;p&gt;/&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;br/&gt;
Enlaza la tabla de registros con los pines&lt;br/&gt;
&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;/em&gt;/&lt;br/&gt;
void io_poll() {&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;au16data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;a class="" href="https://forum.codesys.com//download/file.php?id=4181" rel="nofollow"&gt;TestModbus.projectarchive &lt;span&gt;&lt;span&gt;[477.66 KiB]&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry 3 + Arduino Uno USB + MODBus RTU</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/?limit=25#c299" rel="alternate"/><published>2020-02-27T17:14:42.699000Z</published><updated>2020-02-27T17:14:42.699000Z</updated><author><name>alverman</name><uri>https://forge.codesys.com/u/alverman/</uri></author><id>https://forge.codesys.com292e898dd3e1e1e8f73c25c7ceb3f6679dbd05d8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
I tried inserting the code in a task to check the status of the arduino connection but it does not work automatically.&lt;br/&gt;
When I unplug the arduino usb cable I can not see Modbus_Slave_COM_Port.xError switched from FALSE to TRUE so when connecting the cable the connection is not restored.&lt;br/&gt;
If I force the state of xError to TRUE and then put it back to FALSE the connection re-establishes.&lt;/p&gt;
&lt;p&gt;Where am I wrong?&lt;/p&gt;
&lt;p&gt;Thank you, Alberto&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: CSYS_2.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=2775"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: CSYS_1.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=2774"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry 3 + Arduino Uno USB + MODBus RTU</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/?limit=25#f7fc" rel="alternate"/><published>2020-02-27T17:14:39.993000Z</published><updated>2020-02-27T17:14:39.993000Z</updated><author><name>sandro66</name><uri>https://forge.codesys.com/u/sandro66/</uri></author><id>https://forge.codesys.combc13ad8ae700ee89e54cf958eb5915f51b603925</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
You need to set .xResetComPort and .xStop flags for a minimun of 5 sec.&lt;/p&gt;
&lt;p&gt;Hope, this will help you.&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Sandro&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry 3 + Arduino Uno USB + MODBus RTU</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/?limit=25#a0c0" rel="alternate"/><published>2020-02-27T17:14:39.029000Z</published><updated>2020-02-27T17:14:39.029000Z</updated><author><name>marcys</name><uri>https://forge.codesys.com/u/marcys/</uri></author><id>https://forge.codesys.com738289c6d59c093f4a59be3e61c0a6725a1735d9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello marv_nene,&lt;/p&gt;
&lt;p&gt;Would you like to post some screenshot and code example. I did what you wrote but it does not work for me:-(&lt;/p&gt;
&lt;p&gt;Regards,&lt;br/&gt;
Marcys&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry 3 + Arduino Uno USB + MODBus RTU</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/?limit=25#97be" rel="alternate"/><published>2020-02-27T17:14:38.051000Z</published><updated>2020-02-27T17:14:38.051000Z</updated><author><name>marv-nene</name><uri>https://forge.codesys.com/u/marv-nene/</uri></author><id>https://forge.codesys.com18b9d87421b4ae4073164d0d93473dfe41cea252</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello Marcys,&lt;br/&gt;
so, first you have to configure the USB Com Port of your connected Arduino described in this&lt;a class="" href="http://forum.codesys.com/viewtopic.php?f=21&amp;amp;t=6755&amp;amp;x=14284&amp;amp;hilit=modbus+rtu&amp;amp;p=14284&amp;amp;lan=en" rel="nofollow"&gt;http://forum.codesys.com/viewtopic.php?f=21&amp;amp;t=6755&amp;amp;p=14284&amp;amp;hilit=modbus+rtu#p14284&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For ModBus on Arduino, you can use the ModBusIno Library from stephane @&lt;span&gt;[url]&lt;/span&gt;https://github.com/stephane/modbusino&lt;br/&gt;
&lt;span&gt;[/url]&lt;/span&gt;. It works for me with &lt;br/&gt;
Baud : 38400&lt;br/&gt;
Parity: none&lt;br/&gt;
Data Bits: 8&lt;br/&gt;
Stop bits: 2&lt;/p&gt;
&lt;p&gt;In Codesys add a Com-Port-&amp;gt; Modbus RTU Master-&amp;gt; Modbus Slave&lt;/p&gt;
&lt;p&gt;In the Modbus Master deactivate the "auto reconnect" and use my code above.&lt;br/&gt;
A good idea is, to create a task for it, which circles all 30 sec.&lt;/p&gt;
&lt;p&gt;Hope, this will help you.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry 3 + Arduino Uno USB + MODBus RTU</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/?limit=25#6b21" rel="alternate"/><published>2020-02-27T17:14:35.318000Z</published><updated>2020-02-27T17:14:35.318000Z</updated><author><name>marcys</name><uri>https://forge.codesys.com/u/marcys/</uri></author><id>https://forge.codesys.comb84b7f1c110b0a5a4062f800bce04ed775d6ff20</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi marv_nene,&lt;/p&gt;
&lt;p&gt;Ok, Thank You. I will wait for response.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry 3 + Arduino Uno USB + MODBus RTU</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/?limit=25#f42d" rel="alternate"/><published>2020-02-27T17:14:34.323000Z</published><updated>2020-02-27T17:14:34.323000Z</updated><author><name>marv-nene</name><uri>https://forge.codesys.com/u/marv-nene/</uri></author><id>https://forge.codesys.comde3fd02783eb82e76ec1c554df31a3311a4f4797</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;@Edwin, thanks for your response, but I figured out a solution:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;xInit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;FALSE&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
   ...
   &lt;span class="nv"&gt;Modbus_Slave_COM_Port&lt;/span&gt;.&lt;span class="nv"&gt;xReset&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;FALSE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_IF&lt;/span&gt;
...
&lt;span class="nv"&gt;xInit&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;TRUE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
...
&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="nv"&gt;Modbus_Slave_COM_Port&lt;/span&gt;.&lt;span class="nv"&gt;xError&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
   &lt;span class="nv"&gt;Modbus_Slave_COM_Port&lt;/span&gt;.&lt;span class="nv"&gt;xReset&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;TRUE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
   &lt;span class="nv"&gt;Modbus_Master_COM_Port&lt;/span&gt;.&lt;span class="nv"&gt;xResetComPort&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;TRUE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
   &lt;span class="nv"&gt;Modbus_Master_COM_Port&lt;/span&gt;.&lt;span class="nv"&gt;xStop&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;TRUE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;ELSE&lt;/span&gt;
   &lt;span class="nv"&gt;Modbus_Slave_COM_Port&lt;/span&gt;.&lt;span class="nv"&gt;xReset&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;FALSE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
   &lt;span class="nv"&gt;Modbus_Master_COM_Port&lt;/span&gt;.&lt;span class="nv"&gt;xResetComPort&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;FALSE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
   &lt;span class="nv"&gt;Modbus_Master_COM_Port&lt;/span&gt;.&lt;span class="nv"&gt;xStop&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;FALSE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_IF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I guess, the problem is the following: When the raspberry boots, the COM port for the arduino is initialized after the start of the codesys runtime, or it seems it needs longer then expected. So, the automatic reconnection doesn't work for me. When I do it manually, it works. This code is executed every 5 seconds.&lt;/p&gt;
&lt;p&gt;&lt;a class="user-mention" href="/u/marcys/"&gt;@marcys&lt;/a&gt;&lt;br/&gt;
I will respond you later.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry 3 + Arduino Uno USB + MODBus RTU</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/?limit=25#1051" rel="alternate"/><published>2020-02-27T17:14:31.602000Z</published><updated>2020-02-27T17:14:31.602000Z</updated><author><name>marcys</name><uri>https://forge.codesys.com/u/marcys/</uri></author><id>https://forge.codesys.com4eb39658ecae257a8892c4b44724214f72f71288</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello marv_nene,&lt;/p&gt;
&lt;p&gt;Would You like to post screen how you connect raspberry with arduino and how you configure it?&lt;br/&gt;
I want to do the same to control my home&lt;/p&gt;
&lt;p&gt;Regards,&lt;br/&gt;
Marcys&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry 3 + Arduino Uno USB + MODBus RTU</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/?limit=25#5e5d" rel="alternate"/><published>2020-02-27T17:14:30.581000Z</published><updated>2020-02-27T17:14:30.581000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.com3419f8a593b0e4e3a96d9f6fedc90562e052e20b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
I would recommend to check:&lt;br/&gt;
1. If the startup is done and the communication stucks with modbus rtu, Login with CODESYS and check the device tree&lt;br/&gt;
- which components have a green\red sign (Modbus Master / Modbus Slave / Modbus Comport)&lt;br/&gt;
- Then add the name of the slave (the name in the devicetree) to the watchwindow and check the communications states, if there is an slave error you should see this&lt;br/&gt;
Maybe you give us a few screenshots of these states to see what happens&lt;br/&gt;
BR&lt;br/&gt;
Edwin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry 3 + Arduino Uno USB + MODBus RTU</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/634eb0e582/?limit=25#ff73" rel="alternate"/><published>2020-02-27T17:14:29.612000Z</published><updated>2020-02-27T17:14:29.612000Z</updated><author><name>marv-nene</name><uri>https://forge.codesys.com/u/marv-nene/</uri></author><id>https://forge.codesys.comc8617d15a139f1605ac933c5cde3c8216717dc3b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;br/&gt;
I'm using the following setup:&lt;br/&gt;
- Raspberrry Pi 3 (Modbus RTU Master)&lt;br/&gt;
- Codesys Runtime (Current Version)&lt;br/&gt;
- Arduino UNO (Modbus RTU Slave)&lt;/p&gt;
&lt;p&gt;The Raspberry Pi controls the logic and the Arduino uno is for the periphery. They're connected per USB. Communication over modbus rtu works between these two and I testet it with different bitrates. &lt;br/&gt;
Modbus RTU works after every code upload quite well.&lt;br/&gt;
But after every cold boot, codesys does not recognize the Arduino as Slave.&lt;br/&gt;
In this case, a "cold reboot" helps to fix the the problem in most cases.&lt;/p&gt;
&lt;p&gt;Have anyone an idea where the problem is or a guess how to fix it? &lt;br/&gt;
Thanks &lt;/p&gt;&lt;/div&gt;</summary></entry></feed>