This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/LAUNCHXL-CC1350: Sub 1Ghz sensor to cloud iot Gateway

Part Number: LAUNCHXL-CC1350
Other Parts Discussed in Thread: CC1350, TIDEP0084

Tool/software: Linux

I'm trying to follow the Sub 1Ghz sensor to cloud Industrial Internet of Things Gateway out of the box Reference Design with the BeagleBone Black and CC1350 Launch Pad as MAC coprocessor.

I've been able to do all the steps up through 2.3.3 to start the application and the keep getting stuck on the run_demo.sh

it returns :command not found 46, :command not found 48, :command not found 49 and then line 96 :syntax error and unexpected end of line.

I have spent many hours reviewing everything. I have flashed the Launch Pad as coprocessor twice and hooked up to usb and device is recognized.

I have verified that the BBB booted off of SD card- saw Arago project loaded and was able to port the tidep0084 directory over.

I have changed the certs files and followed specific instructions for 2.3.3, but can't seem to move on.

I did not try the TI15.4 - Linux gateway project zero as I don't have an Ubuntu machine to load the TI 15.4 Stack Linux Gateway SDK.

Any help and support would be appreciated.

Thanks

  • In troubleshooting the shell commands inside of the run_demo.sh, I found that that it does not like dos created git files even though the instructions asked for that.

    It was not recognizing the repository files and there is no dos2unix command, so I used my Mac and recloned the git repository files and transported to dropbox and then

    ported them to the PC to finish installing on the BBB.

    Now the run_demo script runs, but I ran into another problem getting to the gateway. I tried to attach an image of my screen, but to no avail.

    The error occurred after successful collector running as process id: 9920

    and then gateway application running in background module. js :327

    and the throw err;

    and then Error: cannot find module './appClient/appclient.js

    Please send any help or support as I was hoping this part would be out of the box.

  • Discovered that the second cloning caused some of the capitals to be removed from some of the names of the files.

    Now the error in running run_demo script has made it to the section where the keys are being verified for the Amazon Website.

    The stackarmor support team suggested for me to place this post with the Sitara_processor forum.

    I'll try to attach my error files:

    Any suggestions would be very helpful.

  • Hi Ellen,
    Since you are working from the prebuilt directory, you'll need to have the files that you received from stackArmor in the 'prebuilt/iot-gateway/cloudAdapter/certs/' directory.

    Once you've got the files there, head back to the 'prebuilt/iot-gateway/cloudAdapter/awsConfig.json' file and change the 'certDir' parameter to the full path to the prebuilt certs directory (/home/root/tidep0084/prebuilt/iot-gateway/cloudAdapter/certs/ for instance). Then make sure the names for the 'keyPath', 'certPath', and 'caPath' parameters match the actual file names in your prebuilt certs directory.

    Also, if you change 'debug' to true in your awsConfig.json file then you'll get some more verbose output from the AWS connection.

    Regards
  • Hey Ellen,

    I've seen the same "invalid keyPath" error before. Make sure there is an '/' at the end of your certPath ("/home/root/tidep0084/prebuilt/iot-gateway/cloudAdapter/certs/"). This way certPath + keyPath = the right absolute path.
  • Thank you for that /home/root/ was the answer for that error, I thought it was starting from ~.

    I keep progressing, but keep getting caught with next error.

    the collector is up and running as seen from screen shot, and the gateway was running and the AWS iot was connected, 

    but I received an error on socket connection with AppServer.

    root@am335x-evm:~/tidep0084/prebuilt/iot-gateway/cloudAdapter# cat awsConfig.json

    {

            "certDir" : "/home/root/tidep0084/prebuilt/iot-gateway/cloudAdapter/certs/",

            "keyPath" : "private.pem.key",

            "certPath" : "certificate.pem.crt",

            "caPath" : "root-CA.crt",

            "clientId" : "BBBKEYTI",

            "region" : "us-east-1",

            "port" : 8883,

            "host" : "a23op339u3ex9t.iot.us-east-1.amazonaws.com",

            "debug" : true

    }

    root@am335x-evm:~/tidep0084/prebuilt/iot-gateway/cloudAdapter# cd ..

    root@am335x-evm:~/tidep0084/prebuilt/iot-gateway# ls

    appClient       iot-gateway.js  package.json

    cloudAdapter    node_modules    run_gateway.sh

    root@am335x-evm:~/tidep0084/prebuilt/iot-gateway# cd ..

    root@am335x-evm:~/tidep0084/prebuilt# ls

    bin          iot-gateway  run_demo.sh

    root@am335x-evm:~/tidep0084/prebuilt# bash run_demo.sh

    Launching the Collector Application in the background

    Collector Running as Process id: 13850

    Launching Node-JS gateway application in background

    Gateway is running as Process id: 13862

    root@am335x-evm:~/tidep0084/prebuilt# Cannot get VERSION info from CoProcessor

    { keyPath: '/home/root/tidep0084/prebuilt/iot-gateway/cloudAdapter/certs/private.pem.key',

      certPath: '/home/root/tidep0084/prebuilt/iot-gateway/cloudAdapter/certs/certificate.pem.crt',

      caPath: '/home/root/tidep0084/prebuilt/iot-gateway/cloudAdapter/certs/root-CA.crt',

      clientId: 'BBBKEYTI_1490728239113',

      region: 'us-east-1',

      port: 8883,

      host: 'a23op339u3ex9t.iot.us-east-1.amazonaws.com',

      debug: true,

      reconnectPeriod: 1000,

      fastDisconnectDetection: true,

      protocol: 'mqtts',

      key: <Buffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 52 53 41 20 50 52 49 56 41 54 45 20 4b 45 59 2d 2d 2d 2d 2d 0a 4d 49 49 45 70 41 49 42 41 41 4b 43 41 51 45 41 70 53 ... >,

      cert: <Buffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0a 4d 49 49 44 57 54 43 43 41 6b 47 67 41 77 49 42 41 67 49 55 4f 4e ... >,

      ca: <Buffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0d 0a 4d 49 49 45 30 7a 43 43 41 37 75 67 41 77 49 42 41 67 49 51 47 ... >,

      requestCert: true,

      rejectUnauthorized: true }

    attempting new mqtt connection...

    ERROR: Rcvd Error on the socket connection with AppServer

    { [Error: connect ECONNREFUSED 127.0.0.1:5000]

      code: 'ECONNREFUSED',

      errno: 'ECONNREFUSED',

      syscall: 'connect',

      address: '127.0.0.1',

      port: 5000 }

    Connected to AWS IoT

    ERROR: Rcvd Error on the socket connection with AppServer

    { [Error: connect ECONNREFUSED 127.0.0.1:5000]

      code: 'ECONNREFUSED',

      errno: 'ECONNREFUSED',

      syscall: 'connect',

      address: '127.0.0.1',

      port: 5000 }

    ERROR: Rcvd Error on the socket connection with AppServer

    { [Error: connect ECONNREFUSED 127.0.0.1:5000]

      code: 'ECONNREFUSED',

      errno: 'ECONNREFUSED',

      syscall: 'connect',

      address: '127.0.0.1',

      port: 5000 }

    ERROR: Rcvd Error on the socket connection with AppServer

    { [Error: connect ECONNREFUSED 127.0.0.1:5000]

      code: 'ECONNREFUSED',

      errno: 'ECONNREFUSED',

      syscall: 'connect',

      address: '127.0.0.1',

      port: 5000 }

  • Are there any suggestions on fixing the appServer error??
  • Hey Ellen,

    It looks like the collector application could not receive version information from the CoP. Can you reset the CoP (press the reset button) and try launching again? If this still does not remedy the issue try launching the script as root. Report back with more information if this does not help. 

    ~Brocklobsta

  • I've been trying to post with my screen shot, but my other computer is so slow and website not responding.
    I flashed the coP hex file again and reset and tried a couple times. I'm logged in as root, so always launching script as root.
    I tried a chmod 4755 , but no real change in error. The version still isn't showing up, but I'm not sure what the appserver error is telling me, is there any logged data to check on?
  • login as: root

    root@am335x-evm:~# ls

    tidep0084            tidep0084folder

    tidep0084almost0327  tidep0084old

    root@am335x-evm:~# cd tidep0084

    root@am335x-evm:~/tidep0084# ls

    Sub-1GHzSensortoCloudIndustrialIoTGateway_manifest.html

    build_all.sh

    components

    docs

    example

    firmware

    prebuilt

    scripts

    root@am335x-evm:~/tidep0084# cd prebuilt

    root@am335x-evm:~/tidep0084/prebuilt# ls

    bin          iot-gateway  run_demo.sh

    root@am335x-evm:~/tidep0084/prebuilt# ls -al

    drwxr-xr-x    4 root     root          4096 Mar 28 16:22 .

    drwxr-xr-x    9 root     root          4096 Mar 28 16:22 ..

    drwxr-xr-x    2 root     root          4096 Mar 28 16:39 bin

    drwxr-xr-x    5 root     root          4096 Mar 28 16:22 iot-gateway

    -rw-r--r--    1 root     root          3126 Mar 27 17:10 run_demo.sh

    root@am335x-evm:~/tidep0084/prebuilt# sudo chown root.root run_demo.sh

    -sh: sudo: command not found

    root@am335x-evm:~/tidep0084/prebuilt# sudo chmod 4755 run_demo.sh

    -sh: sudo: command not found

    root@am335x-evm:~/tidep0084/prebuilt# chmod 4755 run_demo.sh

    root@am335x-evm:~/tidep0084/prebuilt# ls -al

    drwxr-xr-x    4 root     root          4096 Mar 28 16:22 .

    drwxr-xr-x    9 root     root          4096 Mar 28 16:22 ..

    drwxr-xr-x    2 root     root          4096 Mar 28 16:39 bin

    drwxr-xr-x    5 root     root          4096 Mar 28 16:22 iot-gateway

    -rwsr-xr-x    1 root     root          3126 Mar 27 17:10 run_demo.sh

    root@am335x-evm:~/tidep0084/prebuilt# bash run_demo.sh

    Launching the Collector Application in the background

    Collector Running as Process id: 15984

    Launching Node-JS gateway application in background

    Gateway is running as Process id: 15992

    root@am335x-evm:~/tidep0084/prebuilt# Cannot get VERSION info from CoProcessor

    { keyPath: '/home/root/tidep0084/prebuilt/iot-gateway/cloudAdapter/certs/private.pem.key',

      certPath: '/home/root/tidep0084/prebuilt/iot-gateway/cloudAdapter/certs/certificate.pem.crt',

      caPath: '/home/root/tidep0084/prebuilt/iot-gateway/cloudAdapter/certs/root-CA.crt',

      clientId: 'BBBKEYTI_1490814370665',

      region: 'us-east-1',

      port: 8883,

      host: 'a23op339u3ex9t.iot.us-east-1.amazonaws.com',

      debug: true,

      reconnectPeriod: 1000,

      fastDisconnectDetection: true,

      protocol: 'mqtts',

      key: <Buffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 52 53 41 20 50 52 49 56 41 54 45 20 4b 45 59 2d 2d 2d 2d 2d 0a 4d 49 49 45 70 41 49 42 41 41 4b 43 41 51 45 41 70 53 ... >,

      cert: <Buffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0a 4d 49 49 44 57 54 43 43 41 6b 47 67 41 77 49 42 41 67 49 55 4f 4e ... >,

      ca: <Buffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0d 0a 4d 49 49 45 30 7a 43 43 41 37 75 67 41 77 49 42 41 67 49 51 47 ... >,

      requestCert: true,

      rejectUnauthorized: true }

    attempting new mqtt connection...

    ERROR: Rcvd Error on the socket connection with AppServer

    { [Error: connect ECONNREFUSED 127.0.0.1:5000]

      code: 'ECONNREFUSED',

      errno: 'ECONNREFUSED',

      syscall: 'connect',

      address: '127.0.0.1',

      port: 5000 }

    Connected to AWS IoT

    ERROR: Rcvd Error on the socket connection with AppServer

    { [Error: connect ECONNREFUSED 127.0.0.1:5000]

      code: 'ECONNREFUSED',

      errno: 'ECONNREFUSED',

      syscall: 'connect',

      address: '127.0.0.1',

      port: 5000 }

    ERROR: Rcvd Error on the socket connection with AppServer

    { [Error: connect ECONNREFUSED 127.0.0.1:5000]

  • can you try launching the collector manually? to do this "cd prebuilt/bin/" then "./bbb_collector&". This launches the collector in the background and will output any errors in the terminal without noise from the gateway. Try a couple of times and post if you get an error. If not then launch the gateway "cd prebuilt/iot-gateway/" then "bash ./run_gateway.sh".

    To enable logging you can edit collector.cfg in the prebuilt/bin folder. The log is in the same folder named collector_log.txt.

    ~Brocklobsta
  • I tried and still saw the version of Cop error  and then tried to run gateway

    and I received the same errors as last time except in between the beginning appserver errors,

    there was one new warning:

    ERROR: Rcvd Error on the socket connection with AppServer

    { [Error: connect ECONNREFUSED 127.0.0.1:5000]

      code: 'ECONNREFUSED',

      errno: 'ECONNREFUSED',

      syscall: 'connect',

      address: '127.0.0.1',

      port: 5000 }

    (node) warning: possible EventEmitter memory leak detected. 11 connect listeners added. Use emitter.setMaxListeners() to increase limit.

    Trace

        at Socket.addListener (events.js:239:17)

        at Socket.Readable.on (_stream_readable.js:673:33)

        at Socket.once (events.js:265:8)

        at Socket.connect (net.js:894:10)

        at Socket.connect (net.js:868:37)

        at null._onTimeout (/home/root/tidep0084/prebuilt/iot-gateway/appClient/appclient.js:141:27)

        at Timer.listOnTimeout (timers.js:92:15)

    ERROR: Rcvd Error on the socket connection with AppServer

    { [Error: connect ECONNREFUSED 127.0.0.1:5000]

      code: 'ECONNREFUSED',

      errno: 'ECONNREFUSED',

  • The gateway should work fine when the collector runs. Can you verify the CoP is enumerated as ttyACM0? you can check by running "ls -l /dev/ttyA*"

    ~Brocklobsta
  • Yes- I have checked that many times and both ACM0 and ACM1 show up but only the Cop is attached to BBB and configure file uses ACM0.
    I did reach out to Stack armor folks and I think they are sending my some new certs, so I'll report if that helps.
    Anything else you can suggest?
  • This error your experiencing is occurring in the collector application, and is not related to StackArmor. Can you post the log for me to check out? If you could enable all logging in collector.cfg that would help. Thanks!

    ~Brocklobsta
  • I did receive new certs from StackArmor and after reloading those and rebooting, I was able to get into the gateway.

    Thank you for the support.