GetSocketsByUniqueId - not working? - Netduino Go - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

GetSocketsByUniqueId - not working?


  • Please log in to reply
13 replies to this topic

#1 neslekkim

neslekkim

    Advanced Member

  • Members
  • PipPipPip
  • 350 posts
  • LocationOslo, Norway

Posted 04 March 2013 - 09:13 AM

I tried using the Komodex 7seg display module on my Go, running v4.2.2.1, but I cannot talk to it.

 

the GetSocketsByUniqueId method is not returning anything when sending the guid for the module (assuming the source for the module is correct).

 

I cannot get the method BindSocket working either.

 

Edit: two words disappeared ;)


--
Asbjørn


#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 05 March 2013 - 07:07 AM

Hi neslekkim, Is this a 7-seg module or lcd character module? Which GoPort is it plugged into? Is anything else plugged into your Netduino Go? Chris

#3 neslekkim

neslekkim

    Advanced Member

  • Members
  • PipPipPip
  • 350 posts
  • LocationOslo, Norway

Posted 05 March 2013 - 07:33 AM

7seg, skipped a few words when typing ;)

 

I bought all the parts and built this kit: http://www.nwazet.com/prokit

 

 

The 7segment is on port 4, nwazet Daq on port 5 (working), nwazet display port 3, potmeter port 6

 

I notice that the library for the Daq does only BindSocket(socket), but 7seg uses: BindSocket(socket, _moduleGuid) (if socket is given)

 

 

Havent gotten time to test display and potmeter yet, so far, every time i finally allocate a bit of time to se if this works on Go, I get stuck in these little things..

 

I guess if you release the sources for gobus and such with each new firmwareversions, would have been helpful for debugging, maybe..

 

Does it exist any method that enumerates the guid's available?


--
Asbjørn


#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 05 March 2013 - 08:42 AM

Hi neslekkim, I just pinged Matt. Together we should be able to help sort this out for you. If you unplug the other modules and then plug the 7seg into any of GoPorts 5-8, does it work alright? All the source for release versions of Netduino Go is posted. If you're missing a particular bit, I can point you in the right direction. Chris

#5 neslekkim

neslekkim

    Advanced Member

  • Members
  • PipPipPip
  • 350 posts
  • LocationOslo, Norway

Posted 05 March 2013 - 08:54 AM

So you consider this not an release? http://forums.netdui...-v422-update-1/

Only 4.2.0 source here: http://www.netduino.com/downloads/

 

Got info from Matt, will try some things as soon as possible.

