I am completely new to MODBUS. I am trying to communicate with a MFM384c energy meter using a sparkfun bob-09822 usb-rs485 converter using MODSCAN32 for now. I am unable to understand the response at all.
The query sent is:01 03 00 00 00 02 c4 0b
The response is:00 40 20 41 20 7a 40 81 3f
It doesn't appear to be an error response.
Any Guidance is much appreciated.
The response makes no sense whatsoever.
I suspect that you have a serial port settings mismatch.
The spec sheet says it is Modbus RTU so the word size should be 8 bits.
Check your baud rate, parity setting, and the number of stop bits are the same for both the master (ModScan) and the slave (MFM).
Apologies for the delayed reply.
We have been relentlessly trying different things but nothing seems to work.
- We changed the stop bits from 1 to 2 for no parity with same results.
- We changed the parity to odd with same results.
- Any mismatch in parameters results in the meter not responding at all.
- If we change the function code to 03 or 04 or 02, the number of bytes matches but again they start with 00 followed by 40.
Not sure in what the fault lies.
Again Any help is much appreciated.
Because you're getting a response from the meter with the baud rate and parity matching, this suggests that the meter is receiving a valid request and replying. However, the response is somehow being mangled.
I would be suspicious of your SparkFun converter. On the product page for that product, the first line states that there were issues with the last board and some user reviews had stated that receive data can go high without following incoming data. This seems too close to what you're seeing to be a coincidence.
I suggest that you try a different USB to RS-485 converter and see if that solves your problem.
My apologies for bad advice in my initial reply.
I should have realized that a reply of any sort means that the slave recognized its ID, the CRC checked out and that the message was formatted properly for the slave to interpret and generate a reply, which means that the serial settings match.
Let us know what you find with the converter.
Okay. Thanks for the input.
We will be changing the converter. We are going with the
USB-RS485-WE-1800-BT converter cable by FTDI for this try.
Meanwhile we have come across a flow meter with rs485 port and modbusRTU and shall be trying the sparkfun converter on that too.
We will let you know the results soon!
Thanks and Regards,