Serial monitor gets blocked when calling "ModbusRTUClient.begin(9600)"

Hi,

I am having this problem whit my device/code. since I updated the NINA firmware. The serial monitor gets periodically blocked because of a busy serial port.
Is it possible there is a bug in the code of the "arduinomodbus" library? And how can I fix it?
does

screenshot1


screenshot2

|Type:|Arduino MKR WiFi 1010|
|FQBN:|arduino:samd:mkrwifi1010|
|Serial Number:|Unavailable|
|NINA Firmware:|1.4.5|

I use a MKR 485 shield in combination with the mkr wifi 1010

Small Code

*/

#include "thingProperties.h"
#include <ArduinoModbus.h>


void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(9600);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500); 

  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  /*
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you’ll get.
     The default is 0 (only errors).
     Maximum is 4
 */
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();

  Serial.println("Modbus RTU Client");
   
  
  // start the Modbus RTU client
  if (!ModbusRTUClient.begin(9600)) {
    
    while (1);
  }
  
  
}

void loop() {
  ArduinoCloud.update();
  // Your code here 
  
  
}

What does that mean? There is no periodical output from your sketch.

Probably not but of course bugs are always possible.

To actually debug that problem please install the Arduino IDE and use the serial monitor there. Using the web editor there might be issues with the browser in accessing the hardware.

I think my MKR WIFI 1010 doesn't recognize the MKR 485 shield anymore en uses the serial port of my computer (USB) to communicate instead of the slaves. Is there a method tot test the communication between both (MKR wifi 1010 and the MKR 485 shield)?

You can print anything to the Serial1 interface.

That's not recognized by the hardware but set by the software at compile time. Did you choose the correct board while compiling?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.