Teltonika FMB125 Modbus RTU with Azure IoT Hub Cloud-To-Device

Hi, I have FMB125 device connected to Azure IoT Hub, the device is managed to received message from IoT Hub using the cloud-2-device functions. The following is the response from the device after receiving message from IoT Hub.

[2024.04.28 05:47:17]-[NETWORK] [IND] received data from socket!
[2024.04.28 05:47:17]-[NETWORK] notification, socket id: 5 has data which must be read!
[2024.04.28 05:47:17]-[NETWORK] VR socket 0, real socket id: 5, attempt automatic data reading for application
[2024.04.28 05:47:17]-[NETWORK] attempting to read data from socked id (real): 5
[2024.04.28 05:47:17]-[MQTT] Received MQTT data from socket: 0, 000000000000000D0C010500000005676574696F01000000CB

[2024.04.28 05:47:17]-[JSON] ERROR @ m2m_json.c(109):Parsing failed (1)[2024.04.28 05:47:17]-[MQTT] ERROR @ m2m_mqtt_commands.c(25):Could not get GPRS command from JSON at 25

I want to know what is the right command to send to the device so that I can get a response from the device as I am getting parsing failed error. The command “000000000000000D0C010500000005676574696F01000000CB” is example from the codec12 documentions: Codec - Wiki Knowledge Base | Teltonika GPS (teltonika-gps.com)

Any detail instructions?

Your device doesn’t seem to be sending the correct json data.
For the parser to work, you must have the json codec enabled in the tracker.

Thanks so much for the input, is there a JSON format that can construct the codec12 so that I can request data from the Modbus RTU sensors? Upon research, the JSON can receive SMS command, but I don’t see anything related the Modbus data.

I enabled the json codec here:

and here:

image

I followed this manual for AWS service and it works for me:

1 Like

Hi

Can you send me a screenshot of how did you send the codec12 command from your azure platform?

Best Regards
Maynard C

Hi Maynard,

I use the message to device function to send the codec12

I also send the message to the device using the json format. for example the following code:
{“CMD”:“getinfo”}. The device does response to this code correctly. My question is there a method where I can send codec12 in json format?

Hello

Please try to send the Modbus command directly using the format {“CMD”: “<Command>”}

Without converting to codec 12:

Example
{“CMD”:“ 01 03 0000 0008 440C”}

If it didn’t work please try to removed the space

Please let me know the results.

Best Regards
Maynard C

Hi Mynard,

I have try to send the codec12 command using the json format, and this is what i received from the device:
[2024.05.01 06:55:56]-[MQTT] Received MQTT data from socket: 0, {???CMD???:??? 01 03 0000 0008 440C???}
[2024.05.01 06:55:56]-[JSON] ERROR @ m2m_json.c(109):Parsing failed (-2)[2024.05.01 06:55:56]-[MQTT] ERROR @ m2m_mqtt_commands.c(25):Could not get GPRS command from JSON at 25
[2024.05.01 06:55:57]-[NETWORK] [IND] received data from socket!

If I send the command without the spaces:

[2024.05.01 06:44:34]-[MQTT] Received MQTT data from socket: 0, {“CMD”:“000000000000000D0C010500000005676574696F01000000CB”}
[2024.05.01 06:44:34]-[MQTT] MQTT GPRS command: 000000000000000D0C010500000005676574696F01000000CB
[2024.05.01 06:44:34]-[GPRS.CMD] WARNING @ 396:unknown command
[2024.05.01 06:44:34]-[MQTT] JSON BUFF - {“RSP”:“unknown command or invalid format”}

Please advise, thank you very much!

Hi Mynard,

After I resend the data i am still getting the similar error:

[2024.05.01 14:57:32]-[MQTT] Received MQTT data from socket: 0, {“CMD”:“01 03 0000 0008 440C”}
[2024.05.01 14:57:32]-[MQTT] MQTT GPRS command: 01 03 0000 0008 440C
[2024.05.01 14:57:32]-[GPRS.CMD] WARNING @ 396:unknown command
[2024.05.01 14:57:32]-[MQTT] JSON BUFF - {“RSP”:“unknown command or invalid format”}

Thank you.

Hi @soonjoo

Thank you for your feedback, it seems the command is not supported using the Azure platform for Modbus, please try to test it using Hercules.

For your testing or POC if you have access to HD please create a ticket or contact your sales manager so that Teltonika Engineers can assist you with your project.

Or contact us through our official website our official website https://teltonika-gps.com/ and click on the “Contact Us” button. When you will click, please fill the form and submit it. Note: as a topic, please choose “Vehicle telematics”

Best Regards
Maynard C

Hi Mynard,

I have the system settings to codec8, and this is the error message i received on the device:

[2024.05.03 09:17:21]-[NETWORK] attempting to read data from socked id (real): 4
[2024.05.03 09:17:21]-[MQTT] Received MQTT data from socket: 0, 00000000 00000010 0C 01 0E 00000008 010300000008440C 01 00001181

[2024.05.03 09:17:21]-[GPRS.CMD] WARNING @ 154:Invalid cmd header (not 4 zero)

Do you think there are still chance we can send the command via Azure IoT Hub?

we managed to send the message in codec12 but gotten the following error:
[2024.05.04 11:21:01]-[NETWORK.PARSER] GPRS CMD Detected!

[2024.05.04 11:21:01]-[GPRS.CMD] CID: 12, NOD: 1, CMD: 5, data len: 28, CRC: 8AA4
[2024.05.04 11:21:01]-[GPRS.CMD] ERROR @ m2m_network_gprs_cmd.c(418):Cant make codec12 packet, provided len:0
[2024.05.04 11:21:01]-[REC.SEND.2] WARNING @ 1022:Failed to create packet

We send this command to get the response from our modbus sensor:

00000000000000100C020E00000008010400010002200B0200001182

Please advice. Thank you.

Hi @soonjoo

Thank you for this additional information, can you make an HD ticket for this and include all of these details?

Our team needs to analyze this situation through the Helpdesk or via your sales manager.

Best Regards
Maynard C

This topic was automatically closed after 11 days. New replies are no longer allowed.