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 19-April 23)


By content type

See this member's


Sort by                Order  

#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




#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



#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




#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



#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?




#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 :)




#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




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

Posted by mcinnes01 on 25 February 2014 - 11:44 PM in Project Showcase

Hi,

 

I wonder if you can help, I am trying to get mip up and working on my standard netduino 1 with 4.2 running on it.

 

First of all what pins do I need to connect to the nic?

 

Also do I need to add another interface profile enum for the netduino 1?

 

Many thanks,

 

Andy




#56410 New: Netduino 4.3.1 SDK and VS2012+ support

Posted by mcinnes01 on 25 February 2014 - 10:24 PM in General Discussion

Hi Chris,

 

Is there any release for the netduino 1?

 

Also any news on one-wire for the netduino 1?

 

Many thanks,

 

Andy




#56407 OutputExpander - How to Make a Netduino GO! Module

Posted by mcinnes01 on 25 February 2014 - 08:46 PM in Netduino Go

Hi Mark,

 

Just a thought, you may have seen the recent library hanzibal made for the MCP23S17. I was wondering if you have looked at the STM8L range?

 

These chips have 2 SPI buses.

 

This is a little beyond me, but I would love a dual MCP23S17 GO bus module.

 

What are your thoughts on the STM8L and is it possible to use both SPI buses, one for GO bus and the other for the MCP23S17s?

 

Many thanks

 

 

andy




#56350 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 24 February 2014 - 10:01 PM in Project Showcase

Yes and multi spi works too. Slight issue to work out with my code. The idea of a continuous array of output ports span multiple ics is great, but I'm not sure how I would access the relevant pins for example:

 

(Left power 2 value, right array position)

 

1 - 1
2 - 2
4 - 3
8 - 4
16 - 5
32 - 6
64 - 7
128 - 8
256 - 9
512 - 10
1024 - 11
2048 - 12
4096 - 13
8192 - 14
16384 - 15
32768 - 16
1 - 17
2 - 18
4 - 19
8 - 20
16 - 21
32 - 22
64 - 23
128 - 24
256 - 25
512 - 26
1024 - 27
2048 - 28
4096 - 29
8192 - 30
16384 - 31
32768 - 32
 



#56347 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 24 February 2014 - 08:12 PM in Project Showcase

Success on 1 chip :)

 

 

 

 




#56345 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 24 February 2014 - 07:38 PM in Project Showcase

Ok will do, I will give it a spin now.

 

Cheers,

 

Andy




#56342 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 24 February 2014 - 07:12 PM in Project Showcase

I should have spotted that, my bad.

 

I updated the code but get a new error on the AddSPI:

The thread '<No Name>' (0x2) has exited with code 0 (0x0).A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dllAn unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dllAdditional information: key exists

It occur on the line _cfg.Add(key, cfg);

            public void AddSPI(int key, SPI.Configuration cfg)            {                lock (_cfg)                    _cfg.Add(key, cfg);            }



#56340 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 24 February 2014 - 06:32 PM in Project Showcase

Hi Hanz,

 

Firstly thanks for taking the time to help :)

 

I have updated to your latest code and still get the problem with the same pin being in use. I was a little unsure on what I needed to do in terms of pin number (point 1). Also I'm not sure what I need to do with the hardware address, does this need to be 0 for the creation of both MCP23S17s?

The thread '<No Name>' (0x2) has exited with code 0 (0x0).A first chance exception of type 'MCP23S17Lib.MCP23S17.MCP23S17Exception' occurred in Testspi1.exeAn unhandled exception of type 'MCP23S17Lib.MCP23S17.MCP23S17Exception' occurred in Testspi1.exeAdditional information: MCP23S17: Pin already in use: Pin_0x0

Many thanks,

 

Here is my current code:

