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.

mcinnes01's Content

There have been 82 items by mcinnes01 (Search limited from 28-April 23)


By content type

See this member's


Sort by                Order  

#56415 Gainspan WiFi module

Posted by mcinnes01 on 25 February 2014 - 11:49 PM in General Discussion

Hi,

 

I wonder if anyone can help, I am trying to get my gainspan WiFi module working with a netduino 1. I wonder if anyone has a library or can give me some help getting started in creating a library for it?

 

Many thanks

 

Andy




#56416 New: Netduino 4.3.1 SDK and VS2012+ support

Posted by mcinnes01 on 26 February 2014 - 12:10 AM in General Discussion

Cheers Chris.

 

I look forward to it :)




#56467 Gainspan WiFi module

Posted by mcinnes01 on 26 February 2014 - 09:54 PM in General Discussion

Yeah I use google search too the forum one isn't great, spent a few hours going through the old posts. There is a forum thread http://forums.netdui...fi/?hl=gainspan

 

This was started by nickduino now monewwq1 and there used to be an example youtube video or two and some sample code on there. A while back I did some work TTLing the gainspan, but never got round to wiring it up with the netduino. Sadly nicks sample code has gone now and I'm a little unsure of where to start in terms of communicating with it via the netduino, how to send and receive the commands required to setup the gainspan module and finally how this then works in terms of a network connection.

 

I guess I also wonder if mIp can work with this as well?




#56533 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 01 March 2014 - 12:19 AM in Project Showcase

Hi,

 

I am looking at the profiles to add my own, but I am a little confused about the pin references...

 

case InterfaceProfile.NetduinoPlus2:
                    // MOSI(PA7), SCK(PA5), MISO(PB4), INT(PA4), CS(PC8) 
                    Start(MacAddress, name, SPI.SPI_module.SPI1, (Cpu.Pin)4, (Cpu.Pin)38);
                    break;
 
I am a little confused not only about the references in the comments, but also over what pin 38 would relate to?
 
So I have my board (which is pretty much the same as yours) connected as follows:
 
Vcc = 3.3v
Gnd = Gnd
Reset = Reset
Sck = D13
MISO = D12
MOSI = D11
CS = D10
Int = D8
 
Hopefully this is correct?
 
Cheers,
 
Andy



#56539 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 01 March 2014 - 10:23 AM in Project Showcase

I've been having a little play and I set the profile as per the above but I get the following exception whilst deploying

 

'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.dll', Symbols loaded.
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
A first chance exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll
An unhandled exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll
 
This occurs when using the dnslookup example with my new profile for netduino1 as per the above.
 
The error occurs on line:
 
irq = new InterruptPort(irqPin, true, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeLevelLow);
 
From:
 
/// <summary>
/// Creates a new ENC28J60 driver object instance, the chip will be held
/// in reset until the Start method is called
/// </summary>
/// <param name="irqPin">Host pin to use for interrupt request</param>
/// <param name="csPin">Host pin to use for SPI chip select</param>
/// <param name="spiModule">Host SPI module to use</param>
public ENC28J60Driver(Cpu.Pin irqPin, Cpu.Pin csPin, SPI.SPI_module spiModule)
{
irq = new InterruptPort(irqPin, true, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeLevelLow);
irq.OnInterrupt += new NativeEventHandler(irq_OnInterrupt);


            


            // http://www.mikroe.com/forum/viewtopic.php?f=91&p=192252
var cfg = new SPI.Configuration(csPin, false, 0, 0, false, true, 8000, spiModule);
spi = new MultiSPI(cfg);
}

Not sure what is wrong with Microsoft.SPOT.Hardware?

 

My netduino is running 4.2 and I am targeting the 4.2 framework?

 

Andy




#56545 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 01 March 2014 - 01:34 PM in Project Showcase

Hi Chris,

 

According to the mip library:

 

        [Flags]
        public enum PinValidInterruptMode
        {
            NONE = 0,
            InterruptEdgeLow = 2,
            InterruptEdgeHigh = 4,
            InterruptEdgeBoth = 8,
            InterruptEdgeLevelHigh = 16,
            InterruptEdgeLevelLow = 32,
        }
 
