Announcement

Collapse
No announcement yet.

Timeout problems using PWM on RF200

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

  • Timeout problems using PWM on RF200

    I have modified the AtmelPWM.py script for my SN171 ProtoBoard and am trying to use SNAPConnect to control the LEDS. I am experiencing times outs when making rpc calls from SNAPConnect and on Portal when trying to upload revised code to the nodes. Here is a code snippet from my node:

    Here is a code snippet from SNAPConnect:
    Code:
    import wx
    from snapconnect import snap
    import sys
    import logging
    
    BRIDGE_NODE = {'type':snap.SERIAL_TYPE_RS232, 'port':2}
    NodeA = '\x60\x87\x18'
    NodeB = '\x60\x85\x2D'
    
    
    class InitialInputs(wx.Frame):
    
        def __init__(self):
            wx.Frame.__init__(self, None, -1, "MASTER", size=(300,300))
     
            panel = wx.Panel(self)
           
            self.poller = wx.Timer(self)
            self.Bind(wx.EVT_TIMER, lambda event : self.snap.poll())
            self.poller.Start(20,wx.TIMER_CONTINUOUS)
            
            hbox = wx.GridBagSizer(hgap=10, vgap=10) #overal sizer for panel
    
            #Master on/off static box
            masterBox = wx.StaticBox(panel, -1, "Master On/Off")
            masterBoxSizer = wx.StaticBoxSizer(masterBox, wx.VERTICAL) #sizer for staticBox
    
            onOffButtons = wx.BoxSizer(wx.VERTICAL) #sizer for controls
    
            self.onBtn = wx.Button(panel, -1, "All LEDs On")
            self.Bind(wx.EVT_BUTTON, self.allOn, self.onBtn)
            self.offBtn = wx.Button(panel, -1, "All LEDs Off")
            self.Bind(wx.EVT_BUTTON, self.allOff, self.offBtn)
    
            onOffButtons.Add(self.onBtn, 0, wx.ALL|wx.CENTER, 5) 
            onOffButtons.Add(self.offBtn, 0, wx.ALL|wx.CENTER, 5)
    
            masterBoxSizer.Add(onOffButtons, 0, wx.ALL|wx.CENTER, 5) 
            hbox.Add(masterBoxSizer, pos=(0,0)) 
                  
            redLEDa = wx.StaticBox(panel, -1, "Single LED control")
            singleLEDsizer = wx.StaticBoxSizer(redLEDa, wx.VERTICAL)
            sLEDsizer = wx.BoxSizer(wx.VERTICAL)
    
            self.redOnBtn = wx.Button(panel, -1, "Red NodeA On")
            self.Bind(wx.EVT_BUTTON, self.redOn, self.redOnBtn)
            self.redOffBtn = wx.Button(panel, -1, "Red NodeA Off")
            self.Bind(wx.EVT_BUTTON, self.redOff, self.redOffBtn)
    
            sLEDsizer.Add(self.redOnBtn,0, wx.ALL|wx.CENTER, 5)
            sLEDsizer.Add(self.redOffBtn,0, wx.ALL|wx.CENTER, 5)
            
            singleLEDsizer.Add(sLEDsizer, 0, wx.ALL|wx.CENTER, 5) 
            hbox.Add(singleLEDsizer, pos=(0,1)) 
           
            panel.SetSizer(hbox)
            panel.Fit()
           
            #sys.stdout=self.display
    
            funcdir = {'allOn':self.allOn, 'allOff':self.allOff,
                       'redOn': self.redOn, 'redOff':self.redOff}
                   
            self.snap = snap.Snap(funcs=funcdir)
            self.snap.open_serial(BRIDGE_NODE['type'],BRIDGE_NODE['port'])
    
        def allOn(self, event):
            self.snap.mcastRpc(1,2, 'allOn')
    
        def allOff(self, event):
            self.snap.mcastRpc(1,2, 'allOff')
    
        def redOn(self, event):
            self.snap.rpc(NodeA, 'redOn')
    
        def redOff(self, event):
            self.snap.rpc(NodeA, 'redOff')
    
    if __name__ == '__main__':
        app=wx.App()
        logging.basicConfig(level=logging.DEBUG)
        frame = InitialInputs()
        frame.Show(True)
        app.MainLoop()
    Here is the log when running the SNAPConnect code :

    Permanent license created on 2012-02-14 14:14:45.343000 for 000020
    DEBUG:snap:Querying for remote addr
    DEBUG:snap.dispatchers:send: 0001.callback('\xc1Y\xceowX\xdck\xffM\xaa\xec\xe56 \xd1\x9c', 'getInfo', 3)
    DEBUG:snap.dispatchers: Directing multi-cast to RS-232 Interface: 2
    DEBUG:snap.dispatchers:rpc: 5d25b0.ÁYÎowXÜkÿMªìå6Ñœ(19,)
    DEBUG:snap:Next hop for RS-232 Interface: 2 is 5d25b0
    DEBUG:snap.dispatchers:send: 0001.allOn()
    DEBUG:snap.dispatchers:send: 0001.allOff()
    DEBUG:snap.dispatchers:send: 608718.redOn()
    DEBUG:snap.mesh:Sent RREQ for 608718
    DEBUG:snap.mesh:RREQ retry #1 for 608718
    DEBUG:snap.mesh:RREQ retry #2 for 608718
    DEBUG:snap.mesh:RREQ timeout for 608718
    DEBUG:snap.mesh:Route entry for 5d25b0 removed because timeout reached
    DEBUG:snap.mesh:Removing route entry for 5d25b0
    DEBUG:snap.dispatchers:send: 608718.redOn()
    DEBUG:snap.mesh:Sent RREQ for 608718
    DEBUG:snap.mesh:RREQ retry #1 for 608718
    DEBUG:snap.mesh:RREQ retry #2 for 608718
    DEBUG:snap.mesh:RREQ timeout for 608718
    DEBUG:snap.dispatchers:send: 608718.redOn()
    DEBUG:snap.mesh:Sent RREQ for 608718
    DEBUG:snap.mesh:RREQ retry #1 for 608718
    DEBUG:snap.mesh:RREQ retry #2 for 608718
    DEBUG:snap.mesh:RREQ timeout for 608718
    DEBUG:snap.dispatchers:send: 608718.redOn()
    DEBUG:snap.mesh:Sent RREQ for 608718
    DEBUG:snap.mesh:RREQ was sent by us or we have already seen
    DEBUG:snap.mesh:Added route to 608718
    DEBUG:snap.mesh:RREP hop limit reached or was for our address

    Here is the timeouts from Portal when I try to upload code to a node:

    2016-06-29 13:46:12 Did not get an expected response within timeout period from 608718
    2016-06-29 13:46:12 Did not get an expected response within timeout period from 608718

    I have attached both scripts.
    Is this a timing issue? Could it have anything to do with the way I am polling (copied from another example)? I am using Windows10.

    Thank you
    Attached Files
X