Code Monkey home page Code Monkey logo

Comments (4)

engeen-nl avatar engeen-nl commented on June 15, 2024 1

I had the same problem using the MKR 1310 with the RS485 shield when powering it trough the RS485 shield. Apparently the MKR 1310's BQ24195L needs to be configured in such a way to generate 5V on the 5V pin for the shield to work. I wasn't able to do this but the shield makes a beautiful 5V on the Vin pin. For now I jumper the Vin and 5V pins and communication keeps going without the USB connected.

I don't know why you cannot debug over USB though, I don't have a problem doing so. Did you increase the baudrate? I'm using Serial.begin(115200); and ModbusRTUClient.begin(19200, SERIAL_8N2); What I do notice is a delay is needed after writing or reading registers. I'm using 4 ms. But that can be because of my nodes. Anyone else has the same experience?

To bad ModbusRTUClient.setTimeout is not available yet in the latest version in the Library. Instead I adjusted ModbusRTUClient.cpp:
modbus_set_response_timeout(mb, 0, 5000);

Be careful, the third parameter of modbus_set_response_timeout is microseconds. So 5000 means 5 milliseconds.

from arduinomodbus.

cheetor5923 avatar cheetor5923 commented on June 15, 2024

Ahh I see it's a SAMD21G based board. They're unusually picky about SerialUSB.. It's really hard to see what is going on truely without a debugger like a Atmel-ICE...
First off I'd look at lowering the super long 1 second timeout in the library so a much more sensible number... I chose 5ms, a sensible timeout for modbus operating at 56700bps. 1 second is way too long.

ModbusRTUClient.setTimeout(5); //large timeouts need to be avoided
RS485.setTimeout(5);
MODBUS_PORT.begin(57600);
ModbusRTUClient.begin(57600);

from arduinomodbus.

MachineSaver avatar MachineSaver commented on June 15, 2024

@vri-sst I know this is probably not the place to request help but I see from your response that you've been using the MKR1010 and an MKR485 shield and successfully reading/writing the holding registers. I am trying to do the same using the Arduino as a Modbus Server. I have used the "kitchen sink" example but I cannot read the holding registers that are setup in the example from the Arduino. I have no issue reading coils when using the "LED" example which sets up coils. Any help or pointing in the right direction would be much appreciated.

from arduinomodbus.

mikdur avatar mikdur commented on June 15, 2024

This same issue appears with the MKR1400 when powering it through the MKR RS485 shield. Following @engeen-nl 's suggestion to put a jumper between 5V and Vin is an interim workaround. However, when powering the modules through the attached LiPo accumulator, the RS485 shield will not respond either.

The only two cases I identified where RS485 works as expected is when the MKR1400 is powered through USB or when it is powered through the screw connector on the RS485 shield with 5V and Vin connected to each other.

from arduinomodbus.

Related Issues (20)

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.