Coder Social home page Coder Social logo

arduino-tools40's People

Contributors

bernatgarcia avatar francescodalan avatar ganehag avatar industrialshields avatar joanvc100 avatar jordicasals avatar pagarca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-tools40's Issues

Modbus RTU slave compilation error

This doesn't appear to be a duplicate of the existing issues.
The default sketch does not compile, with the error following. I assume that the RS485 class definition isn't treated as hardware serial any longer, likely due to industrial shields updating it. That is simply a guess on my part.

Switching out the RS485 reference for Serial, Serial1 etc. compiles successfully.

ModbusRTUSlave:57:32: error: no matching function for call to 'ModbusRTUSlave::ModbusRTUSlave(RS485Class&, int)'
 ModbusRTUSlave modbus(RS485, 31);
                                ^
In file included from \arduino_modified_sketch_598571\ModbusRTUSlave.ino:19:0:
\Arduino\libraries\arduino-Tools40-master\src/ModbusRTUSlave.h:10:3: note: candidate: ModbusRTUSlave::ModbusRTUSlave(HardwareSerial&, uint8_t)
   ModbusRTUSlave(HardwareSerial &serial, uint8_t addr);
   ^~~~~~~~~~~~~~
\Arduino\libraries\arduino-Tools40-master\src/ModbusRTUSlave.h:10:3: note:   no known conversion for argument 1 from 'RS485Class' to 'HardwareSerial&'
\Arduino\libraries\arduino-Tools40-master\src/ModbusRTUSlave.h:8:7: note: candidate: constexpr ModbusRTUSlave::ModbusRTUSlave(const ModbusRTUSlave&)
 class ModbusRTUSlave : public ModbusSlave {
       ^~~~~~~~~~~~~~
\Arduino\libraries\arduino-Tools40-master\src/ModbusRTUSlave.h:8:7: note:   candidate expects 1 argument, 2 provided
\Arduino\libraries\arduino-Tools40-master\src/ModbusRTUSlave.h:8:7: note: candidate: constexpr ModbusRTUSlave::ModbusRTUSlave(ModbusRTUSlave&&)
\Arduino\libraries\arduino-Tools40-master\src/ModbusRTUSlave.h:8:7: note:   candidate expects 1 argument, 2 provided
Multiple libraries were found for "RS485.h"
 Used: \AppData\Local\Arduino15\packages\industrialshields\hardware\avr\1.1.38\libraries\RS485
 Not used: \Arduino\libraries\ArduinoRS485
Multiple libraries were found for "Ethernet.h"
 Used: \AppData\Local\Arduino15\packages\industrialshields\hardware\avr\1.1.38\libraries\Ethernet
 Not used: \Arduino\libraries\Ethernet
Using library RS485 at version 1.0 in folder: \AppData\Local\Arduino15\packages\industrialshields\hardware\avr\1.1.38\libraries\RS485 
Using library SoftwareSerial at version 1.0 in folder: \AppData\Local\Arduino15\packages\industrialshields\hardware\avr\1.1.38\libraries\SoftwareSerial 
Using library arduino-Tools40-master at version 1.0.0-beta in folder: \Arduino\libraries\arduino-Tools40-master 
Using library Ethernet at version 2.0.0 in folder: \AppData\Local\Arduino15\packages\industrialshields\hardware\avr\1.1.38\libraries\Ethernet 
Using library SPI at version 1.0 in folder: \AppData\Local\Arduino15\packages\industrialshields\hardware\avr\1.1.38\libraries\SPI 
exit status 1
no matching function for call to 'ModbusRTUSlave::ModbusRTUSlave(RS485Class&, int)'

Issues with industrialshields/hardware/esp32/2.0.7/libraries/RS485

Hi,

I tried to implement a Modbus RTU master on a 10IOs using the Industrial Shields specific RS485 library. However I ran into two issues.

  1. The RS485 library does not include a virtual size_t write(const uint8_t *buffer, size_t size); method. Just like the existing virtual size_t write(uint8_t value);, this method must run enableTx(). Otherwise the RS485 transceiver will not transmit any data. Both these methods are used by the ModbusRTUMaster class.
  2. In void RS485Class::begin(unsigned long baud, uint8_t duplex, uint32_t config) the code;
uart_isr_free(RS485_HWSERIAL);
uart_isr_register(RS485_HWSERIAL, rs485_isr, this, ESP_INTR_FLAG_IRAM, nullptr);

causes the CPU to crash whenever it receives data from the RS485 transceiver.

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d5439  PS      : 0x00060330  A0      : 0x800d1195  A1      : 0x3ffb1f30
A2      : 0x00000002  A3      : 0x00000000  A4      : 0x0800001e  A5      : 0x00000003
A6      : 0x00000001  A7      : 0x00000000  A8      : 0x800d1108  A9      : 0x3ffb1ef0
A10     : 0x3ffbfef8  A11     : 0x00004b00  A12     : 0x0800001e  A13     : 0x00000010
A14     : 0x00000011  A15     : 0x00000000  SAR     : 0x0000000f  EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000000c  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000

Backtrace: 0x400d5439:0x3ffb1f30 0x400d1192:0x3ffb1f60 0x400d0d08:0x3ffb1f80 0x400d1736:0x3ffb1fb0 0x40085a79:0x3ffb1fd0

This is not due to something strange in my code as this also occurs with examples/Receive/Receive.ino .

To fix both problems I had to patch the code. I solved the first issue by implementing the missing method. The second, I solved by disabling the code that causes the crash. Then I added flush() operations to empty the output buffer before performing a disableTx(). A better solution would be to figure out why the uart_isr_* code isn't working. Something I don't have to time to do right now.

The code can be found at https://github.com/ganehag/industrialshields-rs485/

Unable to connect using modbus TCPSlave example project

I am using an IndustrialShields 10IOs Relay Module 013002000200

I have loaded ModbusTCPSlave, and made only 1 change - IP Address.
The TCP port is 502. (unchanged)
I can ping the device, I can see it on the network.

I cannot connect to the device using either a HMI or directly via RAW tcp open - the port is not listening.

I can see this via serial console:

13:22:50.103 -> 172.20.251.146

In the main loop, all I see to process modbus requests is line 107, modbus.update()
Am I safe in assuming that library call also handles the ethernet handling?
in setup, I see ethernet.begin(), but nowhere else do I see anything related to ethernet..

Thanks,

WriteSingleRegister

Hi, great set of tools and hardware many thanks.

I am experiencing a response issue with ModbusTCP.

If I use the Write Single Register function, the value is set correctly, but it seems the response to the client is incorrect (see below)

image

If I use multiple registeries, everything works fine and the response is accepted (see below)

image

I think the response should really be:

36 26 00 00 00 06 02 06 00 00 00 00

Which means the calculated length is 1 too long with an erronous 0x06 being sent at the end.

I can't quite figure out where the issue lies. Many Thanks.

MODBUS TCP Slave no complila

In file included from C:\Users\win10N\Documents\Arduino\libraries\arduino-Tools40-master\examples\Modbus\ModbusTCPSlave\ModbusTCPSlave.ino:19:0:
C:\Users\win10N\Documents\Arduino\libraries\arduino-Tools40-master\src/ModbusTCPSlave.h:28:16: error: 'MODBUS_TCP_ADU_SIZE' was not declared in this scope
uint8_t _adu[MODBUS_TCP_ADU_SIZE];
^~~~~~~~~~~~~~~~~~~
C:\Users\win10N\Documents\Arduino\libraries\arduino-Tools40-master\src/ModbusTCPSlave.h:28:16: note: suggested alternative: 'MODBUS_PDU_SIZE'
uint8_t _adu[MODBUS_TCP_ADU_SIZE];
^~~~~~~~~~~~~~~~~~~
MODBUS_PDU_SIZE
Se encontraron varias bibliotecas para "Ethernet.h"
Usado: C:\Users\win10N\Documents\Arduino\libraries\Ethernet
No usado: C:\Program Files (x86)\Arduino\libraries\Ethernet
exit status 1
Error compilando para la tarjeta Arduino Mega or Mega 2560.

RS485.h file.

I have opened modbusRTUslave example. During compiling Threre is error about RS485.h file. This file is not exist in tools40 folder.

ModbusTCPSlave Example Won't compile

Fresh install of latest Arduino software and latest update to the Tools40 from github.

'ModbusTCPSlave' does not name a type; did you mean 'ModbusSlave'?

I'm not sure why you closed the last issue when it didn't get fixed.

Frage

Guten Abend,

es geht um den Sketch: ModbusTCPMasterReadInputRegisters

Wie kann ich den Sketch erweitern, wenn ich aus mehreren Registern lesen möchte z.B.

master.readInputRegisters(slave, 100, 817, 1)
und
master.readInputRegisters(slave, 30, 18, 1)

Wäre super, wenn Sie mir helfen könnten.

Die SlaveIP und der SlavePort bleiben gleich.

Example projects do not compile

ModbusTCPSlave does not compile -
Arduino\libraries\arduino-Tools40-master\src/ModbusTCPSlave.h:28:16: error: 'MODBUS_TCP_ADU_SIZE' was not declared in this scope
uint8_t _adu[MODBUS_TCP_ADU_SIZE];
^~~~~~~~~~~~~~~~~~~

RS485 support for MODBUS library

Hello everyone. I want to try the examples provided for ModBus with RS-485. However, I notices that the RS485.h library is different from ArduinoRS485 library because the HALFDUPLEX is not defined and the 3-argument version of begin function of RS485 in ArduinoRS485 has different argument set compared to the example code.

What is the library used for RS485.h and RS232.h in this library? Could you please clarify it in the README or include the library in the code?

Thanks.

Can't compile when including headers from the library

Hello,

when trying out the basic ModbusTCPMasterReadDiscreteInputs.ino example on a ESP32 PLC 58, i get this error

[Starting] Analyzing sketch 'ModbusTCPMasterReadDiscreteInputs.ino'
[Warning] Output path is not specified. Unable to reuse previously compiled files. Build will be slower. See README.
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
In file included from /home/ottega/Arduino/libraries/Tools40/src/ModbusTCPSlave.cpp:1:
/home/ottega/Arduino/libraries/Tools40/src/ModbusTCPSlave.h:24:18: error: cannot declare field 'ModbusTCPSlave::_server' to be of abstract type 'EthernetServer'
   EthernetServer _server;
                  ^~~~~~~
In file included from /home/ottega/Arduino/libraries/Tools40/src/ModbusTCP.h:6,
                 from /home/ottega/Arduino/libraries/Tools40/src/ModbusTCPSlave.h:4,
                 from /home/ottega/Arduino/libraries/Tools40/src/ModbusTCPSlave.cpp:1:
/home/ottega/Arduino/libraries/Ethernet/src/Ethernet.h:254:7: note:   because the following virtual functions are pure within 'EthernetServer':
 class EthernetServer : public Server {
       ^~~~~~~~~~~~~~
In file included from /home/ottega/.arduino15/packages/industrialshields/hardware/esp32/2.1.2/cores/industrialshields/Arduino.h:172,
                 from /home/ottega/Arduino/libraries/Ethernet/src/Ethernet.h:51,
                 from /home/ottega/Arduino/libraries/Tools40/src/ModbusTCP.h:6,
                 from /home/ottega/Arduino/libraries/Tools40/src/ModbusTCPSlave.h:4,
                 from /home/ottega/Arduino/libraries/Tools40/src/ModbusTCPSlave.cpp:1:
/home/ottega/.arduino15/packages/industrialshields/hardware/esp32/2.1.2/cores/industrialshields/Server.h:28:18: note: 	'virtual void Server::begin(uint16_t)'
     virtual void begin(uint16_t port=0) =0;
                  ^~~~~
Multiple libraries were found for "Ethernet.h"
 Used: /home/ottega/Arduino/libraries/Ethernet
 Not used: /home/ottega/bin/arduino-1.8.19/libraries/Ethernet
 Not used: /home/ottega/.arduino15/packages/industrialshields/hardware/esp32/2.1.2/libraries/Ethernet
exit status 1
IntelliSense configuration updated. To manually rebuild your IntelliSense configuration run "Ctrl+Alt+I"
[Error] Analyzing sketch 'ModbusTCPMasterReadDiscreteInputs.ino': Exit with code=1

The same happened when trying out the Pulses.ino
When excluding the headers from Tools40 library I can compile sketches.
Any idea how to solve this problem?

Best,
Ottega

class ModbusTCPSlave error

Hi, I'm trying implement the ModbusTCPSlave.h library.

When I create 'modbus' object;

ModbusTCPSlave  modbus(port);

the Arduino IDE (ver. 1.18.10) gives me the following error of compilation:

error: 'ModbusTCPSlave' does not name a type; did you mean 'ModbusSlave'?

Any suggestions?
Thanks, Federico.

ModbusRTU master CRC error

Hi, has anyone tried to use the modbus RTU master example code to read more than 40 registers from a modbus device via RS485? I keep getting the CRC error message (by enable the debug mode of the Tool40 library). Reading less than 40 registers works for me and no CRC error, so I would imagine the CRC code just works fine, not sure what's wrong.

PS. I tried to monitor the length of the received package, seems the length is not correct. I am pretty sure the slave device has sent the correct data back to master as the data on the rs485 line is also monitored by another rs485/usb module and a serial COM software, with the correct data pack and crc sent by the slave device.

master device: industrial shield 10IO arduino nano version.

ModbusRTU and SoftwareSerial

This library uses only HardwareSerial for ModbusRTU, but in some controllers, like ArdBox Analog HF connection between ESP32 and Arduino realized via SoftwareSerial, and so is a problem to using Modbus protocol between this two modules. Maybe you can rewrite class using AnySerial module?

ModbusTCPSlave example does not work

I have installed tools40 and want to use the ModbusTCPSlave example.
When I compile it, I get the error:
'ModbusTCPSlave' does not name a type; did you mean 'ModbusSlave'?

I can see that others get the same error.

Do you have any ideas why your code does not compile ?

Modbus TCP code ONLY works with Industrial Shields proprietary Arduino boards

It is pt. stated at GitHub that the use of your code optionally require usage of your proprietary Arduino boards from the company Industrial Shields.
It is essential that you state in the top of the description in GitHub + at the specific examples that it is required to use your proprietary boards from Industrial Shields, as you pt. waste the time for several developers trying to use your code for standard Arduino boards.

Error : 'MODBUS_TCP_ADU_SIZE' was not declared in this scope

I have an error message from ModbusTCPMasterReadInputRegisters example.
I can use the Arduino Yun only.
I am in Mongolia, I can not buy other devices and arduino ethernet shield.
How can I fix the error?
I am an arduino beginer, please let me know the solution as possible as detailly(with fixing code).

Below is full error message.

In file included from C:\arduino_coding\modbus_TCP_test02\ModbusTCPMasterReadInputRegisters\ModbusTCPMasterReadInputRegisters.ino:19:0:

ModbusTCPMaster.h:37:16: error: 'MODBUS_TCP_ADU_SIZE' was not declared in this scope

uint8_t _adu[MODBUS_TCP_ADU_SIZE];

            ^

exit status 1
'MODBUS_TCP_ADU_SIZE' was not declared in this scope

Facing Compile Time Error

Hi,

I'm facing compile time error when compile for Arduino UNO OR ESP8266 board.

In file included from C:\Users\Najaf Haider\Documents\Arduino\libraries\arduino-Tools40-master\examples\Modbus\ModbusTCPMasterReadInputRegisters\ModbusTCPMasterReadInputRegisters.ino:19:0:
C:\Users\Najaf Haider\Documents\Arduino\libraries\arduino-Tools40-master\src/ModbusTCPMaster.h:38:15: error: 'MODBUS_TCP_ADU_SIZE' was not declared in this scope
uint8_t _adu[MODBUS_TCP_ADU_SIZE];
^~~~~~~~~~~~~~~~~~~
C:\Users\Najaf Haider\Documents\Arduino\libraries\arduino-Tools40-master\src/ModbusTCPMaster.h:38:15: note: suggested alternative: 'MODBUS_PDU_SIZE'
uint8_t _adu[MODBUS_TCP_ADU_SIZE];
^~~~~~~~~~~~~~~~~~~
MODBUS_PDU_SIZE
Using library Ethernet at version 2.0.0 in folder: C:\Program Files (x86)\Arduino\libraries\Ethernet
Using library arduino-Tools40-master at version 1.0.0-beta in folder: C:\Users\Najaf Haider\Documents\Arduino\libraries\arduino-Tools40-master
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI
exit status 1
Error compiling for board Arduino Uno.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.