Closed puneethintellithink closed 2 years ago
@emelianov Request you to share your 2 cents on this
Hi, I am not a ModBus specialist, but the manual of your sensor on pages 26 and 47 says :
Settings on the energy meter: Network - Single Phase (V1) BaudRate - 9600 Parity - None <----------------- StopBits - 1
So I suggest, you should set
Serial2.begin(BAUD_RATE, SERIAL_8E1);
to Serial2.begin(BAUD_RATE, SERIAL_8N1);
.
I am not familiar with the second paramerter of
mb.begin(&Serial2, RS485_MODE);
but as I understand the library, you hand over that the txPin is N°15 (RS485_MODE) ...?
In my little test programs I only use
mb.begin(&Serial2);
mb.master();
and it still works.
After a look at the datasheet of the TD321D485H transreceiver I do not see a pin to connect with 'RS485_MODE' ? On page 3 there is a pretty straight forward schematic, where you can only connect rx/tx gnd & vcc ...
Hi, I am not a ModBus specialist, but the manual of your sensor on pages 26 and 47 says :
Settings on the energy meter: Network - Single Phase (V1) BaudRate - 9600 Parity - None <----------------- StopBits - 1 So I suggest, you should set
Serial2.begin(BAUD_RATE, SERIAL_8E1);
toSerial2.begin(BAUD_RATE, SERIAL_8N1);
I setup the energy meter with new parameters as mentioned below and written in my code, viz, Network - Single Phase (V1) BaudRate - 9600 Parity - Even StopBits - 1
. I am not familiar with the second paramerter of
mb.begin(&Serial2, RS485_MODE);
but as I understand the library, you hand over that the txPin is N°15 (RS485_MODE) ...? In my little test programs I only usemb.begin(&Serial2); mb.master();
and it still works.
After a look at the datasheet of the TD321D485H transreceiver I do not see a pin to connect with 'RS485_MODE' ? On page 3 there is a pretty straight forward schematic, where you can only connect rx/tx gnd & vcc ...
I might have attached a wrong PDF. It's updated now. Please re-click on the link to find the RS-485 module's application notes. As you go through the pdf, you will find the following typical application circuit on page 3.
OK, I see...
Unfortunately I can't help with this issue.
First I thought, that 8N1 is mandatory with Modbus, but the specs allow also 'even' or 'odd' parity checking. (https://modbus.org/docs/Modbus_over_serial_line_V1_02.pdf)
I also had (have) some troubles with my application, to dig in deeper I bought some cheap USB to RS485 converter. (eg. https://www.banggood.com/de/USB-To-RS485-Converter-USB-485-With-TVS-Transient-Protection-Function-With-Signal-Indicator-p-1383027.html?cur_warehouse=CN&rmmds=search) With some PC tools like qModMaster (https://sourceforge.net/projects/qmodmaster/) you can directly can connect your PC to the ModBus device and can check if the module is working.
This helps me to understand the whole things better...
@puneethintellithink
It looks like TD321D485H uses inverse logic for data direction control. Try (note mb.begin()):
void setup()
{
Serial.begin(BAUD_RATE);
Serial2.begin(BAUD_RATE, SERIAL_8E1);
Serial.println();
Serial.println("START");
Serial.println();
mb.begin(&Serial2, RS485_MODE, false);
mb.master();
Also double check communication settings are identical on MDM and ESP sides.
Hello guys,
Been trying to debug this since ages. Please help me. I understand it is a timeout error but I'm not able to figure why the library is throwing timeout error at me. Wiring, Code, everything attached below. Please let me know if you need more details. I will share them ASAP.
Trying to read registers for an energy meter MFM384 using RS-485 and TD321D485H transreceiver.
I'm trying to read the following registers: 40007 - SLAVE ID Type- Integer Size - 1
Settings on the energy meter: Network - Single Phase (V1) BaudRate - 9600 Parity - Even StopBits - 1
Using the code below: Modbus-8266 Library 4.0.0
Block Diagram:
Transreceiver connections: B - RS-485 -ve A - RS-485 +ve TX - Serial2 RX RX - Serial2 TX