The interrupt is set on EdgeLevelLow, I tried it with EdgeLow and got the same exception?
 
Many thanks
 
Andy



#56550 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 01 March 2014 - 04:21 PM in Project Showcase

I am using a standard netduino 1. So am I correct in saying I need to change the method to be as follows:

 

irq = new InterruptPort(irqPin, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLevelLow);

 

And obviously put a 10k between D8 and ground on my N1?

 

Or do I also need to change the interruptmode to EdgeLow as well?]

 

Many thanks

 

Andy




#56551 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 01 March 2014 - 04:57 PM in Project Showcase

Ok, that seemed to get me a little further but now I get the following exception in the Start() method:

 

The thread '<No Name>' (0x2) has exited with code 0 (0x0).
A first chance exception of type 'System.Exception' occurred in NetworkingService.dll
An unhandled exception of type 'System.Exception' occurred in NetworkingService.dll
Additional information: Unable to Communicate to the Ethernet Controller.  Check the InterfaceProfile in your Adapter.Start()
 

Which breaks on line:

if (loopMax <= 0) throw new Exception("Unable to Communicate to the Ethernet Controller.  Check the InterfaceProfile in your Adapter.Start()");

From the code:

/// <summary>
/// Starts up the driver and establishes a link
/// </summary>
public void Start()
{
byte i;


var loopMax = 100;  // about 10 seconds with a 100 ms sleep


// Wait for CLKRDY to become set.
// Bit 3 in ESTAT is an unimplemented bit.  If it reads out as '1' that
// means the part is in RESET or there is something wrong with the SPI 
// connection.  This loop makes sure that we can communicate with the 
// ENC28J60 before proceeding.
// 2.2 -- After a Power-on Reset, or the ENC28J60 is removed from Power-Down mode, the
//        CLKRDY bit must be polled before transmitting packets
do
{
i = ReadCommonReg(ESTAT);
loopMax--;
Thread.Sleep(100);
} while(((i & 0x08) != 0 || (~i & ESTAT_CLKRDY) != 0) && loopMax > 0);


            if (Adapter.VerboseDebugging) Debug.WriteLine("ESTAT: " + ReadCommonReg(ESTAT).ToString());


if (loopMax <= 0) throw new Exception("Unable to Communicate to the Ethernet Controller.  Check the InterfaceProfile in your Adapter.Start()");


            regCheckTimer = new Timer(new TimerCallback(CheckRegisters), null, checkDelay, checkDelay);
            watchdog = new Timer(new TimerCallback(WatchDogCheck), null, 10000, 3000);


Restart();
            //Init();
}



#56552 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 01 March 2014 - 05:24 PM in Project Showcase

I'm pretty sure, the answer is in the error... "Check the interface profile"

 

I think it comes back to my confusion over the values in other profiles of the (Cpu.Pin).

 

I guess that D8 does not equal (Cpu.Pin)8 in reference to a standard netduino 1?

 

Would this be 62 at a guess?

 

And D10 would be 64?

 

Many thanks

 

Andy




#56555 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 01 March 2014 - 05:48 PM in Project Showcase

I have the boards connected as follows:

 

(left netduino / right ENC28)

 

Gnd = gnd

3.3v = vcc

Reset = reset

D13 = SCK

D12 = MISO

D11 = MOSI

D10 = CS

D8 = INT (D8 also has a 10K resistor going to ground)

 

The board is from ebay... http://www.ebay.co.u...=item35c89fc698

 

I have added in SecretLabs.NETMF.Hardward.Netduino, so my profile is as follows:

 

case InterfaceProfile.Netduino1:
                    // MOSI(D12), SCK(D13), MISO(D11), INT(D8), CS(D10) 
                    Start(MacAddress, name, SPI.SPI_module.SPI1, SecretLabs.NETMF.Hardware.Netduino.Pins.GPIO_PIN_D8, SecretLabs.NETMF.Hardware.Netduino.Pins.GPIO_PIN_D10);
                    break;

My interrupt method is as follows:

irq = new InterruptPort(irqPin, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLevelLow);

I now get the error:

 

Error: a3000000
 
Waiting for debug commands...
 