using System.Threading;using SecretLabs.NETMF.Hardware.Netduino;using MCP23S17Lib;namespace Testspi1{    public class Program    {        // Number of registers        private static uint icCnt = 2;        // Pins per register        private static uint icPins = 16;        //Total pins        private static uint pinCnt = icCnt * icPins;        // Sleep        private static int sleep = 200;        public static MCP23S17.OutputPort[] Outs = new MCP23S17.OutputPort[pinCnt];        public static MCP23S17[] chip = new MCP23S17[icCnt];        public static void Main()        {            // create a new instance of the driver class using pin 17 for !CS and pin 18 for IRQ            for (int ic = 0; ic < icCnt; ic++)            {                chip[ic] = new MCP23S17(SPI_Devices.SPI1, Pins.GPIO_PIN_D10, Pins.GPIO_NONE, (byte)ic, 7000);                // Define all outputs                for (int pin = 0; pin < pinCnt; pin++)                    Outs[16 * ic + pin] = chip[ic].CreateOutputPort((MCP23S17.Pins)(1 << pin), false);            }            while(true)            {                foreach (MCP23S17.OutputPort o in Outs)                {                    o.Value = true;                    Thread.Sleep(sleep);                    o.Value = false;                }            }        }    }



#56328 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 24 February 2014 - 07:51 AM in Project Showcase

Hi Hanz,

 

That is much clearer, thanks and I welcome any constructive criticism :)

 

I am getting this error:

A first chance exception of type 'MCP23S17Lib.MCP23S17.MCP23S17Exception' occurred in Testspi1.exeAn unhandled exception of type 'MCP23S17Lib.MCP23S17.MCP23S17Exception' occurred in Testspi1.exeAdditional information: MCP23S17: Pin already in use: Port0000 Uncaught exception 

On the throw exception in the code:

        private void _RegisterPort(_Port pin)        {            int idx = (int)pin.Pin;            if (_pins.Contains(idx))                throw new MCP23S17Exception("Pin already in use: " + pin.Name);            // store it            _pins[idx] = pin;        }

Not sure what I am missing?

 

Also I don't seem to be getting any output on the board? I can see there is power there, but in all my tests so far I have not lit an LED. The LED is connected to one of the digital pins on chip 1 and is then connected to the ground on the board. My first test to define and switch one port on constantly resulted in no output on chip one on any pin and there was out put on a few pins on chip 2. I will see if I can recreate that scenario.

 

I wonder if there hardware address isn't set correctly in my code?

 

Does this need to be a hex value and where would I set it?

 

Many thanks

 

Andy




#56311 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 23 February 2014 - 08:54 PM in Project Showcase

Hi Hanz,

 

Am I doing something wrong or is this where the bug lies with multiple chips?

 

I get an error on the line:

            _spi = new SPI(new SPI.Configuration(xcsPin, false, 0, 0, false, true, spiSpeedkHz, spiModule));

From this bit of the driver:

       /// <summary>        /// Create a new instance of the MCP23S17 driver        /// </summary>        /// <param name="spiModule">SPI module to use</param>        /// <param name="xcsPin">Chip select pin for SPI bus</param>        /// <param name="irqPin">Interrupt pin</param>        /// <param name="hwAddr">Chip hardware address</param>        /// <param name="spiSpeedkHz">SPI clock speed in kHz</param>        public MCP23S17(SPI.SPI_module spiModule, Cpu.Pin xcsPin, Cpu.Pin irqPin, byte hwAddr, uint spiSpeedkHz)        {            _spi = new SPI(new SPI.Configuration(xcsPin, false, 0, 0, false, true, spiSpeedkHz, spiModule));

The error I get is:

    #### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####    #### Message:     #### Microsoft.SPOT.Hardware.Port::ReservePin [IP: 0000] ####    #### Microsoft.SPOT.Hardware.SPI::.ctor [IP: 0022] ####    #### MCP23S17Lib.MCP23S17::.ctor [IP: 0022] ####    #### Testspi1.Program::Main [IP: 0023] ####A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dllAn unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dll

Any ideas?

 

Cheers,

 

Andy




#56309 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 23 February 2014 - 08:19 PM in Project Showcase

Hi Hanz,

 

I realized that right after I posted, I have updated my code which I hope allows for multiple MCP23S17s to be defined and will produce outputs in a continuous array. Do you think the amended code looks correct or can you suggest some improvements?

 

I will try out your suggest with D12 and report back.

 

Thanks again,

 

Andy




#56248 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 21 February 2014 - 11:35 AM in Project Showcase

Hi Hanz,

 

I think I am doing something wrong?

 

With the board I have attached the pins to directly to a standard netduino 1 as follows:

 

Vcc = 3.3v

Gnd = Gnd

CS = D10

SCK = D13

MISO = D12

MOSI = D11

 

// UPDATED code corrected power of 2

    public class Program    {        // Number of registers        private static uint icCnt = 1;        // Pins per register        private static uint icPins = 16;        //Total pins        private static uint pinCnt = icCnt * icPins;        // Sleep        private static int sleep = 200;        public static MCP23S17.OutputPort[] Outs = new MCP23S17.OutputPort[pinCnt];        public static MCP23S17[] chip = new MCP23S17[icCnt];        public static void Main()        {            // create a new instance of the driver class using pin 17 for !CS and pin 18 for IRQ            for (byte ic = 0; ic < icCnt; ic++)            {                chip[ic] = new MCP23S17(SPI_Devices.SPI1, Pins.GPIO_PIN_D10, Pins.GPIO_NONE, ic, 7000);            }                        // Define all outputs            uint i = 0;            for (uint Counter = 0; Counter < pinCnt; ++Counter)            {                if (Counter / 16 == i + 1) { i = i + 1; }                int iPin = 1 << (int)(Counter-(i*icPins));                Outs[Counter] = chip[i].CreateOutputPort((MCP23S17.Pins)iPin, false);            }            while(true)            {                foreach (MCP23S17.OutputPort o in Outs)                {                    o.Value = true;                    Debug.Print(o.Name.ToString() + " is ON");                    Thread.Sleep(sleep);                    o.Value = false;                    Debug.Print(o.Name.ToString() + " is OFF");                }            }        }

I noticed that there were a few pins that were just sat high on chip 2 when I turned GPIO_Pin1 on chip 1 on, on its own (i.e. without any loop)

 

 

Thanks again,

 

Andy




#56247 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 21 February 2014 - 10:48 AM in Project Showcase

Hi Hanz,

 

The board is sounding like a fantastic design as I slowly eke out more details about it.

 

The board has 6 pins either side.

 

VCC                                        I0A (IRQ pin A on chip 1)

GND                                        I0B (IRQ pin B on chip 1)

CS                                           I1A (IRQ pin A on chip 2)

SCK                                        I1B (IRQ pin B on chip 2)

MOSI                                       BA1 (used for altering the address of chip 2)

MISO                                       BA0 (used for altering the address of chip 1)

 

$_1.JPG

 

I will let you know my results :)

 

Andy




#56235 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 20 February 2014 - 08:24 PM in Project Showcase

Will do thanks again. :)




#56233 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 20 February 2014 - 08:07 PM in Project Showcase

Hi,

 

I've heard back, waiting on the IRQ pins information and maybe a schematic but got this about the chaining. There are basically 2 little solder pads that can be bridged to get the different values.

 

"[color=rgb(0,0,0);font-family:arial, sans-serif;font-size:13px;]On the left-hand chip (Bank 0) A0 is pulled to ground through 10K?. On the right hand chip (Bank 1) A0 is pulled up to Vcc.[/color]

[color=rgb(0,0,0);font-family:arial, sans-serif;font-size:13px;]On both chips A1 and A2 are both pulled down to ground through 10K?, and the two solder jumpers BA0 and BA1 can be shorted to link A1 and A2 to Vcc respectively.[/color]

[color=rgb(0,0,0);font-family:arial, sans-serif;font-size:13px;]So, by default, the left chip is 0b000 and the right chip is 0b001. Shorting BA0 yields the two addresses 0b010 and 0b011, etc. The 4 combinations of BA0/BA1 (00, 01, 10 and 11) give you the addresses for 4 boards (BA = Board Address)."[/color]

 

No worries on the driver, I'm really grateful for the hard work you have put in to it so far. I will have a go with it as it is a let you know how I get on in the mean time and hopefully you will find a way around the chaining issue. I'm no real C++ developer, but I wonder if the majenko driver for arduino offers any ideas?

 

Thanks again,

 

Andy




#56228 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 20 February 2014 - 04:40 PM in Project Showcase

Hi

 

I have this board by majenko http://cgi.ebay.ie/w...em=191068114141

 

They have an arduino library here https://github.com/m...kotech/MCP23S17

 

I have also emailed them to find out if they have any details on the pins as requested.

 

I will let you know as soon as I do, do you think I can get the board working for the first chip with your code for testing until I have the details re pins 1,2,3 and whilst you work your bug out?

 

In terms of the examples they all included the irq pin, do just put a "null" in when the irq pin is not needed? 

 

Many thanks

 

Andy




#56213 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 19 February 2014 - 11:30 PM in Project Showcase

Out of interest, like the netmf toolbox for the 595s, there is a "chain" method, that allows you to chain multiple 595s; is there a similar function in your fantastic library?

 

Also on pin assignment, I am using a standard netduino 1, I am using the SPI pins (D11,12,13) and D10 as CS. Would I be right in saying D12 should be the IRQ in my situation?

 

Also as the board I have has 2 MCP23S17 chips on it and seemingly no options to add additional CS, can I use just the 1 CS?

 

The boards have (MOSI, MISO, SCK, CS, VCC, GND)

 

Thanks again,

 

Andy




#56209 Extensive driver for the MCP23S17 I/O expander

Posted by mcinnes01 on 19 February 2014 - 10:27 PM in Project Showcase

Thanks Hanzibal!

 

I have a dual board I bought on ebay, I will let you know how I get on.

 

Thanks again, fantastic work.

 

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.