Closed BasemTarek closed 4 years ago
Hello @BasemTarek,
I'm unfamiliar with the Lab_1 project you've baselined, though from what I've read thus far, it appears that application uses FreeRTOS to implement a button, and publishes the state of the button to IoT Core. To double-check, this application worked as intended?
Secondly, you were able to run the GreenGrass discovery demo successfully?
It's a good sign if both apps worked as it confirms your hardware, the app, and the demo can implement individual components of interest, and now it's just a matter of correctly splicing these components to a single app.
At a high-level, that suggests there's likely missing code to get the GreenGrass interface working with your Lab_1 application -- code that is present in the working GreenGrass Discovery Demo.
At a low-level, I see that the PINGREQ error report likely comes from this code. You could put a breakpoint at the ->send
function, and dive deeper into the stack to collect more details i.e. breadcrumbs that could lead us to the root cause. The PINGREQ is used in the linked code to send keepalives. There are several ways a send could fail, so more details can help limit the suspects.
Thank you @dachalco, your comment helped me but I didn't catch the root cause yet, also there are an error message 54 8555 [iot_thread] [ERROR][NET][85550] Error -27648 while sending data.
which precedes PINGREQ error, I found that this error comes from this IotNetworkAfr_Send(), so I am trying to catch the cause of this error.
I found that these two errors may be related to each other, because this ->send actually is a call to this IotNetworkAfr_Send().
Also if you check the attached logs file, there is an info message I (85847) lab_connection: LABCONNECTION_MQTT_DISCONNECTED
inform that the MQTT connection disconnected which precedes all the error messages, I had tried to find the cause of this "disconnecting action", it is likely that this disconnecting action might be the reason of the mentioned errors..!
Still don't know the cause of this disconnecting action.
Hi @BasemTarek,
I notice that your logs indicate that the connection to your Greengrass Core was successful. Also, the failure happens when trying to send a keep alive PINGREQ, which would happen after the expiry of the 60 second keep alive interval. If no MQTT packet is being sent for 60 seconds, is your application getting stuck somewhere?
Additionally, I'd suggest enabling debug logs, and either running the mqtt demo, or replacing the Greengrass endpoint and cert in your code with that of the AWS IoT broker, in order to determine if the issue lies with the use of Greengrass discovery, or elsewhere.
Thank you @muneebahmed10,
is your application getting stuck somewhere?
sure it stuck somewhere, can you help on that..!?
running the mqtt demo, or replacing the Greengrass endpoint and cert in your code with that of the AWS IoT broker, in order to determine if the issue lies with the use of Greengrass discovery, or elsewhere.
I don't know how this will be helpful, the Greengrass demo worked successfully, and the mqtt demo worked successfully, but separately.
Are there any updates..
Hi @BasemTarek ,
If the MQTT and Greengrass discovery demos are each working successfully for you, then I only have enough information to offer suggestions in debugging the errors you're encountering in your implementation.
Have you stepped through the code in a debugger, and found anywhere it's getting stuck? Could your code be waiting on a mutex or semaphore that isn't being incremented? I notice that after you call MQTT's publish, your code waits on a clean up semaphore, that only gets posted to when there's a LABCONNECTION_MQTT_DISCONNECTED event. Could your application be stuck there?
@BasemTarek ,
Did you get a chance to follow the steps mentioned in the above comment? Please let us know if there are any updates and if you need any further assistance on this issue.
@BasemTarek This topic has become inactive so I'm going to close the issue. Please reopen this if you have any questions or need any further assistance.
I am using ESP-32 as my FreeRTOS device, and Raspberry Pi3 as my Greengrass Core device.
And I am trying to publish MQTT messages to Greengrass core device then to AWS IoT Core, so I used the Greengrass Discovery library to discover the Greengrass Core device and the discovery process was done successfully, but when the code reach the part of publishing the message, errors appeared.
I am using this project (https://github.com/teuteuguy/amazon-freertos-workshop) to develop my application. And we edited the _establishMqttConnection() and lab_run() functions in the lab_connection.c file to be able to discover the Greengrass Core device and to publish my messages to my topic.
Then, the Greengrass device was discovered successfully, but no messages were received and the following errors appeared:
Lab1 was enabled in the workshop configuration.
The Thing and the topic are configured in the Greengrass group subscriptions.
This is my edited lab_connection.c file (https://gist.github.com/BasemTarek/10e64a16cce284ac2fd579cc0504d2ec)
This is the logs file of ESP-32 when running the code (https://gist.github.com/BasemTarek/8320eb0919d065273722cc7e87f68252)
And to make sure that there is no problem with the Greengrass Core device itself, I tried to run AWS IoT Greengrass discovery demo application on my FreeRTOS device (ESP-32), and it worked successfully.
I expected to receive a message when I subscribed to the configured topic, but this error
Failed to send PINGREQ
appeared and no message was received.Thank you!