The program '[19] Micro Framework application: Managed' has exited with code 0 (0x0).
 



#56556 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 01 March 2014 - 05:59 PM in Project Showcase

I think that error was an issue with the address odata.netflix.com not returning a dns entry.

 

I managed to get an IP from my DHCP server:

 

Link is now up :)
Setting IP Address to 192.168.1.51
DHCP SUCCESS!  We have an IP Address - 192.168.1.51; Gateway: 192.168.1.254
Updating Gateway Mac from ARP
 

 

but get this error:

 

An unhandled exception of type 'System.Exception' occurred in NetworkingService.dll
 
Additional information: Domain Name lookup for odata.netflix.com failed. 
 
 
Dropping 0 packet(s)
Packet Count is3: 0
1*** ERXRDPT: 0
1*** ERXWRPT: 1062
2*** ERXRDPT: 0
2*** ERXWRPT: 1062
Packet Count is4: 0
Packet Count is5: 0
3*** ERXRDPT: 0
3*** ERXWRPT: 1062
4*** ERXRDPT: 0
4*** ERXWRPT: 1062
4*** Setting Next Packet Pointer to: 0
A first chance exception of type 'System.Exception' occurred in NetworkingService.dll
An unhandled exception of type 'System.Exception' occurred in NetworkingService.dll
Additional information: Domain Name lookup for odata.netflix.com failed. 
 



#56559 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 01 March 2014 - 08:24 PM in Project Showcase

Hmm, same issue with google?

 

Erm does that mean my dns server isn't working correctly? I don't seem to have an issue on my laptop? Is there anything I can do to check/resolve this on a network level or could it be an issue with the driver?

 

One interesting thing I noticed was that when I edit the debug info to print out my dns server, it printed out the value of both the primary and secondary in one strange output:

 

Link is now up :)
Setting IP Address to 192.168.1.51
DHCP SUCCESS!  We have an IP Address - 192.168.1.51; DNS Server: 192.168.1.1.192.168.1.254; Gateway: 192.168.1.254
Updating Gateway Mac from ARP
 
This value came from:
 
Adapter.DomainNameServer.ToAddress()



#56565 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 01 March 2014 - 09:56 PM in Project Showcase

Server:  UnKnown
Address:  192.168.1.1
 
Name:    www.google.com
Addresses:  2a00:1450:400c:c03::67
 173.194.67.147
 173.194.67.103
 173.194.67.99
 173.194.67.104
 173.194.67.105
 173.194.67.106
 
Tried the first IP and it worked :)
 
