Modbus Problems with NANO Every

Hi, I have a working test set-up where I have communication to a MEGA with my PC using a Modbus protocol. I’m using a USB to RS485 connector on the PC end that’s wired to a Drok TTL RS485 converter, which in turn is wired to the MEGA. On the computer I’m able to use Matlab to for the PC modbus client side and on the MEGA I’m using this modbus library to set it up as the server. I’m able to write and read from coils (holding registers are not working for some reason). I’ve written the following test code that blinks a light three times when coil 1 is set to a value of 1:

#include <modbusDevice.h>
#include <modbusSlave.h>
#include <modbusRegBank.h>
#include <modbus.h>

#define ledPin 10

modbusDevice regBank;
modbusSlave server;

void setup() {
  pinMode(ledPin, OUTPUT);
  regBank.set(1, 1);//Set to one so light flashes on load
  server._device = &regBank;

void loop() {;
    for (size_t i=1; i<=3; i++){
      Serial.println("light it up");
      digitalWrite(ledPin, HIGH);
      digitalWrite(ledPin, LOW);

So, the issue I’m having is when I run this on a NANO Every I’m not able to establish communication from Matlab. I’ve checked over my connections several hundred times and haven’t discovered anything wrong yet. Is there something in the Modbus libraries that doesn’t work with the NANO? Any help on this would be greatly appreciated. Also, this is the initial testing to set-up a network with 20 plus NANO server nodes that I need controlled from a PC client.


Rx/TX pin of Nano Every are Serial1

Ok, I see. Looking at libraries I'll have to change Serial to Serial1. I'll give it a try and report back.

I changed the code in these libraries to use serial1 and it worked - for a while. Unfortunately, I burnt another Nano Every. Initially everything was fine, I disconnected pins 0 & 1 and vin, plugged in the usb and uploaded the code. Then I unplugged the usb, plugged in my TX and RX pins along with 5V and Ground coming in from RS485<->TTL converter powered my vin with 12V, and it worked great I could read and write from coils. Then I set to work on debugging why I can’t read and write from holding registers. Then after a couple code changes while running under 12V I smelt the faint scent of death. I disconnected the power, tried plugging in the usb with everything disconnected and the main ATMega chip started smoking! What’s up with these dam things?