Hi,
I'm doing a project on a custom 32u4 board (setup as Micro) with Caterina bootloader, using this ModbusSlave lib. I'm trying to communicate with a Modbus master. My program communicates with a Modbus master via h/w Serial1. Receiving data works fine, but writing data back to the master fails unless I assert DTR on USB Serial first.
This is the ModbusSlave.cpp transmit procedure (lines 374-380):
// send buffer
serial.write(bufOut, lengthOut);
// wait for the transmission of outgoing data
// to complete and then set rs485 control pin to read
// [ on SoftwareSerial use delay ? ]
serial.flush();
then nothing is output on serial, unless I assert DTR on Serial. I know the board is running without the Serial, I tried with a LED blink etc.
Note:
- serial is initialized as Serial1 = h/w serial prot
- Serial is SerialUSB = USB serial port
I don't see why Serial1 is looking for DTR on Serial.
Hope someone has some suggestions..
Mach3_BOB.h (340 Bytes)
Mach3_BOB_error.ino (2.36 KB)