Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    AwsSendDataOverMQTT

    Highlighted
    Member

    AwsSendDataOverMQTT

    Hi all,

    I have been trying to implement the example code from the 'AwsSendDataOverMQTT' example which is found at this link.

    https://developer.bosch.com/web/xdk/awssenddataovermqtt#

    I have followed all of the instructions, however when I run the code, I get the error:

    Error in XDK110 Application Package

    PackageID: 153 (which corresponds to XDK Application)

    ModuleID: 50 (Corresponds to XDK_common_ID_Storage)

    Severity code: 2 (corresponds to Error)

    Error code: 159 (I couldn't find this error code)

    I am hoping someone can help me work out how to fix a storage error and what this error means. I have attached a clip of the console output. 

    Thanks

    Stallion

     

    10 REPLIES 10
    Highlighted
    Occasional Contributor

    Re: AwsSendDataOverMQTT

    Hello Stallion

    Error came from Storage Module and Error code: 159 is due to "RETCODE_STORAGE_ERROR_IN_GETTING_FILE_STATUS".

    There is some problem while accessing the file from the sdcard.

    Have you placed the generated certificates, after converting to .der format along with config.txt file, in the SD Card?

    Please make sure file is available in sdcard.

    Once the application runs successfully, the files in the SD card are being converted to .bkp

    Highlighted
    Member

    Re: AwsSendDataOverMQTT

    Hi Mahalingam,

     

    Thank you so much for your reply. I have since corrected some things that were causing these errors, I think there were a few things incorrect in this documentation. https://developer.bosch.com/web/xdk/awssenddataovermqtt.

    The things I did

    - When downloading the rootCA file from the link, the file format is '.pem', renaming the file with '.der' at the end, did not change the file format.

    - All of the files on the SD card are named WITHOUT their extensions. What I mean by this, is that the SD card has files:

    config, rootCA, xdk-priv and xdk-cert

    NOT

    config.txt, rootCA.der, 'xdk-priv.der', 'xdk-cert.der'.

    Now with this modifications, the project is runnning past that error, and begins preparing the WPA2 connection. The console shows this information

    INFO | XDK DEVICE 1: WLAN_Enable : Preparing for Personal WPA2 connection
    INFO | XDK DEVICE 1: This is a CC3100R device
    INFO | XDK DEVICE 1: CHIP 0x4000000
    INFO | XDK DEVICE 1: MAC 31.1.2.0.2
    INFO | XDK DEVICE 1: PHY 1.0.3.23
    INFO | XDK DEVICE 1: NWP 2.2.0.1
    INFO | XDK DEVICE 1: ROM 0x3333
    INFO | XDK DEVICE 1: HOST 1.0.1.11

    for about 2 minutes, then suddenly I recieve an AppControllerEnable: Failed error. I have attached the console output. During this time, nothing appears to be printing to the AWS. I am hoping you can help me work out what is causing this error and how to fix it.

    Stallion

    Highlighted
    Established Member

    Re: AwsSendDataOverMQTT

    Hi Stallion,

    To change certificate or key formats, it is not sufficient to just rename them, but to use a tool like the OpenSSL console for this purpose. There are online tools, but it is bad practice to expose private keys, especially to 3rd parties.

    Run the OpenSSL console to convert the certificates and keys to DER

    openssl x509 -outform der -in Downloaded-certificate.pem -out xdk-cert.der
    openssl rsa -outform der -in Downloaded-private.pem -out xdk-priv.der

    The root CA provided by AWS does not work directly with our SimpleLink network processor, so it needs the Starfield Class 2 CA.https://ssl-ccp.secureserver.net/repository/sf-class2-root.cer The CER extension is already in DER format, so just rename this certificate to rootCA.der

    In our next workbench release we will provide this updated certificate.

    The handshake takes over one minute to complete, if this step fails, it is probably due to issues in the certificate chain.

    • A successful handshake may take over one minute
    • The Amazon Root Certificate does not work with the CC3100R device, as it does not get validation. For getting a successful connection you need the Starfield Class 2 Certificate. Sf-class2-root.cer
    • For some reason there is no SNI extension being sent by the CC3100R in the Client Hello Message, which is mandatory to present to AWS endpoints.
    • In the config.txt file, the MQTT client Id should not be the same as the AWS tenant ID (as suggested in the tutorial)
    • All other steps work as in the tutorial.
    • The sensor data payload has a bad formatting. Here removing the \“ around the numeric values will make the JSON parser interpret them as numbers and not strings

    Best regards,

    Francisco

    Highlighted
    Member

    Re: AwsSendDataOverMQTT

    Hi Francisco,

    I had no problem changing the keys using git bash, as the tutorial explained. I downloaded the rootCA file that you linked and renamed it as you specified, however when I flash the application I get the same error as in the original post. As a result, a .bkp file for the rootCA certificate is not formed, while the other certificates do have one. A few questions about your last message

    - what is a 'handshake'?

    - Do you possibly have an image of the SNI extension in the client message which I am supposed to be recieving 

    - if the MQTT client id is not the 'xyz' of 'xyz.iot.ap-southeast-2-amazonaws.com', then what is it supposed to be?

    Another question, are we supposed to be replacing the certificates from the project in XDK workbench (C:\Users\mitch\XDK-Workspace\AwsSendDataOverMQTT\source\config) with those that are generated from AWS, or is this done automatically by the project?

     

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist