Forums - Shadow Connection Error

11 posts / 0 new
Last post
Shadow Connection Error
chilukuriashok90
Join Date: 25 Jun 18
Posts: 8
Posted: Mon, 2018-08-27 05:58

Hi 

I'm building the Onboard awsiot demo for QCA4020 (CBD20) evaluation kit and have used qca4020.or_.2.0-00048 SDk and aws-iot-device-sdk-embedded-C-2.3.0 release version.

I am following the steps as per mentioned in document 80-ya121-140-qca402xcdb2x_development_kit_user_guide.pdf.

Now I got problem when the device does shadow connects, the return error is -19 (NETWORK_X509_ROOT_CRT_PARSE_ERROR ).

 Is the aws_calist is the RSA 2048 bit key: VeriSign Class 3 Public Primary G5 root CA certificate  or RSA 2048 bit key: Amazon Root CA 1  or something else ??

Can you please help me on these? 

Thanks and Regards,

Ashok

 

 

   

 

 

  • Up0
  • Down0
c_rpedad
Profile picture
Join Date: 18 Jun 18
Location: San Jose
Posts: 317
Posted: Mon, 2018-08-27 11:36

Hi,

The aws demo inbuild used the NIST time standard. Please change the SNTP server to NTP.org  and verify

Please modify the file @Onboard_demo\src\ecosystem\aws\aws_util.h as below.
- //#define SNTPC_SVR_ADDR "132.163.97.4" //this needs to be commented, sometimes NIST time would cause some issue in parsing CA.
+ #define SNTPC_SVR_ADDR "pool.ntp.org” //this will add ntp as time server and no issue should be seen.

Let me know, if you still face some issue.

  • Up0
  • Down0
chilukuriashok90
Join Date: 25 Jun 18
Posts: 8
Posted: Tue, 2018-08-28 02:23

 

Hi raja_pedada,

Thanks for reply.

As per your suggestion,I have changed SNTPC_SVR_ADDR to pool.ntp.org in new qca4020.or_.2.0-00048  SDK with AWS IoT SDK Version 2.3.0.But doesn't seem to be working. Device is getting stuck after two times host resolution retries. 

Can you please help on these??

Here is the logs,

Onboard: Waiting for Onboard events ...

Onboard: IPADDR:6800a8c0, MSK:ffffff, GW:100a8c0
Onboard: Iface has the IP addr
Onboard: Sntpc start success: 0
Onboard: SNTP ADD SVR Called
Onboard: Add server return value : 0
Onboard: SNTP client is started.
Onboard: 0: pool.ntp.org    ****  
Onboard: 1: pool.ntp.org    ****  
Onboard: waiting on Monitor thread
Onboard: IPADDR:6800a8c0, MSK:ffffff, GW:100a8c0
Onboard: Iface has the IP addr
Onboard: try to resolve ....
Onboard: e Value: -1
Onboard: Unable to resolve a2v0hrezwxxxxx.iot.ap-south-1.amazonaws.com
Onboard: Start_dns_cline
Onboard: Stop_dns_cline
Onboard: Gateway address :192.168.0.1
Onboard: try to resolve ....
Onboard: e Value: -1
Onboard: Unable to resolve a2v0hrezwxxxxx.iot.ap-south-1.amazonaws.com
Onboard:            total       used       free
Onboard: Heap:     292096     130980     161116
Onboard: mutex unlock done ---------
Onboard: waiting on Monitor thread
 
After waiting on Monitor thread log, device is getting stuck here and not responding to any activity in device until we repower.
 
So i have used old SDK qca4020.or_.1.1_postcs1 with AWS IoT SDK Version 2.3.0.With this code device is not getting stuck but still  getting  problem when the device does shadow connects, the return error is -6  NETWORK_SSL_CONNECT_TIMEOUT_ERROR.
 

 

  • Up0
  • Down0
c_rpedad
Profile picture
Join Date: 18 Jun 18
Location: San Jose
Posts: 317
Posted: Tue, 2018-08-28 11:35

check if the HOST_ID provided is valid or not ?

verify if command line "ping a2v0hrezwxxxxx.iot.ap-south-1.amazonaws.com" is working and able to resolve the address to IP.

From the provided logs, i could observer there is no internet connection to the connected access Point.
 

Onboard: SNTP client is started.
Onboard: 0: pool.ntp.org ****                  // Here the server should be able to resolve pool.ntp.org IP address if there is internet connection
Onboard: 1: pool.ntp.org

Example:
    Onboard: SNTP client is started. 
    Onboard: 0: 132.163.97.4   132.163.97.4
    Onboard: IPADDR:fcf4b10a, MSK:feffff, GW:1f4b10a 
    Onboard: START AWS: running(0)
    Onboard: Shadow Init
    Onboard: Shadow Connect

From the error code -6 NETWORK_SSL_CONNECT_TIMEOUT_ERROR, either the network is blocking AWS connection or, network doesnt have internet connection to resolve AWS end point.

  • Up0
  • Down0
c_rpedad
Profile picture
Join Date: 18 Jun 18
Location: San Jose
Posts: 317
Posted: Tue, 2018-08-28 11:35

check if the HOST_ID provided is valid or not ?

verify if command line "ping a2v0hrezwxxxxx.iot.ap-south-1.amazonaws.com" is working and able to resolve the address to IP.

From the provided logs, i could observer there is no internet connection to the connected access Point.
 

Onboard: SNTP client is started.
Onboard: 0: pool.ntp.org ****                  // Here the server should be able to resolve pool.ntp.org IP address if there is internet connection
Onboard: 1: pool.ntp.org

Example:
    Onboard: SNTP client is started. 
    Onboard: 0: 132.163.97.4   132.163.97.4
    Onboard: IPADDR:fcf4b10a, MSK:feffff, GW:1f4b10a 
    Onboard: START AWS: running(0)
    Onboard: Shadow Init
    Onboard: Shadow Connect

From the error code -6 NETWORK_SSL_CONNECT_TIMEOUT_ERROR, either the network is blocking AWS connection or, network doesnt have internet connection to resolve AWS end point.

  • Up0
  • Down0
chilukuriashok90
Join Date: 25 Jun 18
Posts: 8
Posted: Wed, 2018-08-29 00:31

Hi raja,

Thanks for reply.

>>check if the HOST_ID provided is valid or not ?

Actually HOST_ID is a2v0hrezwtktgj.iot.ap-south-1.amazonaws.com  . 

>>verify if command line "ping a2v0hrezwxxxxx.iot.ap-south-1.amazonaws.com" is working and able to resolve the address to IP.

Getting Request timed out when i verified ping from command line.

but from the below logs.

Onboard: Waiting for Onboard events ...
Onboard: IPADDR:752ba8c0, MSK:ffffff, GW:12ba8c0
Onboard: Iface has the IP addr
Onboard: Sntpc start success: 0
Onboard: SNTP ADD SVR Called
Onboard: Add server return value : 0
Onboard: SNTP client is started.
Onboard: 0: pool.ntp.org    ****
Onboard: 1: ****    ****
Onboard: waiting on Monitor thread
Onboard: IPADDR:752ba8c0, MSK:ffffff, GW:12ba8c0
Onboard: Iface has the IP addr
Onboard: try to resolve .... 
Onboard: e Value: 0 //// it is able to reslove the host
 
Onboard: a2v0hrezwtktgj.iot.ap-south-1.amazonaws.com -->
Onboard: START AWS: running(0)
Onboard:            total       used       free
Onboard: Shadow Init
 
Onboard: Heap:     292096     131952     160144
Onboard: Recv thread stopped
Onboard: mutex unlock done ---------
Onboard: TWN shutdown.
Onboard: Shadow Connect
 
Onboard: waiting on Monitor thread
Onboard: Shadow Connection Error
 
Onboard: : rc = -6
Onboard: IPADDR:752ba8c0, MSK:ffffff, GW:12ba8c0
Onboard: Iface has the IP addr
Onboard: try to resolve ....
Onboard: e Value: 0
 
Onboard: a2v0hrezwtktgj.iot.ap-south-1.amazonaws.com -->
Onboard: START AWS: running(0)
Onboard:            total       used       free
Onboard: Shadow Init
 
Onboard: Heap:     292096     102960     189136
Onboard: Shadow Connect
 
Onboard: mutex unlock done ---------
Onboard: waiting on Monitor thread
Onboard: Shadow Connection Error
 
Onboard: : rc = -6
 
 I have change to another wifi connection/network but still getting  problem when the device does shadow connects, the return error is -6  NETWORK_SSL_CONNECT_TIMEOUT_ERROR.
  • Up0
  • Down0
c_rpedad
Profile picture
Join Date: 18 Jun 18
Location: San Jose
Posts: 317
Posted: Wed, 2018-08-29 10:20

