Spider board: power ON issues & WatchDog reset not working

Hello to everybody,

As an experienced embedded engineer, I see two major issues with the Spider board: it does not always start up and I cannot get the watchdog reset timer to work.

This is the VB code I implemented:

    Public Sub ProgramStarted()

      ' Initialize WatchDog
      Watchdog.Behavior = WatchdogBehavior.HardReboot
      Watchdog.Timeout = New System.TimeSpan(0, 0, 0, 10, 0)
      Watchdog.Enabled = True

      ' Initialize display
      Display.Clear()
      Display.CursorHome()
      Display.BacklightEnabled = True

      ' Write program info to display screen
      DisplayMenu("CHANGE " & ProgramVersion)

      ' Setup inputs
      BusSTAT = SPI1.CreateDigitalInput(Gadgeteer.Socket.Pin.Five, Gadgeteer.SocketInterfaces.GlitchFilterMode.On, Gadgeteer.SocketInterfaces.ResistorMode.PullDown)
      PowerOn = Ctrl.CreateDigitalInput(Gadgeteer.Socket.Pin.Four, Gadgeteer.SocketInterfaces.GlitchFilterMode.On, Gadgeteer.SocketInterfaces.ResistorMode.PullDown)

      ' Setup outputs
      BusACKN = SPI1.CreateDigitalOutput(Gadgeteer.Socket.Pin.Four, False)
      BusDAT1 = SPI1.CreateDigitalOutput(Gadgeteer.Socket.Pin.Six, False)
      BusCLK1 = SPI1.CreateDigitalOutput(Gadgeteer.Socket.Pin.Seven, True)
      BusDAT2 = SPI1.CreateDigitalOutput(Gadgeteer.Socket.Pin.Eight, False)
      BusCLK2 = SPI1.CreateDigitalOutput(Gadgeteer.Socket.Pin.Nine, True)
      BusDAT3 = SPI2.CreateDigitalOutput(Gadgeteer.Socket.Pin.Four, False)
      BusCLK3 = SPI2.CreateDigitalOutput(Gadgeteer.Socket.Pin.Five, True)
      BusDAT4 = SPI2.CreateDigitalOutput(Gadgeteer.Socket.Pin.Six, False)
      BusCLK4 = SPI2.CreateDigitalOutput(Gadgeteer.Socket.Pin.Seven, True)
      BusDAT5 = SPI2.CreateDigitalOutput(Gadgeteer.Socket.Pin.Eight, False)
      BusCLK5 = SPI2.CreateDigitalOutput(Gadgeteer.Socket.Pin.Nine, True)
      BusDAT6 = SPI3.CreateDigitalOutput(Gadgeteer.Socket.Pin.Four, False)
      BusCLK6 = SPI3.CreateDigitalOutput(Gadgeteer.Socket.Pin.Five, True)
      BusDAT7 = SPI3.CreateDigitalOutput(Gadgeteer.Socket.Pin.Six, False)
      BusCLK7 = SPI3.CreateDigitalOutput(Gadgeteer.Socket.Pin.Seven, True)
      BusDAT8 = SPI3.CreateDigitalOutput(Gadgeteer.Socket.Pin.Eight, False)
      BusCLK8 = SPI3.CreateDigitalOutput(Gadgeteer.Socket.Pin.Nine, True)

      ' Clear PROCES lists
      ProcesList.Clear()

      ' Prepare timer & clock variables; setup main loop interval and fire it
      ' This is done, as there is no main sub routine
      ' and keeping this sub active will cause an exception
      ExecutionBasis = New System.TimeSpan(0, 0, 0, 0, TimerInterval)
      ExecutionClock = Hardware.Utility.GetMachineTime.Add(ExecutionBasis)
      MainLoop.Behavior = Gadgeteer.Timer.BehaviorType.RunOnce
      MainLoop.Start()

    End Sub

[em]Power on issue:[/em] the Spider board is integrated in an embedded building setup where it controls lights. Each morning, when employees arrive at the building, the main light switch is toggled and the Spider board is powered on automatically. It should then start to control other lights within the building. Unfortunately, every morning the board hangs (I guess right at the spot where the IO ports are declared, however this is impossible to debug). When I power cycle the board manually, it boots just fine. It seems as if there is an EMI problem and the Spider is sensitive to this.

[em]Watchdog issue:[/em] in order to solve the first problem, I thought of implementing a watchdog reset timer, see above code. However, this does not work; there is no watchdog reset! Also I could not find the “resetcounter” API. Actually, there is very limited documentation about the watchdog, and this is not for VB.

Does anybody have a similar issue and/or a possible solution?
How to get the Spider watchdog reset timer to work (in hardware)?

With the lack of a proper watchdog setup, the issues with booting and other issues I’ve had in the past with the Gadgeteer hardware, I’m seriously considering changing to another - more robust - platform, which covers my needs. So, your help is very much appreciated.

Thanks in advance,
Aubert

@ A_Dupont - It’s hard to say since it looks like you’re not using our watchdog directly or at all. The examples in https://www.ghielectronics.com/docs/31/watchdog should work fine on the Spider.

@ John, thanks, I have read this document, but it shows how to get the watchdog under C#, and not VB. Under VB I cannot find any way to get access to the Watchdog API of the Spider, so I’m stuck using the default (which does not work at all).

Could you please post a working VB code example using the Watchdog on Spider hardware?

@ A_Dupont - The API is the same between C# and VB. https://www.ghielectronics.com/downloads/man/Library_Documentation_v4.3/html/d2debd72-2d7b-0869-7a5f-c336c05085a8.htm documents it.

The two important calls are GHI.Processor.Watchdog.Enable(your_timeout) and GHI.Processor.Watchdog.ResetCounter().

@ John, thank you.

But… in VB I [em]cannot[/em] get the following to work:

Imports GHI.Processor

This is not found. So, I cannot access the GHI.Processor object and hence cannot get the watchdog.

Would you be so kind and try yourself in VB and then post a working example?

Many thanks!

@ A_Dupont - Did you add a reference to GHI.Hardware to your project?

@ John, thanks! This solved the compile issue. Never thought of this, really stupid…

So, now I’ve included the reference to GHI.Hardware, I will try the following code, however as this requires in-field testing, it will take a few days to find out if this solved my issues.

Imports GHI.Processor

    Public Sub ProgramStarted()

      ' Initialize WatchDog
      GHI.Processor.Watchdog.ResetCounter()
      GHI.Processor.Watchdog.Enable(5000)

.
.
.


Anyway, thanks again!