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


By content type

See this member's


Sort by                Order  

#2606 Netduino Serial Port Code Review

Posted by pascal06 on 22 September 2010 - 01:22 PM in Project Showcase

Excellent video, Thanks for sharing, When I work with serial port and programming, I use this powerful free tools: http://www.der-hammer.info/terminal/ Pascal



#2759 uIP Introduction

Posted by pascal06 on 24 September 2010 - 02:17 PM in General Discussion

Hello Netduino Community, Some information about uIP, uIP is a very small open-source TCP/IP stack written by Adam Dunkels from Swedish Institude of Computer Science. Same author as original lwIP. This stack can run also on 8 bits MCU. The official uIP web site: http://www.sics.se/~...x.php/Main_Page This site is dedicated to the first version uIP and it support IPv4. In parallel, Adam Dunkels work on a mini OS named Contiki: http://www.sics.se/contiki/ In this mini-OS, you can see a more up-to-date version of uIP stack for IPv4 and IPv6. This stack is IPv6 ready. Compare to IPv6 support on lwIP which is experimental. It doesn't support Dual Stack, so you need to choice between IPv4 and IPv6. uIP can be used without Contiki. Here is a example of porting IPv6 uIP on Arduino without Contiki using a enc28j60 chip: http://sites.google....ipv6ethershield A little question to Netduino Community : What's your priority regarding porting IPv6 or IPv4 ? Regarding this, one very important information: If you plan to use low-power wireless like 802.15.4, IPv6 can be a good choice because of 6lowPAN. 6lowPAN use header compression to be compatible with 802.15.4. The dream is to be able to communicate with all devices, wire and wireless, simply by using IP. IPv4 over 802.15.4 is impossible due to low MTU size of 802.15.4 frame. Pascal



#2823 uIP Introduction

Posted by pascal06 on 24 September 2010 - 09:11 PM in General Discussion

Hello Szymon, ATMEL provide very nice and sheeper chip for 802.15.4. I personally use AVR-RAVEN DevKit. But 802.15.4 is only for layer 2. 6lowPAN is a IPv6 stack which can work over 802.15.4, because it change header of IPv6 by a compressed version. So, with 6lowPAN, you must use IPv6. What's the relation with uIP ? uIP is the smallest IPv6 stack and it's certified by "IPv6 ready". lwIP is not certified, bigger and only experimental. Now, why we need IP and why is better than other wireless technology. A good start for this reflexion would be IPSO Alliance white papers : http://ipso-alliance.org/ Hope your help, Pascal



#1036 Temperature Sensor?

Posted by pascal06 on 22 August 2010 - 11:25 AM in Netduino 2 (and Netduino 1)

I have published the article on my blog: http://forums.netdui...-blinking-leds/

Now I will look into writing the driver for one-wire DS18B20 sensor.


Hello Szymo,

Congratulation for your article !!

Regarding OneWire, look at this:
http://bansky.net/bl...k/comments.html

Here is my test:
OutputPort port = new OutputPort(Pins.GPIO_PIN_D2, false);

while (true)
{
    port.Write(true);
    port.Write(false);
}

With my oscilloscope I see that the period is 115.28 uS. So it take 115.28 / 2 = 57.64 uS to change Digital Port state. To slow for OneWire communication.

It seems that we need a OneWire implementation in NativeCode, like tinyclr:
http://www.tinyclr.c...de to NETMF.pdf

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



#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



#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



#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



#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



#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



#1493 Firmware build issues

Posted by pascal06 on 29 August 2010 - 11:06 AM in Netduino 2 (and Netduino 1)

Hello,

I also try to rebuild firmware with GCC 4.2, and after multiple issues, I'm finaly near the success (I hope). I just have a issue regarding signature. But it's strange because I thought I do not need to sign firmware.

Here is my error message :

BuildSigFiles:
  Create Signature files for C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\release\Netduino\bin\tinyclr.bin\ER_CONFIG;C:\MicroFrameworkPK_v4_1\Bui
  ldOutput\THUMB\GCC4.2\le\FLASH\release\Netduino\bin\tinyclr.bin\ER_DAT;C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\release\Netduino\bin\tinycl
  r.bin\ER_FLASH
  C:\MicroFrameworkPK_v4_1\BuildOutput\public\Release\Server\dll\MetaDataProcessor.exe -sign_file C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\re
  lease\Netduino\bin\tinyclr.bin\ER_CONFIG C:\MicroFrameworkPK_v4_1\tools\bin\tinybooter_private_key.bin C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\F
  LASH\release\Netduino\bin\tinyclr.hex\ER_CONFIG.sig
  C:\MicroFrameworkPK_v4_1\BuildOutput\public\Release\Server\dll\MetaDataProcessor.exe -sign_file C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\re
  lease\Netduino\bin\tinyclr.bin\ER_DAT C:\MicroFrameworkPK_v4_1\tools\bin\tinybooter_private_key.bin C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLAS
  H\release\Netduino\bin\tinyclr.hex\ER_DAT.sig
