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.

pascal06's Content

There have been 95 items by pascal06 (Search limited from 29-March 23)


By content type

See this member's


Sort by                Order  

#13090 RVDS Online Compiler

Posted by pascal06 on 10 May 2011 - 02:29 PM in General Discussion

I looked at the mbed before I chose the Netduino, but why would you want to program online when you can download visual studio express for free?

While I can see the benefit for mac users (I'm one), losing the ease and ability of visual studio, especially the debugging to use an online tool would defeat the purpose of programming for the Netduino. I use parallels and win7 under OSX, works great (though I'd love the netduino to talk to processing running on OSX of course ;) )

Gary

Hello Gary,

I don't speak about managed code (C#, VS is perfect), but for native code ( C ),
For native code you have choice between GNU, RVDS, or others expensive compiler,
This is to rebuild NETMF firmware,
GNU produced firmware is to big to fit flash memory, especialy for Netduino Plus,
And RVDS cost multiple thousands of dollars !!!
So, a online compiler like mbed could be a great alternative for netduino user,

Pascal



#13061 RVDS Online Compiler

Posted by pascal06 on 10 May 2011 - 11:14 AM in General Discussion

Hello,

I discover that mbed provide a online compiler compliant to RVDS 4.1 for users:
http://mbed.org/handbook/mbed-Compiler

What about this facility for Netduino users who wants to compile NETMF kit ?

rgds,



#4956 DHCP - getting different IP address each time I restart

Posted by pascal06 on 15 November 2010 - 07:22 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello, After some research, for me, your issue is more related to transactionID than ClientHardwareAddress. But it can be related to both in this case. ClientHardwareAddress is present in DISCOVER request. Usualy, a DHCP server remember each request by using the transactionID. But, it's seems that lwip change this option and use a different transactionID for DISCOVER and REQUEST. So, normaly, the DHCP server already have the ClientHardwareAddress because of DISCOVER request. But in this case, it can't because the transactionID was changed. For the server point of view, it's a new request. So, I think that it works with Microsoft DHCP server, because it use MAC Address at MAC level if the ClientHardwareAddress is not available. After some look at dhcp.c source, I also see that transactionID is change only after a multiple tries. So, I need to debug more to understand why multiple tries occurs in a normal situation. When I receive my JTAG interface, I will modify lwip to not change the transactionID between DISCOVER and REQUEST (if I found a way to do it). And I will send you a firmware to test. Pascal



#4902 DHCP - getting different IP address each time I restart

Posted by pascal06 on 14 November 2010 - 12:51 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello,

I have tested the last version with this code :

NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
networkInterfaces[0].EnableDhcp();
networkInterfaces[0].RenewDhcpLease();

Netduino is already configured to use DHCP, the first request works fine. But, the renew doesn't works.
I'll wait for debugging capability to do more testing,

Also, I made some tests to evaluate the posibility to implement a little TCP/IP stack completly in managed code. It would be a good way to learn more by a easier way. The only bad effect would be the performance. Regarding FLASH/RAM use, it probably near the native code size. First implementation will be for the enc28j60 chip.

I'll let you know about it ...

Pascal



#4615 DHCP - getting different IP address each time I restart

Posted by pascal06 on 07 November 2010 - 11:00 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi Pascal,

yepp, seems that it is working with Microsoft DHCP server. I tried it with the AVM box as well as another Linux box and had no luck. Not sure who could give a try to add this option, should not be a big deal.