Although this is great in terms of my netduino project, it means my network config has gone a little wrong. :(



#56584 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 02 March 2014 - 09:23 PM in Project Showcase

Hi Hanz,

 

When I dig in to the payload that is used to populate the options hash table.

 

I see that for options._buckets[6].value there is an 8 byte array containing the values for both IP addresses.

 

This mean that in this line where bucket 6 is assigned to the ns, there is an invalid ip address being assigned.

 

I updated the packet handler, so I could see what was going on and it seems to now work correctly, so I think this is a bug?

 

        /// <summary>
        /// Take care of a packet of DHCP stuff
        /// </summary>
        /// <param name="payload"></param>
        public static void HandlePacket(byte[] payload)
        {
            //Debug.WriteLine("Handling DHCP packet");
            
            // Check Transaction ID!
            if (transactionID == null || payload[46] != transactionID[0] || payload[47] != transactionID[1] || payload[48] != transactionID[2] || payload[49] != transactionID[3]) return;
            
            // To determine the type, we need to find the magic cookie, then find option 0x35h
            // 02 == Offer, 05 == ACK, 06 = NAK
            var options = ParseOptions(payload);


            //Debug.WriteLine("DHCP PKT");


            if (options.Contains("53"))
            {
                //Debug.WriteLine("Rec'd DHCP OFFER - 1");


                if (((byte[])(options["53"]))[0] == 0x02)  // Offer
                {
                    //Debug.WriteLine("Rec'd DHCP OFFER");


                    ushort ipHeaderLength = (ushort)((payload[14] & 0x0f) * 4);
                    PendingIpAddress = Utility.ExtractRangeFromArray(payload, ipHeaderLength + 38, 4);
                    if (options.Contains("54")) Adapter.Gateway = (byte[])options["54"];  // DHCP Server
                    if (options.Contains("6")) Adapter.DomainNameServer = Utility.ExtractRangeFromArray((byte[])options["6"], 0, 4); //DNS Server
                    if (options.Contains("6")) Adapter.DomainNameServer2 = Utility.ExtractRangeFromArray((byte[])options["6"], 4, 4); //Secondary DNS Server
                    if (options.Contains("1")) Adapter.SubnetMask = (byte[])options["1"];  // Subnet
                    if (options.Contains("3")) Adapter.Gateway = (byte[])options["3"];  // Router
                    if (options.Contains("58")) RenewTimer.Change((int)(((byte[])options["58"]).ToInt() * 1050), TwoHoursInMilliseconds); // Got a Renew time
                    if (options.Contains("51")) RenewTimer.Change((int)(((byte[])options["51"]).ToInt() * 750), TwoHoursInMilliseconds); // Got a Lease Time (I am using 750, so we renew after 75% of lease has been consumed)
                    Adapter.GatewayMac = Utility.ExtractRangeFromArray(payload, 6, 6);  // Initial gateway MAC.  Will get confirmed/updated by an ARP Probe


                    SendMessage(DHCP.Request);
                }
                else if (((byte[])options["53"])[0] == 0x05)  // ACK or Acknowledgement
                {
                    // Parse out the Gateway, DNS Servers, IP address, and apply set all the variables with it...


                    //Debug.WriteLine("Rec'd DHCP ACK");


                    if (options.Contains("54")) Adapter.Gateway = (byte[])options["54"];  // DHCP Server
                    if (options.Contains("6")) Adapter.DomainNameServer = Utility.ExtractRangeFromArray((byte[])options["6"], 0, 4); //DNS Server
                    if (options.Contains("6")) Adapter.DomainNameServer2 = Utility.ExtractRangeFromArray((byte[])options["6"], 4, 4); //Secondary DNS Server
                    if (options.Contains("1")) Adapter.SubnetMask = (byte[])options["1"];  // Subnet
                    if (options.Contains("3")) Adapter.Gateway = (byte[])options["3"];  // Router
                    if (options.Contains("58")) RenewTimer.Change((int)(((byte[])options["58"]).ToInt() * 1050), TwoHoursInMilliseconds);  // Got a Renew time
                    if (options.Contains("51")) RenewTimer.Change((int)(((byte[])options["51"]).ToInt() * 750), TwoHoursInMilliseconds);  // Got a Lease Time (I am using 750, so we renew after 75% of lease has been consumed)
                    Adapter.GatewayMac = Utility.ExtractRangeFromArray(payload, 6, 6);  // Initial gateway MAC.  Will get confirmed/updated by an ARP Probe


                    transactionID = null;
                    Adapter.AreRenewing = false;
                    Adapter.IPAddress = PendingIpAddress ?? Adapter.IPAddress;


                    Adapter.startupHold.Set();  // This will release the Adapter.Start() Method!  (if waiting)


                    Debug.WriteLine("DHCP SUCCESS!  We have an IP Address - " + Adapter.IPAddress.ToAddress() + "; DNS Server: " + Adapter.DomainNameServer.ToAddress() + "; Gateway: " + Adapter.Gateway.ToAddress());


                    ARP.SendARP_Probe(Adapter.Gateway);  // Confirm Gateway MAC address
                }
                else if (((byte[])options["53"])[0] == 0x06)  // NACK or Not Acknowledged!
                {
                    Debug.WriteLine("DHCP N-ACK");
                    transactionID = null;
                    Adapter.AreRenewing = false;


                    // We have failed to get an IP address for some reason...!
                    Adapter.IPAddress = null;
                    Adapter.Gateway = null; 
                    Adapter.GatewayMac = null;
                }
            }
        }



#56589 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 02 March 2014 - 10:13 PM in Project Showcase

Yep already on it on codeplex :)

 

My router is Thomson TG582n

 

I am running my own DHCP and DNS servers in server 2012.

 

TCP/IP is up and running, now just to see if it is possible to get the multi SPI to share with my MCP23S17s... Do you think it is possible?

 