(I don't have the bits here..)

 

Btw, do you know if this should work? GetUniqueIdsFromUnboundSockets if I can get the guid's from all modules to see if I get any at all?


--
Asbjørn


#6 neslekkim

neslekkim

    Advanced Member

  • Members
  • PipPipPip
  • 350 posts
  • LocationOslo, Norway

Posted 05 March 2013 - 09:02 AM

Actually no source at all on the download page, the 4.2.0 file, is only for the firmware, the sdk only contains binaries.

Nowere to find the Gobus source, I know it have been released in an thread earlier, but that's some time ago.


--
Asbjørn


#7 neslekkim

neslekkim

    Advanced Member

  • Members
  • PipPipPip
  • 350 posts
  • LocationOslo, Norway

Posted 05 March 2013 - 08:31 PM

With the four modules attached to my Go, the method GoModule.GetUniqueIdsFromUnboundSockets returns only one guid, which is

 53423e80-60ac-4b1c-8983-e775d9653ee0

 

When disconnecting the Daq module I get one more:

 

53423e80-60ac-4b1c-8983-e775d9653ee0
247a2180-d1c6-4d13-8a23-7c2c06ad96bc
 
I removed the Nwazet display, and still get the same two, attached the Daq again, and 247.. guid disapears.
But when I removed the daq, I also commented out the code for daq, and the 7seg works.
Attaches the nwazet display, and the daq, and everything works.
 
adding the code for the daq again, and it crashes.
 
Then I moved the initialization code for the daq below the code for 7seg, and now the 7seg works, but the code for daq crashes after daq.initialize..
 
So, it seems that modules needs to be initialized in the order they are attached?, and that there are incompabilities with the Daq module and rest of Go
Since Daq is on port 5, and 7Seg is on 4, the are not sharing the Go bus either..
 
Is there noone who have tried all modules together?

--
Asbjørn


#8 Fabien Royer

Fabien Royer

    Advanced Member

  • Members
  • PipPipPip
  • 406 posts
  • LocationRedmond, WA

Posted 05 March 2013 - 10:25 PM

[font="arial, sans-serif;font-size:12.800000190734863px;"]Hi Asbjorn,[/font]

 
I have a DAQ demo (https://bitbucket.or...Demo?at=default) in the repository that works just fine with the following modules:
  • DAQ w/ SD card
  • Touch Display
  • SL Potentiometer
  • Komodex 7-segment display
  • 3x I2C sensors
  • 1x XBee radio
It's using .Net MF 4.2.2 or something like that, which still requires dropping the speed on the SPI bus. It's been extremely stable and has been running for months now. I don't use any module discovery features.
 
In my experience, sticking with the basics of .Net MF is the only reliable way to go with Netduino Go.
 
Cheers,
-Fabien.


#9 neslekkim

neslekkim

    Advanced Member

  • Members
  • PipPipPip
  • 350 posts
  • LocationOslo, Norway

Posted 10 March 2013 - 11:13 AM

ok, the demo runs fine, so everything works, but not my code, even if it was very similar for the two modules. I added some code to try to enumerate the go bus, and it seems that alone crashes everything? this class:  

public class GoEnumerate : GoBus.GoModule {    public void EnumerateGoPorts() {      var lll = GetUniqueIdsFromUnboundSockets();      foreach (var guid in lll) {        Debug.Print(guid.ToString());      }    }  } 

and this code in main:  

var l = new GoEnumerate();l.EnumerateGoPorts();

Why would that make everything stop working?, or, is there an better way to discover which modules are connected? This is my full code:  

using System;
using System.Threading;
using Microsoft.SPOT;
using SecretLabs.NETMF.Hardware.NetduinoGo;
using Nwazet.Go.DAQ;
using System.Text;
using Taos;
using Komodex.NETMF;
 
namespace NetduinoGoApplication1 {
 
  public class GoEnumerate : GoBus.GoModule {
    public void EnumerateGoPorts() {
      var lll = GetUniqueIdsFromUnboundSockets();
      foreach (var guid in lll) {
        Debug.Print(guid.ToString());
      }
    }
  }
 
  public class Program {
    public static SevenSegmentDisplay seg;
    public static NwazetDAQ daq;
 
    public static void Main() {
      var l = new GoEnumerate();
      l.EnumerateGoPorts();
      seg = new SevenSegmentDisplay(GoSockets.Socket4);
      daq = new NwazetDAQ();
 
      daq.Initialize(GoSockets.Socket5, 10000);
      var state = daq.GetClockState();
      if (state == NwazetDAQ.ClockState.Invalid) {
        Debug.Print("setting clock");
        daq.SetDateTime(new DateTime(2012, 10, 05, 20, 39, 00));
      }
 
      //var usartConfig = new UsartConfig();
      //usartConfig.BaudRate = UsartBaudRate.Baud57600;
      //daq.UsartPort.SetConfig(usartConfig);
 
      seg.SetBrightness(0.1f);
      seg.SetValue(1201);
      Log("Initialize()");
      daq.Interrupts += new InterruptEventEventHandler(InterruptHandler);
      using (var daqConfig = new DaqConfig(daq)) {
        if (daqConfig.IsOptionEnabled(DaqSetting.DiagnosticsToSerial) == false) {
          daqConfig.SetOption(DaqSetting.DiagnosticsToSerial, true);
          daqConfig.Commit(daq);
          daq.Reboot();
        }
      }
      try {
        I2cTSL2561Test();
      }
      catch (Exception e) {
        Log(">>>UNCAUGHT EXCEPTION: " + e.Message);
      }
      daq.Reboot();
    }
 
 
    public static void Log(string line) {
      Debug.Print("debug: " + line);
      daq.UsartPort.Write(Encoding.UTF8.GetBytes("DAQ: " + line + "rn"));
    }
 
    public static void I2cTSL2561Test() {
      Log("I2cTSL2561Test begin");
      try {
        var lightSensor = new TaosTSL256x(daq.I2cPort, TaosTSL256x.Address.AddressPinFloat);
        Log("Light sensor ID: " + lightSensor.GetSensorId());
        Log("--------------------------------------------");
        var count = 3;
        while (count-- != 0) {
          Log("Raw Luminosity: " + lightSensor.Read());
          Log("Full spectrum luminosity: " + lightSensor.FullSpectrum);
          Log("Infrared spectrum luminosity: " + lightSensor.InfraredSpectrum);
          Log("Visible spectrum luminosity: " + lightSensor.VisibleSpectrum);
          Log("Lux: " + lightSensor.Lux);
          Log("--------------------------------------------");
          Thread.Sleep(500);
        }
      }
      catch (I2cException e) {
        Log("I2C transaction failed: " + e.Message);
      }
      Log("I2cTSL2561Test end");
    }
 
    public static void InterruptHandler(InterruptEvent intEvent) {
      Log("Interrupt on Gpio:" + intEvent.Id + ", Count: " + intEvent.Count + ", Rollover: " + intEvent.RollOverCount);
    }
  }
 
}

If I remove the two first lines in the Main method everything works, but with then it crashes with this error:  

A first chance exception of type 'System.ApplicationException' occurred in Nwazet.Go.Core.dll An unhandled exception of type 'System.ApplicationException' occurred in Nwazet.Go.Core.dll Additional information: _headerVersion

and stacktrace:  

Nwazet.Go.Core.dll!Nwazet.Go.Helpers.BasicTypeDeSerializerContext.ReadHeader(int BufferStartOffset) Line 64 + 0x37 bytes C# Nwazet.Go.Core.dll!Nwazet.Go.Helpers.BasicTypeDeSerializerContext.Bind(byte[] buffer, int BufferStartOffset) Line 51 + 0x34 bytes C# Nwazet.Go.DAQ.dll!Nwazet.Go.DAQ.NwazetDAQ.Receive() Line 145 + 0x2d bytes C# Nwazet.Go.DAQ.dll!Nwazet.Go.DAQ.NwazetDAQ.GetClockState() Line 226 + 0x22 bytes C# NetduinoGoApplication1.exe!NetduinoGoApplication1.Program.Main() Line 32 + 0x43 bytes C#


--
Asbjørn


#10 neslekkim

neslekkim

    Advanced Member

  • Members
  • PipPipPip
  • 350 posts
  • LocationOslo, Norway

Posted 10 March 2013 - 11:18 AM

damn this editor, is it possible to link gists instead?


--
Asbjørn


#11 neslekkim

neslekkim

    Advanced Member

  • Members
  • PipPipPip
  • 350 posts
  • LocationOslo, Norway

Posted 13 March 2013 - 09:33 PM

So that's it then?

--
Asbjørn


#12 Billy Propes

Billy Propes

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationVincent, OH, USA

Posted 30 March 2013 - 04:30 AM

I'm having the same problem here with a custom built module.  I'm using:

 

Public Sub New()

 

'Get any sockets which have the module hooked up to them  

Dim compatibleSockets() As GoSocket = MyBase.GetSocketsByUniqueId(m_ModuleGuid)

'If there are no sockets with the DigIO Module hooked up, throw an exception

If compatibleSockets.Length = 0 Then

Throw New Exception("DigIO: Unable to locate a DigIO Module on the GoBus")

End If

 

'Initialize our ModuleCommunicator with that socket

Initialize(compatibleSockets(0))

 

This code seemed to run fine on my old GO.  My new GO doesn't seem to want to run it.  It's throwing 4 "NotSupportedException"s when it gets to MyBase.GetSocketsByUniqueID

 

FYI, the source code for the 4.2 SDK is posted but not the source code for 4.2.2.  It makes it kinda difficult to debug anything without the source code.  We can't see what's actually throwing the exceptions.

 

Any ideas.....anybody?



#13 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 30 March 2013 - 03:36 PM

Hi billy, Asbjørn: We've never had an issue enumerating GoBus modules here, but it looks like there's an issue in the field here which we need to solve. First--there are some Netduino Go accessories which aren't GoBus modules. This is either due to them not fitting within the power profiles, because they don't respond to enumeration requests consistently, because they use non-standard initialization, etc. This includes several custom modules that community members have built. We like this kind of hacking--but it's important to remember that introducing non-GoBus-compliant accessories to the bus is both fun and dangerous :) billy--are you running the same firmware on both of your Netduino Go mainboards? They're all identical and should exhibit the same behavior. Can you use other GoBus modules on your mainboard without issue? Also--which source in particular are you looking for? The version of the SDK and the version of the firmware on the mainboard may not match exactly--since the SDK doesn't necessarily need to updated for each new firmware release. We definitely want to post any source that missing, if something is missing. Chris

#14 Billy Propes

Billy Propes

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationVincent, OH, USA

Posted 30 March 2013 - 05:06 PM

Thanks Chis.  Looks like my new GO was running an old version of firmware or something.  Upgraded the firmware to the latest and it now works like a charm  :-)

 

The SDK source I was talking about is the 4.2.2.0.  In the downloads page, in the upper-left corner, there are binaries for the "Netduino 4.2.2.0 SDK".  However, in the lower-right corner, the posted source code is the "Netduino SDK v4.2.0 Source".  I'm currently working with the 4.2.2 binaries and I find it extremely helpful to be familiar with the SDK source code when writing code.  Would it be possible for you to post the source?

 

Thanks again,

Billy






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.