Can you do another test? What if you try to renew the lease in your application? Think of a module that you will plug to different networks while it is running. Is this working? I have configured the IP to 0.0.0.0, then I get an IP address from my DHCP... then I disconnect from network... connect again and renew the lease and get 0.0.0.0. :-(

Michael


Hi Micheal,

Unfortunatly, I'm traveling this week. Without possibility to test. I will try next week-end if anybody have done it before.

Pascal



#4577 DHCP - getting different IP address each time I restart

Posted by pascal06 on 07 November 2010 - 11:08 AM in Netduino Plus 2 (and Netduino Plus 1)

Seems that the clientID = 1 is missing in the REQUEST (step 3). I have monitored other DHCP requests and all are sending clientID = 1 which means that the DHCP server should take care of the MAC address (as far as I understand the DHCP protocol).

Michael


Hi Michael,

You probably right concerning clientID, but it works fine with my Windows Server 2008 R2 DHCP server. And I use a reservation to fix my NetduinoPlus address.

Another strange behavior is that DHCP request take the configured static IP address to forge the IP packet. In case of this ip address use another subnet, it could be a issue. So, I have define 0.0.0.0 for static IP, subnet and gw.

If we definitly conclude that ClientID must be set, it probably not a big deal to fix it.

Pascal



#4395 Netbios

Posted by pascal06 on 31 October 2010 - 12:13 PM in Netduino Plus 2 (and Netduino Plus 1)

oops, with attachment, it's better :rolleyes:

Attached Files




#4394 Netbios

Posted by pascal06 on 31 October 2010 - 12:11 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello, For those who want to try Netbios at firmware level and have the possibility to build it with RVDS, here is a beta sample. This sample use a hardcoded name "NETDUINO". I hope that I didn't forgot any other modified files ... Let me know ... Pascal



#4265 What is the Netduino Mini?

Posted by pascal06 on 26 October 2010 - 10:11 PM in Netduino Mini

What about a mesh of Netduino Mini paired with Atmel ATMEGA128RFA1s? And maybe 6lopan? :)

Chris


I see a lot of discussion arround IOT about one MCU versus two MCU on a single node. Like Ethernet Shield, we can use one MCU as the main brain, and the other for networking communication.
On a wireless node, we are very concern by the low power consumption. And some people can be say, why use a ARM MCU in this case and don't use the AVR for sensor communication also (probably enough in most of case) ? By using two MCU, you need to update two firmwares also.

But it can be a easier first step :)

Though ?

Pascal



#4261 What is the Netduino Mini?

Posted by pascal06 on 26 October 2010 - 09:52 PM in Netduino Mini

My dream could be a mesh of Netduino Mini associated to ATMEL AT86RF231, all accessible over Internet by a NetduinoPlus/AT86RF231 as a bridge :) It should be a real Internet of Things revolution ... Pascal



#4256 Netbios

Posted by pascal06 on 26 October 2010 - 08:21 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi everyone, I'm able to run netbios name resolution at firmware level (integrated to lwip) with a hardcoded name (the first step). Now, I need to modify managed code and interop to include EnableNetbios(<name>) capability. If any member have a experience to help me to go in the right direction ... Pascal



#4142 Serious problem on my Netduino board

Posted by pascal06 on 23 October 2010 - 01:51 PM in General Discussion

I had a problem with start debugging in Visual Studio 2010....Vs didn't connect to the board.
I have tried to upgrade firmware on Netduino but the MFDeploy blocking on "Connecting to TinyCLR...".
So I have disconnected my Netduino board....
Now when I insert Netduino in USB port I get the following message on my status bar :

USB device not recognized

I have uninstalled and installed the Netduino SDk but it doesn' work !
I can't connected to the board with MFDeploy !

Help !!!
Paolo.


Don't worry :)

You probably need to reflash the firmware. Here the step-by-Step procedure to do it http://forums.netdui...e-does-not-fix/

Pascal



#4122 Netbios

Posted by pascal06 on 22 October 2010 - 09:30 PM in Netduino Plus 2 (and Netduino Plus 1)

[Raises hand. Waves hand. Waves hand again.]


Thanks Chris,

My first proof of concept seems to be near now,

But the name is hardcoded, not a good idea, especialy for the majority of members who have multiple NetduinoPlus (or Netduino + Shield :rolleyes: ) on the same network ;)

I need to provide a way to specify the name of your device. What about this :

   NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
   networkInterfaces[0].EnableNetBios("NETDUINO");

By this way, you can enable Netbios (disable by default) and you can specify a name.

Comments are welcome,
Pascal



#4103 Netbios

Posted by pascal06 on 22 October 2010 - 03:20 PM in Netduino Plus 2 (and Netduino Plus 1)

Anyone interested to have NETBIOS integrated directly on firmware ? It's not too difficult to modify lwip for that, so, let me know, /pascal



#4097 What is the Netduino Mini?

Posted by pascal06 on 22 October 2010 - 09:32 AM in Netduino Mini

Excellent, I really like the form factor. Pascal



#4073 Camera Shutter Release Timer

Posted by pascal06 on 21 October 2010 - 09:20 PM in Project Showcase

Excellent, thanks for sharing, Here is a idea for a futur version: http://www.glacialwa...robotics/?p=325 ;) /pascal



#4072 Netduino hosted web server over WiFi

Posted by pascal06 on 21 October 2010 - 09:02 PM in Netduino 2 (and Netduino 1)