MMP : error MMP0000: CLR_E_FAIL [C:\MicroFrameworkPK_v4_1\Solutions\Netduino\TinyCLR\TinyCLR.proj]
C:\MicroFrameworkPK_v4_1\tools\targets\Microsoft.SPOT.System.GCC.targets(391,5): error MSB3073: The command "C:\MicroFrameworkPK_v4_1\BuildOutput\public\Releas
e\Server\dll\MetaDataProcessor.exe -sign_file C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\release\Netduino\bin\tinyclr.bin\ER_DAT C:\MicroFramew
orkPK_v4_1\tools\bin\tinybooter_private_key.bin C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\release\Netduino\bin\tinyclr.hex\ER_DAT.sig" exited
with code 10. [C:\MicroFrameworkPK_v4_1\Solutions\Netduino\TinyCLR\TinyCLR.proj]
Done Building Project "C:\MicroFrameworkPK_v4_1\Solutions\Netduino\TinyCLR\TinyCLR.proj" (Build target(s)) -- FAILED.

Done Building Project "C:\MicroFrameworkPK_v4_1\Solutions\Netduino\dotnetmf.proj" (default targets) -- FAILED.


Build FAILED.
Thanks in advance,
/pascal


Next time, I will read the thread more carefully :unsure: ... The answer was in the thread.
Now I will start to try some native code,
Pascal



#1514 Firmware build issues

Posted by pascal06 on 29 August 2010 - 09:15 PM in Netduino 2 (and Netduino 1)

I had to change scatterfile to match the blockrange - for example, I changed Code_BaseAddress to 0x116000, where the first BLOCKTYPE_CODE started (adjusted to accomodate ~81KB bootloader).


I use an evaluation of RVDS 4.1 Pro (registration required for download link). I don't know how much is it, but the fact you must ask for a quote indicates it is not cheap.


Thanks CW2 !!



#1483 Firmware build issues

Posted by pascal06 on 28 August 2010 - 09:46 PM in Netduino 2 (and Netduino 1)

CMD,

you need to spend some time reading and understanding the porting kit documentation. This will explain your issue. Look up scatterfiles.

The fact is that there is no compelling reason to build the firmware unless you want to make changes to it. If you want to make changes then there is no alternative but to spend a good few hours understanding what the porting kit docs have to say.

This assumes you have a background doing embedded development in assembler and/or C and understand how to lay out memory. The tinyCLR firmware is not place to start learning about embedded development in C.


Hello,

I also try to rebuild firmware with GCC 4.2, and after multiple issues, I'm finaly near the success (I hope). I just have a issue regarding signature. But it's strange because I thought I do not need to sign firmware.

Here is my error message :

BuildSigFiles:
  Create Signature files for C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\release\Netduino\bin\tinyclr.bin\ER_CONFIG;C:\MicroFrameworkPK_v4_1\Bui
  ldOutput\THUMB\GCC4.2\le\FLASH\release\Netduino\bin\tinyclr.bin\ER_DAT;C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\release\Netduino\bin\tinycl
  r.bin\ER_FLASH
  C:\MicroFrameworkPK_v4_1\BuildOutput\public\Release\Server\dll\MetaDataProcessor.exe -sign_file C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\re
  lease\Netduino\bin\tinyclr.bin\ER_CONFIG C:\MicroFrameworkPK_v4_1\tools\bin\tinybooter_private_key.bin C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\F
  LASH\release\Netduino\bin\tinyclr.hex\ER_CONFIG.sig
  C:\MicroFrameworkPK_v4_1\BuildOutput\public\Release\Server\dll\MetaDataProcessor.exe -sign_file C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\re
  lease\Netduino\bin\tinyclr.bin\ER_DAT C:\MicroFrameworkPK_v4_1\tools\bin\tinybooter_private_key.bin C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLAS
  H\release\Netduino\bin\tinyclr.hex\ER_DAT.sig
MMP : error MMP0000: CLR_E_FAIL [C:\MicroFrameworkPK_v4_1\Solutions\Netduino\TinyCLR\TinyCLR.proj]
C:\MicroFrameworkPK_v4_1\tools\targets\Microsoft.SPOT.System.GCC.targets(391,5): error MSB3073: The command "C:\MicroFrameworkPK_v4_1\BuildOutput\public\Releas
e\Server\dll\MetaDataProcessor.exe -sign_file C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\release\Netduino\bin\tinyclr.bin\ER_DAT C:\MicroFramew
orkPK_v4_1\tools\bin\tinybooter_private_key.bin C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\release\Netduino\bin\tinyclr.hex\ER_DAT.sig" exited
with code 10. [C:\MicroFrameworkPK_v4_1\Solutions\Netduino\TinyCLR\TinyCLR.proj]
Done Building Project "C:\MicroFrameworkPK_v4_1\Solutions\Netduino\TinyCLR\TinyCLR.proj" (Build target(s)) -- FAILED.

