#include <Modbusino.h>
/* Initialize the slave with the ID 1 */
ModbusinoSlave modbusino_slave(1);
/* Allocate a mapping of 10 values */
uint16_t tab_reg[10];
void setup() {
/* The transfer speed is set to 115200 bauds */
modbusino_slave.setup(19200);
}
void loop() {
/* Initialize the first register to have a value to read */
tab_reg[0] = 0x3001;
/* Launch Modbus slave loop with:
- pointer to the mapping
- max values of mapping */
modbusino_slave.loop(tab_reg, 10);
}
Both sketches work perfectly fine on Arduino Uno R3 (with 10 and 0 as values on registers). However, when I try Nano, some weird thing happens: when I connect RX pin, the LED on XY-017 indicating RX activity turns off. TX pin does not affect the LEDs. However, while trying on Uno both LEDs (TX and RX) blink in sync. I tried to swap the wires - no result.
There is a configurator for my device where I can see the values on registers and redefine addresses, so there is no problem to change address. Arduino is the only slave in the network.
Maybe I just don't know how to google, but this thing is bothering me for a week or so. Please help me, or show me that I just don't search enough. Thank you in advance!
P.S. I also tested with old Nano (which is using old bootloader) - when I do all the things as above, the RX LED on Arduino starts to blink. No reaction for TX LED, though
Hello! I'm interested in communication, obviously. Nano don't send any information at all (not even blink).
I heard there are some differences in the serial between Uno and Nano
Good question.
I have never used any slave library with software serial.
I had a quick look at the library I linked, and I have to tell that it's very confusing how to setup the registers. Sorry for that.
The library that I have been using for slave is this:
Never tried with SS, but you could try.
I'm still surprised if original Nano has a problem using UART pins. There is a difference between USB-serial approach of nano and uno, but what you experiment is quite weird and I have never heard of it.