Giter Club home page Giter Club logo

Comments (8)

aggarg avatar aggarg commented on July 18, 2024 1

I started with a fresh Ubuntu 16.04 machine and I was able to build by following the getting started guide here: https://docs.aws.amazon.com/freertos/latest/userguide/getting_started_espressif.html

Here is my command history:

sudo apt-get update  
sudo apt install build-essential  
sudo apt install gcc git wget make libncurses-dev flex bison gperf python python-serial
wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
mkdir esp
cd esp
tar -xzf ~/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
cd ..
vim ~/.profile
source ~/.profile
printenv PATH
git clone https://github.com/aws/amazon-freertos.git
cd amazon-freertos/demos/espressif/esp32_devkitc_esp_wrover_kit/make/
make

As mentioned in the getting started guide - "Do not install the ESP-IDF library from Espressif, Amazon FreeRTOS already contains this library. In addition, make sure the IDF_PATH environment variable has not been set."

For connecting to Local MQTT Broker, you need to make the following changes:

Hope that helps.

Thanks.

from amazon-freertos.

aggarg avatar aggarg commented on July 18, 2024

Hi,

Would you please share some more details about your setup:

Thanks.

from amazon-freertos.

Kasuhikdas avatar Kasuhikdas commented on July 18, 2024

from amazon-freertos.

Kasuhikdas avatar Kasuhikdas commented on July 18, 2024

I worked. It was happening because of IDF path.
MQTT with TLS is not connecting. Without TLS is connecting if i make democonfigMQTT_AGENT_CONNECT_FLAGS to 0

from amazon-freertos.

aggarg avatar aggarg commented on July 18, 2024

I am glad that it worked for you.

In order to use TLS, you need to set device certificate and key in file https://github.com/aws/amazon-freertos/blob/master/demos/common/include/aws_clientcredential_keys.h. In addition to that you need to supply the server certificate in MQTT Connect parameters (pcCertificate and ulCertificateSize members of the following struct):

typedef struct MQTTAgentConnectParams
{
    const char * pcURL;             /**< The URL of the MQTT broker to connect to. */
    BaseType_t xFlags;              /**< Flags to control the behavior of MQTT connect. */
    BaseType_t xURLIsIPAddress;     /**< Deprecated. Set the mqttagentURL_IS_IP_ADDRESS bit in xFlags instead. */
    uint16_t usPort;                /**< Port number at which MQTT broker is listening. This field is ignored if the mqttagentUSE_AWS_IOT_ALPN_443 flag is set. */
    const uint8_t * pucClientId;    /**< Client Identifier of the MQTT client. It should be unique per broker. */
    uint16_t usClientIdLength;      /**< The length of the client Id. */
    BaseType_t xSecuredConnection;  /**< Deprecated. Set the mqttagentREQUIRE_TLS bit in xFlags instead. */
    void * pvUserData;              /**< User data supplied back as it is in the callback. Can be NULL. */
    MQTTAgentCallback_t pxCallback; /**< Callback used to report various events. In addition to other events, this callback is invoked for the publish
                                     *   messages received on the topics for which the user has not registered any subscription callback. Can be NULL. */
    char * pcCertificate;           /**< Certificate used for secure connection. Can be NULL. If it is NULL, the one specified in the aws_credential_keys.h is used. */
    uint32_t ulCertificateSize;     /**< Size of certificate used for secure connection. */
} MQTTAgentConnectParams_t;

Also, if your broker runs on port 8883, the value of xFlags should not contain mqttagentUSE_AWS_IOT_ALPN_443:

xConnectParams.xFlags = mqttagentREQUIRE_TLS;

You will need to change the code in function prvCreateClientAndConnectToBroker in the file https://github.com/aws/amazon-freertos/blob/master/demos/common/mqtt/aws_hello_world.c.

Hope that helps.

Thanks.

from amazon-freertos.

Kasuhikdas avatar Kasuhikdas commented on July 18, 2024

Did the same thing. Configured the keys also. But it is not connecting.
These keys works wth esp-idf also.
No error while packet tracing also. Can i also put CA cert in place of clientcredentialJITR_DEVICE_CERTIFICATE_AUTHORITY_PEM ??

from amazon-freertos.

aggarg avatar aggarg commented on July 18, 2024

You should not need to change clientcredentialJITR_DEVICE_CERTIFICATE_AUTHORITY_PEM in order to connect to local broker.

Which local broker are you using? If that comes with a client, can you verify that key and certificates work with that client?

from amazon-freertos.

Kasuhikdas avatar Kasuhikdas commented on July 18, 2024

Thanks It worked.

from amazon-freertos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.