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.

VanKurt's Content

There have been 19 items by VanKurt (Search limited from 29-March 23)


By content type

See this member's

Sort by                Order  

#52657 Problem with simple Webserver

Posted by VanKurt on 09 September 2013 - 05:02 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi Anthony,

actually I solved the problem yesterday by using the following code. Now everything works 100% reliably. Yay! :D

mServerSocket.ReceiveTimeout = 500;            while (true)            {                try                {                    using (Socket clientSocket = mServerSocket.Accept())                    {                        // Try to read a request                        var buffer = new byte[1024];                        if(clientSocket.Receive(buffer, 1024, SocketFlags.None) > 0)                        {

But I think your solution might work just as well, too. The trick is to wait for the bytes to come in and not to abort prematurely. So screw those online-tutorials; they are all wrong ;)

Thank you!




#52612 Problem with simple Webserver

Posted by VanKurt on 06 September 2013 - 03:13 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello everyone,

I'm currently implementing a simple Webserver with my Netduino Plus 2. The code I use is pretty straight forward and similar to what you find in all those tutorials out there:

public void ListenerThread(){    mServerSocket.Listen(10);    while (true)    {        using (Socket clientSocket = mServerSocket.Accept())        {            // Try to read a request            int bytesReceived = clientSocket.Available;            if (bytesReceived > 0)            {                //Get request                var buffer = new byte[bytesReceived];                clientSocket.Receive(buffer, bytesReceived, SocketFlags.None);                string request = new string(Encoding.UTF8.GetChars(buffer));                // Compose a response                ProcessRequest(clientSocket, request);                clientSocket.Close();            }//end if        }//end using    }//end while}

Now to my problem:

 

When I connect to this Webserver from my PC that works fine in about 30% of the cases. In all other 70% percent my browser immediately (not waiting or anything!) shows an error message (Chrome):

 

 

...No data was received...

 

Or on Firefox:

 

 

....Zero sized reply...

 

When I hit the refresh button like mad I will finally get the website my Netduino should reply with.

So I started debugging the method shown above. In the debugger the problem becomes pretty obvious:

 

Posted Image

 

Calling "Available" on the TCP socket returns my 0 bytes. Thus the Netduino does not react (and does not respond with the HTML page). In the cases when it works the number of bytes is around 450, and the following Read-call returns a nice HTTP-Request sent by the browser.

 

So my question is: WTF are the browsers doing here? Why are they opening a TCP connection and not sending anything? Or am I handling the incomming connection the wrong way?

 

 

BTW: I'm using the 4.3 Beta Firmware from this Forum along with Visual Studio 2012.

I hope this problem isn't caused by the lwIP stack in the beta?




#52514 New: Netduino 4.3 SDK and VS2012 support!

Posted by VanKurt on 03 September 2013 - 05:08 AM in General Discussion

Is there any news on when to expect the next (and maybe final?) release of the 4.3 Firmware?

 

Right now I'm experience some strange behavior in TCP/IP communication. And I'm not sure if it's my code or maybe caused by lwIP in the 4.3 beta firmware. So having a final, stable IP stack would really help in narrowing that down ;-)

BTW: I'm stuck with 4.3 since I'm using VS2012 (wouldn't like to downgrade from that).




#52327 Netduino shuts down after a few seconds

Posted by VanKurt on 24 August 2013 - 05:19 PM in Netduino Plus 2 (and Netduino Plus 1)

Sadly I can't manage to revive my little Netduino  :(

So I guess I'll replace both, the power supply and the Board...

 

Thanks for your help!




#52322 Netduino shuts down after a few seconds

Posted by VanKurt on 24 August 2013 - 09:00 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi,

I just realized I did some wrong interpretations there. Actually it seems as if the Netduino ist damaged:

 

The white and blue LEDs are now blinking constantly (also the Netduino "beeps" while the LEDs are blinking). It is not recognized by the PC anymore, too.

 

No matter what power Supply I use (5V from PC or smartphone charger, or 9V DC power supply) the problem won't go away.

So I guess the Netduino is fried?  :(




#52320 Netduino shuts down after a few seconds

Posted by VanKurt on 24 August 2013 - 07:07 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi there,

Today I noticed that my Netduino Plus 2 shuts down after a few seconds. E.g. my blinking LED stops blinking, so program execution seems to have stopped.

 

Could that be due to the power supply? I have a 5V supply connected to the USB connector of the Netduino. After doing a little measurement it seems that the supply's voltage is actually between 5.2 and 5.3 Volts.

Is that too much? Could it cause the Netduino to shut down?

 

Or should I look for any other problems?




#52171 Evil MAC Address "00 04 A3 00 00 00"

Posted by VanKurt on 15 August 2013 - 06:37 AM in Netduino Plus 2 (and Netduino Plus 1)

Good news everyoneTM :

 

I did the following:

  • Erase the board
  • Flash the 4.3 Firmware
  • Configure the MAC address
  • Download my app

The great news: everything is back to normal! The MAC seems to have been persisted correctly, and DHCP is working again.

I just hope it stays that way ;-)

 

Thanks for your help.




#52167 Evil MAC Address "00 04 A3 00 00 00"

Posted by VanKurt on 14 August 2013 - 08:45 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi Chris,

thanks for your quick reply. Unreproducable problems are the best. I love them, too ;-)

 

To answer your questions:

I could swear I didn't change anything. The app flashed to the Netduino hasn't been changed for a few days. So has my routers configuration.

 

Maybe tomorrow I could completely erase and re-flash the Netduino using your 4.3-Firmare-Flashing-Guide. Do you think this might help?




#52163 Evil MAC Address "00 04 A3 00 00 00"

Posted by VanKurt on 14 August 2013 - 06:26 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi there,

as of today DHCP suddenly stopped working on my Netduino Plus 2. I didn't touch the device in days, so the problem somehow occurred on its own ;-)

 

When I look at my router's web interface, I can see that the Netduino is trying to get an IP with a MAC address of "[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]00 04 A3 00 00 00[/color]". That is not the address on the board's sticker (and I did not configure it either). Of course the DHCP IP address mapping won't work with this wrong MAC address.

While searching the forum's I saw that the above mentioned MAC appears rather often when people are having problems. Where does it come from?

 

I tried two things to solve the problem:

  • Re-set the MAC address via the MF Deploy Tool: The tool tells me that everything was written fine to the Netduino. When I disconnect it, and then reconnect connect it, I can read the previously made changes back without any problems. Although everything looks so good, the Netduino still appears with the wrong MAC ("[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]00 04 A3 00 00 00") when doing its DHCP thing with my router.[/color]
  • [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]Set the MAC in code while starting up: Although this sets the MAC correctly, other settings get messed up. For example the gateway IP is set to 0 (and can't be changed since it's read only). Thus DHC won't work.[/color]
  • [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]Restart the router and the Netduino a million times: no effect at all.[/color]

PS: I'm using a Netduino Plus 2 with 4.3 Firmware and an Arcor EasyBox router. As mentioned above this setup worked fine, until this MAC problem occurred today.

 

Can anyone help?

Thanks!




#52152 Netduino Plus 2 Problems

Posted by VanKurt on 14 August 2013 - 04:03 PM in Netduino Plus 2 (and Netduino Plus 1)

Is there a solution to this? I've just run into the same problem...




#52110 Sending data to php website

Posted by VanKurt on 13 August 2013 - 06:02 AM in Netduino Plus 2 (and Netduino Plus 1)

Allright, got it working  :D

 

I ended up including the System.Http assembly, which makes everything nice and easy. And it adds only 30kB to the final application size.




#52066 Link failure with brand new Netduino Plus 2

Posted by VanKurt on 10 August 2013 - 01:39 PM in Netduino Plus 2 (and Netduino Plus 1)

Yes, you were right. That solved it  ^_^




#52065 Sending data to php website

Posted by VanKurt on 10 August 2013 - 01:38 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi there!

I'm currently trying to send data from the netduino plus to my webserver via a special php site. When I call the site manually from my webbrowser everything works fine. But when doing the same via code from the netduino it does not work.

 

Here's the sending code (inspired by these forums):

private void SendHttpRequest(string serverUrl, string request){  IPHostEntry host = Dns.GetHostEntry(serverUrl);  IPEndPoint endPoint = new IPEndPoint(host.AddressList[0], 80);  using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))  {    socket.Connect(endPoint);    using (NetworkStream ns = new NetworkStream(socket))    {      byte[] bytes = System.Text.Encoding.UTF8.GetBytes("GET " + request + " HTTP/1.1rn");      ns.Write(bytes, 0, bytes.Length);    }  }}

And this is how I call it:

SendHttpRequest("www.mywebsite.com", "/netduino/submitData.php?data=5");

The problem is, that the php script on the website is never called. So I guess there is something wrong with the way I send the HTTP request?

 

Thanks for your help!




#51715 Link failure with brand new Netduino Plus 2

Posted by VanKurt on 26 July 2013 - 06:20 PM in Netduino Plus 2 (and Netduino Plus 1)

Have you upgraded your Netduino to the 4.2 firmware as well?

 

 

I thought the netduino plus 2 came with 4.2? If that's not the case: how would I upgrade the firmware? I can't see any download for that :-(




#51711 Link failure with brand new Netduino Plus 2

Posted by VanKurt on 26 July 2013 - 05:33 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello,

I just installed VC#, the Netduino SDK 4.2.2.0 and the .NETM-Framework 4.2 as described on this site.

When I try to run my project on the Netduino Plus I get the following errors:

 

Create TS.
 
 Loading start at 806a988, end 8085288
 
Assembly: mscorlib (4.2.0.0)
 
Assembly: Microsoft.SPOT.Native (4.2.0.0)
 
Assembly: Microsoft.SPOT.Hardware (4.2.0.0)
 
Assembly: Microsoft.SPOT.Net (4.2.0.0)
 
Assembly: System (4.2.0.0)
 
Assembly: Microsoft.SPOT.Hardware.SerialPort (4.2.0.0)
 
Assembly: Microsoft.SPOT.IO (4.2.0.0)
 
Assembly: System.IO (4.2.0.0)
 
Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1)
 
Assembly: Microsoft.SPOT.Hardware.Usb (4.2.0.0)
 
Assembly: SecretLabs.NETMF.Diagnostics (4.2.0.0)
 
Assembly: SecretLabs.NETMF.Hardware.Netduino (4.2.1.0)
 
Assembly: Microsoft.SPOT.Hardware.OneWire (4.2.0.0)
 
Assembly: Microsoft.SPOT.Time (4.2.0.0)
 
Loading Deployment Assemblies.
 
Attaching deployed file.
 
Assembly: Microsoft.SPOT.Graphics (4.2.0.0)
 
Attaching deployed file.
 
Assembly: Neptune (1.0.0.0)
 
Attaching deployed file.
 
Assembly: SecretLabs.NETMF.Hardware.NetduinoPlus (4.1.0.0)
 
Attaching deployed file.
 
Assembly: SecretLabs.NETMF.Hardware (4.1.0.0)
 
Resolving.
 
Link failure: some assembly references cannot be resolved!!
 
 
Assembly: SecretLabs.NETMF.Hardware.NetduinoPlus (4.1.0.0) needs assembly 'Microsoft.SPOT.Hardware' (4.1.2821.0)
 
Assembly: SecretLabs.NETMF.Hardware.NetduinoPlus (4.1.0.0) needs assembly 'mscorlib' (4.1.2821.0)
 
Assembly: SecretLabs.NETMF.Hardware (4.1.0.0) needs assembly 'mscorlib' (4.1.2821.0)
 
Assembly: SecretLabs.NETMF.Hardware (4.1.0.0) needs assembly 'Microsoft.SPOT.Hardware' (4.1.2821.0)
 
Error: a3000000

 

 

I've checked the target Framework version in the project settings. 4.2 should be right, right?

What elso could it be? What diud I do wrong?




#35915 UPD Problems

Posted by VanKurt on 24 September 2012 - 08:35 PM in Netduino Plus 2 (and Netduino Plus 1)

As my first Netduiono project I decided to exchange some data with my PC via ethernet (UDP).
I already got the Netdiuno sending some random data. On the PC I'm running wireshark to see the packets.

Here's my sending code on the Netduino:
            var serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            serverSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            serverSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
            var remoteEndPoint = new IPEndPoint(IPAddress.Any, 50505);
            serverSocket.Bind(remoteEndPoint);

            var data = new byte[]{1,2,3};
            while (true)
            {
                serverSocket.Send(data);
                Thread.Sleep(1000);
            }

The only problem is: my desktop application does NOT receive those packets (while wireshark on the same machine does!).
Here's the receiving code on PC side:

        private void Form1_Load(object sender, EventArgs e)
        {
            var broadcastAddress = new IPEndPoint(IPAddress.Any, 50505);
            this.udp = new UdpClient();
            this.udp.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            this.udp.ExclusiveAddressUse = false; // only if you want to send/receive on same machine.
            this.udp.Client.Bind(broadcastAddress);
            this.udp.BeginReceive(new AsyncCallback(this.ReceiveCallback), null);
        }

        void ReceiveCallback(IAsyncResult result)
        {
            ...
        }

I checked the following things:
- Netduino is up, running and sending (packets arrive in wireshark on my PC)
- Netduino and PC are on the same subnet (255.255.255.0)
- Netduino and PC both use UDP on port 50505
- Desktop app is running and UDPClient has been successfully started

But my ReceiveCallback is never called...
Is there someone here who has successfully done this? Any advice? Thanks!



#35914 Digital Pin distance - Hardware bug?

Posted by VanKurt on 24 September 2012 - 08:27 PM in Netduino Plus 2 (and Netduino Plus 1)

Wow, great service ;) . Thank's so much!



#35910 Digital Pin distance - Hardware bug?

Posted by VanKurt on 24 September 2012 - 05:43 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi VanKurt and welcome to the forums!

This is not really a bug, but it can be annoying. I recommend to use these pin headers to solve the issue:
http://www.sparkfun.com/products/9374

The odd spacing is done so it'll be pin-compatible with Arduino-boards and shields.


Thanks for the reply!
Seems to be diffucult to get here in Germany... hopefully I'll find something.



#35903 Digital Pin distance - Hardware bug?

Posted by VanKurt on 24 September 2012 - 05:14 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi there!
I just started to create a little Netduino "Shield". I use a standard board (don't know the English term right now):

Posted Image

The holes have a 2.54 spacing. Sadly this wont fit on the digital pins row!
The analog pins are OK because the space between the two connectors has exactly 1 pin width.

Am I missing something?
Thanks!




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.