Thanks for all help :)

 

Andy




#56591 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 02 March 2014 - 10:35 PM in Project Showcase

Ahh that makes sense now, that would be great I would definitely be interested in that :) 




#56592 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 02 March 2014 - 11:10 PM in Project Showcase

Carrying the multi SPI conversation on here...

 

Do you think it is possible to incorporate Steffan's multi spi mgr in to your MCP23S17 driver?

 

Thus making it possible to share with MIP without modifying MIP?

 

On another topic...

 

I was considering the use of the bus.

 

If I wanted to dynamically group pins/ports and abstract this further to allow me to create groups or "buses" across chips do you think this is possible.

 

Let me elaborate...

 

Am I correct in saying the use of a bus is to allow for multiple port changes to be made in one write, thus increasing speed and efficiency?

 

If this is correct, then I also understand that I can't make a bus spanning multiple chips, however if for example I wanted to change the state of 10 pins 5 on each chip, then I could create a class that identifies which pins are on which bus and perform 2 writes one for each bus?

 

This is obviously going to be more efficient than 10 separate writes and gives me the ability, for example to "turn off all lights" or "turn off everything".

 

Many thanks,

 

Andy




#56629 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 04 March 2014 - 05:53 PM in Project Showcase

I've managed to get all the examples working except the UDP one, do you know what is meant to happen with this one? Does it receive UDP messages and if so how do I test it?

 

My next step is to incorporate MQTT, not sure if anyone has managed this with mIp yet?

 

Many thanks

 

Andy




#56740 NeonMika.Webserver

Posted by mcinnes01 on 10 March 2014 - 07:12 PM in Project Showcase

Hi 

 

Just wondered if this could work with the MiP library in order to use it on N GO! and standard netduino 1?

 

Also would it be possible to use MQTT with it?

 

Many thanks

 

Andy




#56761 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 12 March 2014 - 12:01 AM in Project Showcase

Sorry post to wrong thread.




#56819 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 15 March 2014 - 04:43 PM in Project Showcase

Hi Hanz,

 

No offence taken, I am taking your advice and investigating a little more before I repost. I have made a better test subject with a load of leds and am just reworking my changes to the code to get a proper test in. I should have some findings shortly so I will post back when I have something more substantial.

 

Many thanks,

 

Andy




#56823 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 15 March 2014 - 06:41 PM in Project Showcase

Hi,

 

I have done a little testing and my adjustments seem to work in terms of implementing the standard multi SPI class as per the netmf toolbox.

 

Please see amendments attached.

 

Next task is to create a wrapper to handle the scenario of creating cross chip groups that leverage the bus functionality where possible.

 

Many thanks,

 

Andy

 

http://1drv.ms/OlgfGw

Attached Files




#56914 Gainspan WiFi module

Posted by mcinnes01 on 19 March 2014 - 02:11 PM in General Discussion

Hi Hanz,

 

I wonder if you have made any progress with your RAK410/411 wifi module class library?

 

The problem I have with writing drivers is I don't really know where to start, and although I have been through the datasheets and command guides a few times I'm a little unsure as to where to approach it from.

 

I wonder if you have perhaps started the lib for your module, if I could see the code so far I can try to follow your approach to and see if I can do the same for my module?

 

Thanks again for all your help,

 

Andy




#56919 Netduino - WiFi

Posted by mcinnes01 on 19 March 2014 - 07:03 PM in Project Showcase

Hi,

 

Does anyone still have the code that was on this thread or any code to get the gainspan module working?

 

Many thanks

 

Andy




#57441 MIP tcp/ip stack running on Netduino mini !!

Posted by mcinnes01 on 08 April 2014 - 10:51 PM in Project Showcase

Hi Hanz,

 

Good news, with no amendments to mIp bar the fix in the dhcp.cs and just tweaking your MCP23S17 library to run on the MultiSPI manager, I have been able to get both devices working together.

 

I am still playing with the web server on the netduino in terms of creating input fields and handling the requests as this is my first attempt. If I get something up and running I will post a video.

 

I may see if I can get the neonmika web server running on a standard netduino, any way thanks again for the help.

 

Andy





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.