RAK2470 Cant poll device

Hi, I am trying to get a result from a RAK2470 connected to a rs485 device. I have it connected to the device and communicating via I/o.Box. I also have another ttl connected to the device for testing. When I test via Simply Modbus, I get the required response. However, when I poll exactly the same poll to the device via the 2470, I get an error message “Modbus command check field: No response from salve device”. I have swapped tx/rx in case that was the problem, but no different.
I am using the same baud rate etc… Any thoughts?
Here’s the Modbus poll setup…


And here’s the 2470…

Hi @Andy ,

I haven’t used Simply Modbus Master so I am not sure on the settings on it. Is it working as expected? The value you get is very low, assuming that’s the value on the result column.

Few things to note as well, standard modbus registers are 16-bit in size On your setting you choose 32-bit. Also the expected response bytes are in red highlight which might indicate errors.

If you can share me the datasheet of the device with its corresponding register layout, I can try to have a look and see what IO.box settings we can test.

Thanks for the reply @carlrowan, I’ll provide all I can think of below. The idea of the screenshot showing the Simply Modbus was to show that the device is returning something…unlike the 2470. I also use a RAK7431 with this device and it works ok too.
Here is the settings of the device I’m connecting to…


Here is the poll that I currently use with the 7431, I’d like to get these producing a response from the slave.
01040002001451C5. So that’s 20 registers.

Here’s a paste of the RAK Serial Port Tool with the startup of the 7431…
EVENT:0:STARTUP
SYSLOG:4:OTAA Join Request
SYSLOG:4:OTAA Join Success
EVENT:1:JOIN_NETWORK
SYSLOG:4:LoRa Tx :
SYSLOG:4:DTU Tx : 01040002001451C5
SYSLOG:4:DTU Rx : 0104280000000045E9BEF6000000000000000045668C294159EB853EFAE148000000000000000044E1F7AEECC3
SYSLOG:4:LoRa Tx :
SYSLOG:4:LoRa Tx : 810001002E010104280000000045E9BEF6000000000000000045668C294159EB853EFAE148000000000000000044E1F7AEECC3

The decoded payload looks good from this device…ttn result…
“decoded_payload”: {
“1”: 0,
“2”: 7479.8701171875,
“3”: 0,
“4”: 0,
“5”: 3688.760009765625,
“6”: 13.619999885559082,
“7”: 0.49000000953674316,
“8”: 0,
“9”: 0,
“10”: 1807.739990234375

And this is the payload decoder…

function Decoder(bytes, port) {
var decoded = {};

// In your example payloads, Modbus starts after a 6-byte RAK header
var modbusStart = 6;

// Modbus RTU response layout:
// [slave][func][byteCount][data…][crcLo][crcHi]
var byteCount = bytes[modbusStart + 2];
var dataStart = modbusStart + 3;

// Safety: if payload is shorter than expected, bail gracefully
if (bytes.length < dataStart + byteCount) {
decoded[“error”] = “Truncated payload”;
return decoded;
}

// We expect float32 values (4 bytes each): 40 bytes => 10 floats
var buf = new ArrayBuffer(4);
var view = new DataView(buf);

var fieldId = 1; // this recreates your old ids: 1…10

for (var i = 0; i + 3 < byteCount; i += 4) {
view.setUint8(0, bytes[dataStart + i + 0]);
view.setUint8(1, bytes[dataStart + i + 1]);
view.setUint8(2, bytes[dataStart + i + 2]);
view.setUint8(3, bytes[dataStart + i + 3]);

// Big-endian float32 (matched your sample)
var num = view.getFloat32(0, false);

decoded[JSON.stringify(fieldId)] = num;
fieldId++;

}

return decoded;
}

So with all that information, I go back to the 2470, check the settings, but every time I select the “Check”, I get zero response.

Here are more screenshots of what I’m seeing…btw I’m using a usb c to connect to the RAK2470, as I can’t seem to get the usb serial connection (second one, first one failed) to the device. It seems to connect fine and I/O.box picks it up immediately. Is that ok?

No matter how I send the command, I get this…
image

Here is the setup I’m using to get the poll to match the RAK7431 exactly, however I still get the same response…no response from slave device (It’s actually spelt salve, but I assume it’s meant to be slave?

Hi @Andy ,

Based on this error. The communication wasn’t established between the RAK2470 and the Slave device. Can you confirm the connections of supply (VDD and GND) as well as the RS485 Bus A and B?

Hi @carlrowan , thanks for the reply. I’m only using A/B, as the device has it’s own power supply. I actually seem to be able to poll it more reliable this morning. It was really inconsistent, but ok for now.
Could I confirm a couple of things please? Currently the device is not connecting to the ttn.

  • Is it ok to use usb C for comms? It seems to work ok, except for when I try to save anything on the LoRaWan page, I get an error when I save (object object). The usb works fine for the RS485 page.

  • Is it fine to simply use the EUI, Application EUI and Application Key to manually create the device in ttn? Rather than using the integration to Onboard to The Things Stack Server?

Hi @Andy ,

Some thoughts I have:

  1. Try to connect the ground of your RS485 device and the RAK2470. Let’s see if you will have a more stable reading. Btw, if you have many tasks and try to read in one go via reload button, it can be that the UI is not displaying the values but it is actually polled. You can verify this ones you are connected to TTN and seeing the payload.
  2. USB connection is fine and should be the way. Can you please confirm the version of your IO.box and firmware version of your RAK2470?
  3. The Things Stack integration only works on eu server cluster of TTN. There are some integrations only possible in eu cluster. I am based in the Philippines and I use au cluster and do the OTAA keys and onboard manually. It is reliable to me so it is ok to do it manually.