I'm trying to cobble together the parts & code needed to have the netduino act as a web server over WiFi. My end goal is to allow my robot to be controlled / receive commands from Windows Phone 7 device (which can only make http requests; no sockets here). Just as a note I have the original netduino, not the plus model. I was planning to use an XBee shield for WiFi as it appears to have been used successfully by others in this forum. The final missing piece of the puzzle will be to have the netduino listen for http requests and produce some kind of output (and, optionally, return some response data to the device making the requests). I found some code to host a web server from a previous post here http://forums.netdui...ch__1#entry3685 :


WebServer webServer = new WebServer();    
			while (true)    
			{        
				int requestLength = webServer.WaitForRequest(new RequestReceivedDelegate(RequestReceived));        
				
				if (requestLength > 0)        
				{            //-- Build response --            
					responseStr = "HTTP/1.1 200 OK\nContent-Type: text/html\n\n";            
					responseStr += ProcessRequest(receivedStr);                        
					// IMPORTANT: SendResponse() sends response AND closes the connection, please call only once per request.            
					webServer.SendResponse(responseStr);             
					receivedStr = "";        
				}        
				Thread.Sleep(100);    
			}}


Here I'm assuming / hoping the WebServer class is either part of the .NET Micro Framework or part of the example code from the previous post (I guess I should read that code ;). My question is would this work on the original netduino or do I need to upgrade to the plus - and does the overall solution for communicating wirelessly with WP7 sound like the right direction to go? Thanks!!


Hello James,

To use a netduino with wireless, you don't need the plus version. But you need a wireless shield. Xbee module doesn't use the same wireless techonlogies than your PC or Mobile. PC and Mobile use a wireless named Wi-Fi, which use 802.11() wireless technology. With this technology, it's possible to use a IPv4 stack over it, and use HTTP protocol. XBee modules use a different wireless technology, 802.15.4. This technology is perfect is case of low power needs. But, the frame size is 128 bytes only, so it's impossible to use IPv4 over it. Some IPv6 stack exists using 6lowPAN.

In conclusion :

- Use XBee on Netduino and another XBee on your PC. And forget Mobile use. This is a point to point communication. Like serial over the air.
- Or use a true Wi-Fi 802.11 shield, but you probably need to write a driver for it

Pascal



#3906 Netbios

Posted by pascal06 on 14 October 2010 - 07:53 PM in Netduino Plus 2 (and Netduino Plus 1)

Yes I use ENC28J60 on Tahoe II board. I will search about differences ...

Pascal


But, if you are able to use a JTAG to debug, may you make a little test, just to ensure that all timer works ?

In tcpip.c, arp_timer() should be fire every 5 seconds ...

Pascal



#3904 Netbios

Posted by pascal06 on 14 October 2010 - 07:51 PM in Netduino Plus 2 (and Netduino Plus 1)

Great find, Pascal. Very interesting.

You're using the ENC28J60 on the Tahoe II board--right? I wonder if it's a difference between the lwIP drivers for the integrated AT91 EMAC and the lwIP drivers for the ENC28J60. Based on historical .NET MF use, the ENC28J60 drivers are probably well tested.

Chris


Yes I use ENC28J60 on Tahoe II board. I will search about differences ...

Pascal



#3902 Netbios

Posted by pascal06 on 14 October 2010 - 07:09 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello, Now, I'm able to compile version 4.1 with lwip in debug mode on my TAHOEII. I can see all debug messages on UART2 of my TAHOEII. It's usefull to compare behavior. And I see that lwip send a ARP 10 times before raising a exception in case of no response. But it is not the case with Netduino. My feeling is that related to timer. Pascal



#3780 Features of NetDuino

Posted by pascal06 on 11 October 2010 - 08:25 PM in General Discussion

Perhaps you're already on this road, but when the getting started guide comes out, if it could be in a wiki or some other community-editable format, that would be great. If you need a suggestion for wiki software, I like the Screwturn wiki, it's very simple, open source, and .net based.

Full disclosure: I'm listed as a contributor to the Screwturn project, but my contributions were more by accident than intentional...


+1 for a Netduino Wiki
+1 for Screwturn, very efficient

Pascal



#3724 Netbios

Posted by pascal06 on 09 October 2010 - 06:01 PM in Netduino Plus 2 (and Netduino Plus 1)

Okay, cool. Thanks for your help and contributions on this!

Chris


In lwip, we have multiple timers, to timeout when a event not occurs in certain time, or others proposes.

