Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » memory access error(Raspberry 3b+ memory access error when trying to connect to mqtt broker)
memory access error [message #1827775] Sat, 23 May 2020 10:36 Go to next message
Christian Eugster is currently offline Christian EugsterFriend
Messages: 195
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
Hi
I try to run a small c program, that receives messages via lora and transfers these messages to an mqtt broker residing on another host.
Running the program fails because of a memory access error when the connection to the mqtt broker is established. For the code of the mqtt part I followed the example on the Paho site (https://www.eclipse.org/paho/files/mqttdoc/MQTTClient/html/pubsync.html
I am able to compile my own source code (see uploaded file). I am not experienced in c programming (normally java) so I appreciate any help on this topic. Thank you!
Christian
Re: memory access error [message #1827777 is a reply to message #1827775] Sat, 23 May 2020 12:29 Go to previous messageGo to next message
Ian Craggs is currently offline Ian CraggsFriend
Messages: 76
Registered: March 2013
Member
You haven't checked the return value from MQTTClient_create(). It will have failed because "http" is not a protocol supported by the API.
Re: memory access error [message #1827783 is a reply to message #1827777] Sat, 23 May 2020 17:37 Go to previous message
Christian Eugster is currently offline Christian EugsterFriend
Messages: 195
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
Hi Ian
thank you for helping. I corrected the protocol to tcp and now the program runs until it tries to publish the message to broker. Here I get error -5 that says:
/**
 * Return code: An invalid UTF-8 string has been detected.
 */
#define MQTTCLIENT_BAD_UTF8_STRING -5

The terminal log looks like so:
Starting rf95_server
Content of rf95_server.ini
project=ch_001659_2
dest_addr=tcp://192.168.1.65:1883
client_id=gs16

RF95 CS=GPIO25, IRQ=GPIO4, RST=GPIO17, LED=GPIO255 OK NodeID=1 @ 868.00MHz
Create MQTT client
Connect to MQTT broker on tcp://192.168.1.65:1883
Listening packet...
Packet[07] #255 => #255 -25dB:
 01 67 00 00 02 68 00
Publish failed: -5

rf95_server ending

How can I update the code, so that this error does no longer show up? Is it eventually the object buf that contains wrong value? If so how do I convert the buff to utf8? The buf comes from an arduino device. Maybe I have to solve this there, but how?
I uploaded the changed source file.
Thank you!
Christian
Previous Topic:Non SSL connection with paho-mqttas lib
Next Topic:How to handle MQTTCLIENT_BAD_UTF8_STRING error
Goto Forum:
  


Current Time: Fri Oct 23 09:33:22 GMT 2020

Powered by FUDForum. Page generated in 0.01675 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top