We are using ARM tool chain 6.2 and AWS SDK tag v2.1.1 (https://github.com/aws/aws-iot-device-sdk-embedded-C/releases/tag/v2.1.1) to verify onboard demo.

Usually NETWORK_SSL_CONNECT_TIMEOUT_ERROR occurs when the network/internet blocks the AWS cloud connection.

You can verify the AWS connection using QCLI_Demo, mentioned in the document. QCLI_Demo will provide more information if the issues is with certifcates/cloud connection.

Could you try onboard demo with some mobile hotspot to verify there is no issues with corporate/office network.

  • Up0
  • Down0
chilukuriashok90
Join Date: 25 Jun 18
Posts: 8
Posted: Thu, 2018-08-30 06:41

Hi raja,

Device is able to establish Shadow Connection successfully.

But After that , device is doing againThread_Initialization and getting stuck (not responding to any activity in device until we repower. )after that.

 
Onboard: Current operation mode:0
Onboard:
 
Onboard: Setting SSID to QCA4020_1142
 
Onboard:
 
Onboard: CONNECTING to SSID:ashok, pwd:test1234
Onboard:
 
Onboard: Setting SSID to ashok
 
Onboard:
 
Onboard: Connecting to :ashok
Onboard: Waiting for connection success event
Onboard: certificate store is success ......................
Onboard: certificate store is success ......................
Onboard: WLANCB: dID:0, cbID:0, val:1
Onboard: Connect event on devId:0 val:1
 
Onboard: devid - 0 1 CONNECTED MAC addr 02:0b:6b:ee:11:42
Onboard: Server started.........
Onboard: Waiting on accept ...........................
Onboard: WLANCB: dID:1, cbID:0, val:1
Onboard: Connect event on devId:1 val:1
 
Onboard: devid - 1 1 CONNECTED MAC addr bc:79:ad:66:95:33
Onboard: Get DHCP addr
Onboard: Onboard thread event
Onboard: PassPhrase length =16
Onboard: Starting Thread
Onboard: Calling Start_Thread_Boarder_Router
Onboard: Thread_Initialize
Onboard:  In Device_Config == 0
Onboard: Thread Initialized Successfully:
Onboard: Network Configuration:
Onboard:    Channel:          16
Onboard:    PAN_ID:           8DA8
Onboard:    Extended_PAN_ID:  0001020304050607
Onboard:    NetworkName:      Test Network
Onboard:    MasterKey:        F32B7B515AD61BFAF32B7B515AD61BFA
Onboard:  After Thread_Initialize
Onboard: Thread_UseDefaultInfo
Onboard: Network Configuration:
Onboard:    Channel:          16
Onboard:    PAN_ID:           8DA8
Onboard:    Extended_PAN_ID:  0001020304050607
Onboard:    NetworkName:      Test Network
Onboard:    MasterKey:        F32B7B515AD61BFAF32B7B515AD61BFA
Onboard:  After Thread_Initialize
Onboard: Thread_Interface_Start
Onboard: SUCCESS: qapi_TWN_Start After Thread_Interface_Start
Onboard: Thread_MeshCoP_CommissionerStart
Onboard: WLANCB: dID:1, cbID:0, val:16
Onboard: Connect event on devId:1 val:16
 
Onboard: 4 way handshake success for device=1
Onboard: Network State Changed: Detached
 
>
Onboard: SUCCESS: qapi_TWN_Commissioner_Start After Thread_MeshCoP_CommissionerStart
Onboard: DHCPv4c: IP=192.168.43.143  Subnet Mask=255.255.255.0  Gateway=192.168.43.1
Onboard: Network State Changed: Leader
 
>
Onboard: SUCCESS: qapi_TWN_IPv6_Add_Unicast_Address
Onboard: Destination           Nexthop              iface
Onboard: FD00:102:304::/64      5401:10:C101::2903:0:2903:0      ot0
Onboard: FD00:102:304::/64      5401:10:C101::2903:0:2903:0      ot0
Onboard: Thread_MeshCoP_CommissionerAddJoiner
Onboard:  PassPhrase = rxAmsC38fRLJyMi9
Onboard:  ExtAddr  = 0000000000000000
Onboard:  Timeout  = 65000
Onboard: SUCCESS:qapi_TWN_Commissioner_Add_Joiner
Onboard:  Aftet Thread_MeshCoP_CommissionerAddJoiner
Onboard:  IPv6 Link-local Address ..... : FE80::8FD:DA94:7229:89CC/64
Onboard:  IPv6 Global Address ......... : FD00:102:304::B836:2913:702D:9C9C/64
Onboard:  IPv6 Default Gateway  ....... : ::
Onboard:  IPv6 Global Address 2 ....... : FD00:102:304::FDF4:2344:DB61:4A50/64
Onboard: ot0 interface Global IP Address :FD00:102:304::B836:2913:702D:9C9C
Onboard: Border ROuter IP: FD00:102:304::B836:2913:702D:9C9C
Onboard: Server started.........
Onboard: Thread is configured successfully
Onboard:  Receiving Data from Joiner
 
Onboard: Waiting for Onboard events ...
Onboard: IPADDR:8f2ba8c0, MSK:ffffff, GW:12ba8c0
Onboard: Iface has the IP addr
Onboard: Sntpc start success: 0
Onboard: SNTP ADD SVR Called
Onboard: Add server return value : 0
Onboard: SNTP client is started.
Onboard: 0: pool.ntp.org    ****
Onboard: 1: 132.163.97.4    132.163.97.4
Onboard: waiting on Monitor thread
Onboard: IPADDR:8f2ba8c0, MSK:ffffff, GW:12ba8c0
Onboard: Iface has the IP addr
Onboard: try to resolve ....
Onboard: e Value: 0
 
Onboard: a2v0hrezwtktgj.iot.us-west-2.amazonaws.com -->
Onboard: START AWS: running(0)
Onboard:            total       used       free
Onboard: Shadow Init
 
Onboard: Heap:     292352     133138     159214
Onboard: Recv thread stopped
Onboard: mutex unlock done ---------
Onboard: TWN shutdown.
Onboard: Shadow Connect
 
Onboard: waiting on Monitor thread
Onboard: Shadow Connection successful
 
Onboard: Topic_name : $aws/things/thing_test/shadow/update/delta
Onboard: Rised signal: 2
Onboard: Onboard thread event
Onboard: PassPhrase length =16
Onboard: Starting Thread
Onboard: Calling Start_Thread_Boarder_Router
Onboard: Thread_Initialize
Onboard:  In Device_Config == 0
Onboard: Thread Initialized Successfully:
Onboard: Network Configuration:
Onboard:    Channel:          16
Onboard:    PAN_ID:           8DA8
Onboard:    Extended_PAN_ID:  0001020304050607
Onboard:    NetworkName:      Test Network
Onboard:    MasterKey:        F32B7B515AD61BFAF32B7B515AD61BFA
Onboard:  After Thread_Initialize
Onboard: Thread_UseDefaultInfo /After Thread_UseDefaultInfo log, device is getting stuck here and not responding to any activity in device until we repower.
Can you please help me on these??
Thanks,
  • Up0
  • Down0
c_rpedad
Profile picture
Join Date: 18 Jun 18
Location: San Jose
Posts: 317
Posted: Thu, 2018-08-30 10:36

From the logs I could observe the device is not able to update sensor information to shadow.
There is no issues with Thread creation, Initiation/Joining to end device.

Onboard: Thread is configured successfully

Onboard: Shadow Connect
Onboard: Shadow Connection successful
Onboard: Topic_name : $aws/things/thing_test/shadow/update/delta 

Onboard: Thread Initialized Successfully:
Onboard: Network Configuration:
Onboard: Channel: 16
Onboard: PAN_ID: 8DA8
Onboard: Extended_PAN_ID: 0001020304050607
Onboard: NetworkName: Test Network
Onboard: MasterKey: F32B7B515AD61BFAF32B7B515AD61BFA

Could you check you AWS console Things Policy document.
Secure -> Policies -> Thing-Policy -> Overview (Make sure the policy document use Action: iot.*  and resource: *)

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:*" ], "Resource": [ "*" ] } ] }

You can also check if the issues is related to AWS shadow or not by  just starting the QCA4020 alone and check if the device is able to send sensor information to shadow or not.

Kindly, let me know if you still face any issues.

  • Up0
  • Down0
chilukuriashok90
Join Date: 25 Jun 18
Posts: 8
Posted: Tue, 2018-09-04 02:03
Hi raja,
 
Finally border router  is able to make Shadow connection and able to send sensor information to could.After i have changed policy from  { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:Connect" ], "Resource": [ "*" ] } ] } to { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:*" ], "Resource": [ "*" ] } ] } .
 
And also sleepy device is able to send to border router and border router is sending to clould but inconsistency (Each request is not going to could) .But reverse way is not at all working(Sleepy device is not getting information for border router).
 
Can you please help me on this??
Thanks,
Ashok.
  • Up0
  • Down0
c_rpedad
Profile picture
Join Date: 18 Jun 18
Location: San Jose
Posts: 317
Posted: Tue, 2018-09-04 14:33

I assume you have set the required TOOLCHAIN PATHs correctly and kindly hard reset both the devices and try once again with below instructions.

Please follow the section "2.2.1 Prerequisites" from document QCA402x (CDB2x) Development Kit User Guide 80-YA121-140.
Please delete the AWS shadow document(Manage -> Things -> XX_THING -> Shadow -> Shadow Document) and verify the connection.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.