Timer logic is on sys.c, and inititialisation of all timers is on tcpip.c. But it seems that this timer doesn't work. I have put some message and no timer event occurs, never !!!

I cannot debug, because the firmware cannot be compiled with debug flavor (to big).

Do you have a way in your side to check if these timers works ?

As a example, arp_timer in tcpip.c should be fire every 5 seconds, and it's not the case.

Pascal



#3722 Netbios

Posted by pascal06 on 09 October 2010 - 05:11 PM in Netduino Plus 2 (and Netduino Plus 1)

Hmm, very interesting. Are you using RVDS to compile your code? Would you like us to compile in a set of changes that you can test?


I use RVDS 4.1 Pro Evaluation, expire in 26 days. I have some time to fix it :)

Pascal



#3716 Netbios

Posted by pascal06 on 09 October 2010 - 03:26 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello,

Regarding ARP request issue, I found this (funny) etharp.c :

/**
 * Clears expired entries in the ARP table.
 *
 * This function should be called every ETHARP_TMR_INTERVAL microseconds (5 seconds),
 * in order to expire entries in the ARP table.
 */
void
etharp_tmr(void)
{
  u8_t i;

  LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer\n"));
  /* remove expired entries from the ARP table */
  for (i = 0; i < ARP_TABLE_SIZE; ++i) {
    arp_table[i].ctime++;
    if (((arp_table[i].state == ETHARP_STATE_STABLE) &&
         (arp_table[i].ctime >= ARP_MAXAGE)) ||
        ((arp_table[i].state == ETHARP_STATE_PENDING)  &&
         (arp_table[i].ctime >= ARP_MAXPENDING))) {
         /* pending or stable entry has become old! */
      LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer: expired %s entry %"U16_F".\n",
           arp_table[i].state == ETHARP_STATE_STABLE ? "stable" : "pending", (u16_t)i));
      /* clean up entries that have just been expired */
      /* remove from SNMP ARP index tree */
      snmp_delete_arpidx_tree(arp_table[i].netif, &arp_table[i].ipaddr);
#if ARP_QUEUEING
      /* and empty packet queue */
      if (arp_table[i].q != NULL) {
        /* remove all queued packets */
        LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer: freeing entry %"U16_F", packet queue %p.\n", (u16_t)i, (void *)(arp_table[i].q)));
        free_etharp_q(arp_table[i].q);
        arp_table[i].q = NULL;
      }
#endif
      /* recycle entry for re-use */      
      arp_table[i].state = ETHARP_STATE_EMPTY;
    }
#if ARP_QUEUEING
    /* still pending entry? (not expired) */
    if (arp_table[i].state == ETHARP_STATE_PENDING) {
        /* resend an ARP query here? */
    }
#endif
  }
}

It seems that lwip need to be improved ... Strange,

For me, yes we need to resend ARP and after a (configurable) number of time, we need to generate a exception,

I will try to populate this part of code ...

Pascal



#3708 Netbios

Posted by pascal06 on 09 October 2010 - 12:33 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello,

It seems that we have a issue on both AT91 EMAC & ENC28J60 driver.

Usualy, we need to enable some flags to define interface capability.

And that's not the case on both driver, here my proposal modification for Netduino :

err_t AT91_EMAC_ethhw_init(struct netif *myNetIf) 
{ 
    myNetIf->mtu = AT91_EMAC_MAX_FRAME_SIZE;

    /* ethhw_init() is user-defined */
    /* use ip_input instead of ethernet_input for non-ethernet hardware */
    /* (this function is assigned to netif.input and should be called by the hardware driver) */

    /* Assign the xmit routine to the stack's netif and call the driver's Open */

    myNetIf->output = etharp_output;
    myNetIf->linkoutput = AT91_EMAC_LWIP_xmit;
    myNetIf->status_callback = AT91_EMAC__status_callback;
    
    // [DP CHANGE]
    myNetIf->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;

    AT91_EMAC_LWIP_open( myNetIf );

    return 0; 
}

And with this modification, I see another good side effect, now my Netduino send a gratuitus ARP when it start. Which is a usualy behavior.

So, we also need to modify my Netbios program to enable Broadcast receive at socket level (which is not necessary with RTIP). Here the final code for Netbios :

using System;
using System.Threading;
using Microsoft.SPOT;
using System.Net.Sockets;
using System.Net;
using Microsoft.SPOT.Net.NetworkInformation;

