Giga R1 and Modbus RTU

I need to read information from a Fronius Smart Metter TS100A-1.
For this , I used ModbusRtu.h library and module RS485 max connected to Mega 2560
The sample from library function very well.
When I changed Mega 2560 with Giga R1, communication didn't function.
Do you know what library can be used for Giga R1?

#include <ModbusRtu.h>

// data array for modbus network sharing
uint16_t au16data[1];
uint8_t u8state;

/**

Modbus object declaration
u8id : node id = 0 for master, = 1..247 for slave
u8serno : serial port (use 0 for Serial)
u8txenpin : 0 for RS-232 and USB-FTDI
or any pin number > 1 for RS-485
*/
Modbus master(0, Serial2,12); 
/**

This is an structe which contains a query to an slave device
*/
modbus_t telegram;
unsigned long u32wait;

void setup() {
    Serial.begin(9600);
    master.begin( 9600 ); // baud-rate at 9600
    master.setTimeOut( 2000 ); // if there is no answer in 2000 ms, roll over
    u32wait = millis() + 1000;
    u8state = 0;
    delay(1000);
}

void loop() {
    switch( u8state ) {
      case 0:
          if (millis() > u32wait) u8state++; // wait state
            break;
      case 1:
            telegram.u8id = 1; // slave address
            telegram.u8fct = 3; // function code (this one is registers read)
            telegram.u16RegAdd = 4; // start address in slave
            telegram.u16CoilsNo = 1; // number of elements (coils or registers) to read
            telegram.au16reg = au16data; // pointer to a memory array in the Arduino

            master.query( telegram ); // send query (only once)
            u8state++;
            break;
      case 2:
          master.poll(); // check incoming messages
          if (master.getState() == COM_IDLE) {
            u8state = 0;
            u32wait = millis() + 100;
          }
          break;
    }
    Serial.println(au16data[0]);
    delay(1000);
}

Hi, I am not exactly sure [ I am thinking of using a giga with modbus myself ] , but Giga R1 is 3.3v and Mega 2560 is 5v I think that if you are using the exact same setup that you used on the mega, it may be a voltage issue

not knowing the exact connections, i would second the "voltage issue".
i know the datasheet i read on the MAX485 is that it requires 5v, and the Giga 3.3v. i would suggest a logic level shifter between the 3.3v Giga serial port, and the MAX485 module's serial connections. then the MAX485 can be correctly powered by 5v.

Hope this helps :slight_smile: as i have similar plans (Modbus) when my Giga arrives on friday :slight_smile:

Hi there,

further results to the Question "GIGA R1 and ModbusRtu.h"? The tests I just made indicate, that the problem is not one of transceiver voltage! I just got connection with my Client-App to the eMeter Modbus network from my code on MEGA 2560, but none from the same Code on GIGA R1, connected by 3.3 V transciever as well as by the 5.0 V version!

I appreciate your comments or informations!

Daniel