Portenta machine control ModbusRTU to Servo Driver Lexium32M (Invalid argument)

I would like to communicate via Modbus RS485 between an arduino pro portenta machine control card and a Schneider Lexium32M servo driver, the problem is that I manage to report an "Invalid argument" error via the ModbusRTUClient.lastError() function of the ArduinoModbus.h library
but no idea of ​​how put the "good" argument because even when I use a sample program all done without changing anything I get the same error.

If you can help me find the right "synthax" or even find a piece of Modbus code that is able to call the function: R/W Coils R/W handling register etc...

/*
  Modbus RTU Client Toggle
  This sketch toggles the coil of a Modbus RTU server connected via RS485
  on and off every second.
  Circuit:
   - MKR board
   - MKR 485 shield
     - ISO GND connected to GND of the Modbus RTU server
     - Y connected to A/Y of the Modbus RTU server
     - Z connected to B/Z of the Modbus RTU server
     - Jumper positions
       - FULL set to OFF
       - Z \/\/ Y set to ON
  created 16 July 2018
  by Sandeep Mistry
*/

#include <ArduinoRS485.h> // ArduinoModbus depends on the ArduinoRS485 library
#include <ArduinoModbus.h>
#include "Arduino_MachineControl.h"

using namespace machinecontrol;

void setup() {
  Serial.begin(9600);
  while (!Serial);

  Serial.println("Modbus RTU Client Toggle");
  comm_protocols.init();
  comm_protocols.rs485Enable(true);
  comm_protocols.rs485.begin(9600, 0, 500);
  comm_protocols.rs485.receive();
  // start the Modbus RTU client
}

void loop() {
  
  if(ModbusRTUClient.holdingRegisterRead(0x0178)== -1){
    Serial.println(ModbusRTUClient.lastError());
  }
  Serial.println(ModbusRTUClient.available());
  

  // wait for 1 second
  delay(1000);
}

:warning:
Post mis dans la mauvaise section, on parle anglais dans les forums généraux. déplacé vers le forum francophone.

Merci de prendre en compte les recommandations listées dans Les bonnes pratiques du Forum Francophone

Merci, je n'avais pas fait attention, pour trouver plus de potentiel personne qui peuvent m'aider j'ai traduit mon post en anglais.

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