namespace Netbios
{
    public class Program
    {
        private const int UDP_PORT_NETBIOS_NS = 137;

        public static Byte[] EncodeNetbiosName(string Name)
        {
            byte[] result = new byte[32];
            char c;
            for (int i = 0; i < 15; i++)
            {
                c = i < Name.Length ? Name[i] : ' ';
                result[i * 2] = (byte)(((byte)(c) >> 4) + 65);
                result[(i * 2) + 1] = (byte)(((byte)(c) & 0x0f) + 65);
            }
            result[30] = 0x41;
            result[31] = 0x41;
            return result;
        }

        public static string DecodeNetbiosName(byte[] NbName)
        {
            string result = "";
            for (int i = 0; i < 15; i++)
            {
                byte b1 = NbName[i * 2];
                byte b2 = NbName[(i * 2) + 1];
                char c = (char)(((b1 - 65) << 4) | (b2 - 65));
                result += c;
            }
            return result;
        }

        public static bool BytesEqual(byte[] Array1, int Start1, byte[] Array2, int Start2, int Count)
        {
            bool result = true;
            for (int i = 0; i < Count - 1; i++)
            {
                if (Array1[i + Start1] != Array2[i + Start2])
                {
                    result = false;
                    break;
                }
            }
            return result;
        }

        public static void Main()
        {
            Thread.Sleep(10000);
            byte[] myNbName = EncodeNetbiosName("NETDUINO");

            NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();

            using (Socket serverSocket = new Socket(AddressFamily.InterNetwork,
                                                    SocketType.Dgram,
                                                    ProtocolType.Udp))
            {
                serverSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true); // Enable broadcast
                EndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, UDP_PORT_NETBIOS_NS);
                byte[] IP = IPAddress.Parse(networkInterfaces[0].IPAddress).GetAddressBytes();
                serverSocket.Bind(remoteEndPoint);
                while (true)
                {
                    if (serverSocket.Poll(1000, //timeout in micro seconds 
                                               SelectMode.SelectRead))
                    {
                        byte[] inBuffer = new byte[serverSocket.Available];
                        int count = serverSocket.ReceiveFrom(inBuffer, ref remoteEndPoint);
                        if ((inBuffer[2] >> 3) == 0) // opcode == 0 
                        {
                            byte[] nbName = new byte[32];
                            Array.Copy(inBuffer, 13, nbName, 0, 32);
                            Debug.Print("NETBIOS NAME QUERY: " + DecodeNetbiosName(nbName));
                            if (BytesEqual(inBuffer, 13, myNbName, 0, 32))
                            {
                                byte[] outBuffer = new byte[62];
                                outBuffer[0] = inBuffer[0]; // trnid 
                                outBuffer[1] = inBuffer[1]; // trnid 
                                outBuffer[2] = 0x85;

                                outBuffer[3] = 0x00;
                                outBuffer[4] = 0x00;
                                outBuffer[5] = 0x00;
                                outBuffer[6] = 0x00;

                                outBuffer[7] = 0x01;

                                outBuffer[8] = 0x00;
                                outBuffer[9] = 0x00;
                                outBuffer[10] = 0x00;
                                outBuffer[11] = 0x00;

                                outBuffer[12] = 0x20;
                                for (int i = 0; i < 32; i++)
                                {
                                    outBuffer[i + 13] = myNbName[i];
                                }

                                outBuffer[45] = 0x00;

                                outBuffer[46] = 0x00; outBuffer[47] = 0x20; // RR_TYPE: NB 
                                outBuffer[48] = 0x00; outBuffer[49] = 0x01; // RR_CLASS: IN 

                                outBuffer[50] = 0x00; // TTL 
                                outBuffer[51] = 0x0f;
                                outBuffer[52] = 0x0f;
                                outBuffer[53] = 0x0f;

                                outBuffer[54] = 0x00; outBuffer[55] = 0x06; // RDLENGTH 

                                outBuffer[56] = 0x60; outBuffer[57] = 0x00; // NB_FLAGS 

                                outBuffer[58] = IP[0];
                                outBuffer[59] = IP[1];
                                outBuffer[60] = IP[2];
                                outBuffer[61] = IP[3];

                                serverSocket.SendTo(outBuffer, remoteEndPoint);
                            }
                        }

                    }
                    Thread.Sleep(100);
                }
            }
        }

    }
}

Now, I will test if this modification have any effect regarding unknow IP commuication. When you try to communcate to a IP which is not respond to a ARP request.

Pascal




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.