Done Building Project "C:\MicroFrameworkPK_v4_1\Solutions\Netduino\dotnetmf.proj" (default targets) -- FAILED.


Build FAILED.
Thanks in advance,
/pascal



#1494 Firmware build issues

Posted by pascal06 on 29 August 2010 - 12:31 PM in Netduino 2 (and Netduino 1)

Next time, I will read the thread more carefully :unsure: ... The answer was in the thread.
Now I will start to try some native code,
Pascal


Next step, deploying failed,
Reflash with SAM-BA, first with my own TinyBooterDecompressor compiled with GCC, then failed,
Reflash with official TinyBooterDecompressor, success,

But now, I'm not able to start any native code :(

Here is what I have done :

- Install PK 4.1
- Install Network part
- Install Crypto part
- Install CodeSourcery 4.2 (lite)
- Open cmd
- setenv_gcc_cmd C:\PROGRA~1\CODESO~1\SOURCE~1 (using 8.3 name, long name doesn't work)
- msbuild Solutions\Netduino\dotnetmf.proj /p:flavor=Release
- No enough room on flash
- Open Solutions\Netduino\TinyCLR\Scatter_tinyclr_gcc.xml
- Change Deploy_BaseAddress from 0x00172000 to 0x00175D28 to leave more space (exactly the difference showed by msbuild)
- Compile again
- Error during signature make
- Apply jemery fix
- compile again, then success (with a erase of BuildOutput folder and msbuild with /t:CleanBuild)
- msdeploy, failed
- reflash my arduino

Any help appreciate,
Pascal



#3585 Firmware build issues

Posted by pascal06 on 06 October 2010 - 08:54 PM in Netduino 2 (and Netduino 1)

Curious. We'll do a clean build and play with both RVDS and GCC compilation to see if we can help make it easier...


It seems that environment variables was changed between RVDS 4.0 and RVDS 4.1.

I'm successful with both Netduino & NetduinoPlus with this setenv_RVDS4.1.cmd content :

@echo off

set RVCT40BIN=%ARMCC41BIN%
set RVCT40INC=%ARMCC41INC%
set RVCT40LIB=%ARMCC41LIB%

setenv_base.cmd RVDS4.0 PORT


Without any files move or other files modifications,

Hope can help others,

Pascal



#1507 Firmware build issues

Posted by pascal06 on 29 August 2010 - 07:48 PM in Netduino 2 (and Netduino 1)

The problem is that code generated by GCC does not fit into flash segments, hardcoded as a table in bootloader, which must be changed - I have already written about this in different thread.


Thanks Chris & CW2 for your help,

CW2, may you confirm that I don't need to change scatterfiles in any case (even if I add some new assembly in firmware, but that's not my case at this time) ? Because, when I don't change this file, I always receive an error at compile time (LR_FLASH bla bla bla) ... Even if I change the blockrange value.

Before starting any native code, I need to be able to rebuild successfuly a firmware with GCC. I don't have RVDS.

Is RVDS expensive ? Difficult to find any price !!!

/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



#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



#3519 Netbios

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

Quite possibly. lwIP is a bit of a black box of sorts, but we can look into it.

Please note that the emulator on Windows probably uses RTIP (the commercial stack) or Microsoft's IP stack instead of lwIP--so you may different behavior in the emulator than on an open-source .NET MF device.

Chris


Thanks Chris,

For me, the emulator use the host windows stack because the emulator is 100% written with managed code.

I have tested my program on a TAOHE-II which use RTIP, and it works.

So, my conclusion is the lwIP doesn't catch broadcast packets. I will also take a look on it.

A little question, how to see firmware debug message like LWIP_DEBUGF ....

Pascal



#3498 Netbios

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

Hello,

Netbios name resolution can be a easy way to communicate with a NetduinoPlus. Especialy in case of using DHCP. With this feature, you can use (only on local subnet) the name of your Netduino instead of using IP address. But, it seems that NetduinoPlus doesn't support local broadcast UDP. My sample works on Emulator, but not on NetduinoPlus.

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()
        {
            byte[] myNbName = EncodeNetbiosName("NETDUINO");

            NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();

            using (Socket serverSocket = new Socket(AddressFamily.InterNetwork,
                                                    SocketType.Dgram,
                                                    ProtocolType.Udp))
            {
                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);
                }
            }
        }

    }
}

To test this program, run it on emulator and try to ping NETDUINO with a computer connected on the same subnet.

Is it possible to change the configuration of lwIP to support udp local broadcast ?

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



#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



#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



#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




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.