Announcement

Collapse
No announcement yet.

How do others prepare nodes for deployment?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do others prepare nodes for deployment?

    How do others prepare nodes for deployment?

    1. Manually configure all the NV Settings including crypto?
    2. Make a script that sets all the important NV Parameters? Then upload normal scripts?
    3. Some other way I have not mentions?

    Thank you,
    J.C. Wotz

  • #2
    In my scripts, in the startup, function I try to update all of the relevant NV params. If any actually needed to be changed I then reboot.

    Code:
    def SetParam(ID, Value, Pass):
            if loadNvParam(ID)!=Value:
                saveNvParam(ID, Value)
                return True
            else:
                return Pass
    
    @setHook(HOOK_STARTUP)
    def on_start():
        NeedRestart=SetParam(Param1, Value1, False)
        NeedRestart=SetParam(Param2, Value2, NeedRestart)
        NeedRestart=SetParam(Param3, Value3, NeedRestart)
    ...
        if NeedRestart:
            reboot()

    Comment


    • #3
      rbelli1's routine shows several things we use in several of our own applications (notice the reboot if a setting has changed).

      I'll add this note:
      SNAP does have flash wear protection. The routine that writes NV Parameters to memory first checks to see if it has not already been set to that same value.
      sigpic
      Proven Solutions for the Internet of Things
      www.synapse-wireless.com

      Comment


      • #4
        Originally posted by jcwoltz View Post
        How do others prepare nodes for deployment?

        1. Manually configure all the NV Settings including crypto?
        2. Make a script that sets all the important NV Parameters? Then upload normal scripts?
        3. Some other way I have not mentions?
        Thank you,
        J.C. Wotz
        #3. Channel is set by a rotary BCD switch that is read at startup. Network ID is created by an algorithm based on the selected channel. Crypto is set using several parameters, including random numbers and some other "trade secrets" I am not at liberty to reveal. This particular product works with a relatively small network of RF Engines. Since they obviously must all share the same channel, network ID and AES key, they must learn about each other in non-encrypted mode, but the full key is not sent over the air for security reasons. The channel is simple, since it is just a matter of physically setting all the devices to the same BCD switch setting. They all use the same algorithm to set their network IDs based on the channel, so that is easy enough. One device acts as a master and lets the other devices know what their AES key should be. Part of it they already know. As soon as the non-master devices are learned, they reboot themselves and are encrypted upon rebooting. The master device does the same once all the other devices are enrolled.

        This all gives us a pretty secure product that can be installed and deployed by installers without the use of a computer. I even put a channel analyzer function in the product to help them select a clear channel. The installers even have the ability to go back and delete individual units from the network and replace them with others. All done with nothing more than a pushbutton and BCD switch for user input, along with some LEDs for visual feedback.
        EllisEmbeddedEngineering.com

        Comment


        • #5
          about an hour after I posted the question, I did this:
          Code:
          from synapse.nvparams import *
          secondCounter = 0
          
          @setHook(HOOK_STARTUP)
          def start(): 
              global error
              error = 0
              error = saveNvParam(NV_NETWORK_ID, 0x1C2C)
              error += saveNvParam(NV_CHANNEL_ID, 5)
              error += saveNvParam(50, 2)
              error += saveNvParam(51, "F4Swu7Aruphewume")
              
              
          @setHook(HOOK_100MS)
          def timer100msEvent(msTick):
              """Hooked into the HOOK_100MS event"""
              global error
              global secondCounter, minuteCounter
              secondCounter += 1
              if (error):
                  print error
              if secondCounter == 20:
                  reboot()
                  eraseImage()
          Note, not my real network ID, Channel, or encryption key. I will take rbelli1's approach into consideration. Thank you all for your replies.

          -J.C. Woltz

          I have another question along these lines, but will start a new topic an reference this topic.
          Last edited by jcwoltz; 04-07-2011, 04:04 PM.

          Comment


          • #6
            Originally posted by joecool View Post
            #3. Channel is set by a rotary BCD switch that is read at startup. Network ID is created by an algorithm based on the selected channel. Crypto is set using several parameters, including random numbers and some other "trade secrets" I am not at liberty to reveal. This particular product works with a relatively small network of RF Engines. Since they obviously must all share the same channel, network ID and AES key, they must learn about each other in non-encrypted mode, but the full key is not sent over the air for security reasons. The channel is simple, since it is just a matter of physically setting all the devices to the same BCD switch setting. They all use the same algorithm to set their network IDs based on the channel, so that is easy enough. One device acts as a master and lets the other devices know what their AES key should be. Part of it they already know. As soon as the non-master devices are learned, they reboot themselves and are encrypted upon rebooting. The master device does the same once all the other devices are enrolled.

            This all gives us a pretty secure product that can be installed and deployed by installers without the use of a computer. I even put a channel analyzer function in the product to help them select a clear channel. The installers even have the ability to go back and delete individual units from the network and replace them with others. All done with nothing more than a pushbutton and BCD switch for user input, along with some LEDs for visual feedback.

            @joecool, I like this idea also. It is not appropriate for what I am doing, but will keep it in mind. Thank you

            -JC

            Comment


            • #7
              Originally posted by jcwoltz View Post
              about an hour after I posted the question, I did this:
              Code:
              from synapse.nvparams import *
              secondCounter = 0
              
              @setHook(HOOK_STARTUP)
              def start(): 
                  global error
                  error = 0
                  error = saveNvParam(NV_NETWORK_ID, 0x1C2C)
                  error += saveNvParam(NV_CHANNEL_ID, 5)
                  error += saveNvParam(50, 2)
                  error += saveNvParam(51, "F4Swu7Aruphewume")
                  
                  
              @setHook(HOOK_100MS)
              def timer100msEvent(msTick):
                  """Hooked into the HOOK_100MS event"""
                  global error
                  global secondCounter, minuteCounter
                  secondCounter += 1
                  if (error):
                      print error
                  if secondCounter == 20:
                      reboot()
                      eraseImage()
              Note, not my real network ID, Channel, or encryption key. I will take rbelli1's approach into consideration. Thank you all for your replies.

              -J.C. Woltz

              I have another question along these lines, but will start a new topic an reference this topic.
              I've always assumed any lines after a reboot() would never get called because, well...you just rebooted. Someone please correct me if that is not the case.

              Also, it looks to me like you are going to keep rebooting every time the secondCounter hits 20.
              EllisEmbeddedEngineering.com

              Comment


              • #8
                reboot waits 200 ms, it does work and erases the image and reboots

                from the snap refernce manual:
                reboot() – Schedule a reboot
                This function takes no parameters, and returns no value.
                Approximately 200 milliseconds after this function is called, the SNAP node will reboot.
                The 200 milliseconds delay is to allow the node time to acknowledge the reboot() request (in case it came in over-the-air).

                Comment


                • #9
                  Originally posted by jcwoltz View Post
                  reboot waits 200 ms, it does work and erases the image and reboots

                  from the snap refernce manual:
                  reboot() Schedule a reboot
                  This function takes no parameters, and returns no value.
                  Approximately 200 milliseconds after this function is called, the SNAP node will reboot.
                  The 200 milliseconds delay is to allow the node time to acknowledge the reboot() request (in case it came in over-the-air).
                  Well, cool! I missed that in the manual. Or just forgot it over the last couple of years. I've been playing catchup over the last few weeks. It is gradually coming back to me and I'm about ready to deliver this product to the client. I spent the last couple of days writing a rough draft of the user manual.
                  EllisEmbeddedEngineering.com

                  Comment


                  • #10
                    As JC quotes from the manual, he reboot has a hard-coded delay of 200MS.

                    The original SNAP did not have this delay, but we added it in order to allow for the target node to respond with an acknowledgement, as well as, to transmit any other data it had buffered for the UART or radio.
                    sigpic
                    Proven Solutions for the Internet of Things
                    www.synapse-wireless.com

                    Comment


                    • #11
                      Does the current function have to return to the OS or will:

                      Code:
                      reboot()
                      while(True):
                           pass
                      work correctly?

                      Comment


                      • #12
                        This will actually lock up the unit as the loop will never end and other tasks will not be processed. SNAP (and SNAPpy) are strictly event driven, processing a task then moving on to the next.
                        sigpic
                        Proven Solutions for the Internet of Things
                        www.synapse-wireless.com

                        Comment

                        Working...
                        X