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.

alanb's Content

There have been 28 items by alanb (Search limited from 19-April 23)


By content type

See this member's


Sort by                Order  

#9715 How do you create software events

Posted by alanb on 17 February 2011 - 09:02 PM in General Discussion

Have a look the changes I did to the RDIF code here: http://forums.netdui..._7220#entry7220 (look after //(** new **))

There I use delegate and event in NETMF.


Thanks for the information, now all working correctly. Thanks also to Dan for the same solution.

Alan



#9694 How do you create software events

Posted by alanb on 17 February 2011 - 06:42 PM in General Discussion

Hi,

So far I have created a display manager class, that internally creates a thread listening on a socket for commands. That all works fine, the main thread generates numbers on a display and sending a message from a client on my pc will display that message on the display.

Now when my displaymanager recieves a command code on the socket I want to pass that command back to the main program. On the pc I would usually use an event. When I looked for EventHandler<> I could only find something called NativeEventHandler. Is that the N+ equivalent of EventHandler?

What is the equivalent of my pc code
public event EventHandler<StringEventArgs> ReceivedCommand;

...

In Some function

if (ReceivedCommand != null)
   ReceivedCommand(this, new StringEventArgs(command));

Or, as is highly probable, am I going about this in the wrong way.

By the way, a lot of this code is by others from the forum so if you recognise your own code, profound thanks. I will reference everyone in the finished article.
Alan

Attached Files




#9638 Fixing wires into a netduino

Posted by alanb on 16 February 2011 - 06:48 PM in General Discussion

Hi, When I got an N+ for christmas, I also asked for a Screwshield see http://wingshieldind...s/screwshield/. This is two little pcbs that plug into either side of my N+ allowing for quick and easy connections. Mine needed soldering together before it can be used but I got my son to do that. Alan



#9542 Help required with Update firmware to 4.1.1

Posted by alanb on 14 February 2011 - 06:20 PM in Netduino Plus 2 (and Netduino Plus 1)

Ok, Now I am really embarrased as I have finally found out what was going wrong. (The attachment says it all). It seems that in the program that ran and gave me errors I had somehow inadvertantly switched the .Net Micro Framework Deployment Transport option to Emulator!!! Or perhaps mistakenly set the original project up as emulator. (In my defence I can only plead weakly that this was one of my first goes and that at the same time I had issues with c# deployment hanging). In retrospect that is obviously why I kept getting the filesystems I did. So profuse apologies to Chris and all at Secret labs and as far as I am concerned this thread is now closed may it quickly fade away.

Attached Thumbnails

  • stupid.jpg



#9538 Netduino Plus Firmware v4.1.1 ALPHA 7

Posted by alanb on 14 February 2011 - 05:22 PM in Netduino Plus 2 (and Netduino Plus 1)

Chris, Upgraded from alpha6 to alpha7 and all ok, booting code does not hang in vs deployment so no need for build3 any longer. :D Alan



#9357 Help required with Update firmware to 4.1.1

Posted by alanb on 12 February 2011 - 01:27 PM in Netduino Plus 2 (and Netduino Plus 1)

Sorry, I got it wrong. There is no problem with reading the SD card. It was pointed out to me that I should change
Directory.SetCurrentDirectory("\\SD");

To
Directory.SetCurrentDirectory(@"\SD");
When I did this it all worked fine.

Which is the embarrassed emoticon, imagine it here



#9323 Help required with Update firmware to 4.1.1

Posted by alanb on 11 February 2011 - 05:06 PM in Netduino Plus 2 (and Netduino Plus 1)

Reflashing back to 4.1.0.5 still gives same result



#9318 Any experience using keypad in your project?

Posted by alanb on 11 February 2011 - 11:01 AM in General Discussion

Not really, I am building a stand alone stepper controller for my rose engine, which will not be connected to my network except to download some tables. I got the N+ to use the SD card!! and network connection for downloading. But control of the machine is via keypad buttons. Alan



#9292 Any experience using keypad in your project?

Posted by alanb on 11 February 2011 - 12:37 AM in General Discussion

Fabien, I hadnt thought of that, still fairly new to this hardware stuff. Can you get serially driven keypads quite cheaply? In any case I thoght that if my first preference keypad worked out ok, I would dedicate a processor to it connected to N+ serially. My output screen is serial. Alan



#9263 Any experience using keypad in your project?

Posted by alanb on 10 February 2011 - 04:11 PM in General Discussion

Thanks Fabian, Unfortunately I need rather more keys that 0-9 # and * , I want to be able to enter decimal numbers so thats 0-9 and . also to move forwards / backwards in increments on a single button press so thats two more keys < and > also to start and stop moving continuously thats two more keys plus keys to select a couple of operating modes such as selecting the increment etc. So I reckon a minimum of 16 buttons are required. I guess I could use two pads but I would rather have the buttons in one pad. Alan



#9229 Any experience using keypad in your project?

Posted by alanb on 09 February 2011 - 04:09 PM in General Discussion

Hi, For my project I need to let the user enter data. So I need to use a keypad. I saw this http://www.sparkfun.com/products/8871 sealed membrane keypad. Or alternatively this http://www.sparkfun.com/products/8653. My preference would be the first one because the arrow keys etc would be useful. I just am interested if anyone has used either keypad and how easy each is to interface to the N+. There is an arduino forum discussion (http://www.arduino.c...um=1209003950/0) on using the second keypad but I can find nothing yet about using the sealed membrane keypad. Alan



#9228 Help required with Update firmware to 4.1.1

Posted by alanb on 09 February 2011 - 03:51 PM in Netduino Plus 2 (and Netduino Plus 1)

I have just uploaded vs express onto another pc (atom)


Ran the code on atom pc and got the same results as my normal pc see attachment earlier.
Alan



#9223 Help required with Update firmware to 4.1.1

Posted by alanb on 09 February 2011 - 02:01 PM in Netduino Plus 2 (and Netduino Plus 1)

Chris, No I dont have any other microsd cards. Regarding drivers where are the pc drivers for the N+ card and are they different to those for the other netduinos? I have just uploaded vs express onto another pc (atom) and need the driver installing. I was thinking that perhaps I may have downloaded the wrong driver onto my pc. Alan



#9215 Help required with Update firmware to 4.1.1

Posted by alanb on 09 February 2011 - 11:01 AM in Netduino Plus 2 (and Netduino Plus 1)

alanb,

It's really weird that you're getting "\ROOT" and "\WINFS" at all. Which firmware build are you using? The special "build #3" that I sent you?

Also, is the card formatted as FAT16 or FAT32?

Chris


Yes I am using the special build you sent. I will reflash the old 4.1.0.5 today and try that. The SD card was formatted on my PC as FAT so I take that to be FAT16. I do know that when mounted on a USB carrier my pc reports the SD disk as healthy.

At present I do not know if it is the firmware or my N+ hardware that is at fault (if it is the hardware I will want to return my N+ to the supplier to be swapped under warranty for a fully working board).

I am under the opinion that perhaps secret labs should think about makeing some short test programs available (not necessarily in c#) that will enable users to establish definitively, if at all possible, whether a problem is hardware or software related. I think this could apply to the SD card, the Network interface etc.

For example is my short bit of code that doesnt report \SD a definitive test for the SD reader/firmware? If not what code would be?

Alan



#9159 Help required with Update firmware to 4.1.1

Posted by alanb on 08 February 2011 - 12:33 PM in Netduino Plus 2 (and Netduino Plus 1)

I cannot get the SD disk working. I am now trying a Transcend 2GB disc formatted with FAT and reported by my pc to be healthy. However the disc is not recognized at all. See code fragment below which includes code copied from another posting.
   while (true)
   {
       Debug.Print("Loop " + i.ToString() + "\n");
       string[] dirs = Directory.GetDirectories(@"\");
       foreach (string s in dirs)
           Debug.Print(s);
               
       i++;
       try
       {
           Directory.SetCurrentDirectory("\\SD");
       }
       catch (Exception)
       {
           Debug.Print("Exception occurred while calling SetCurrentDirectory");
       }
       Debug.Print("Current directory (after): " + Directory.GetCurrentDirectory());

       Thread.Sleep(8000);
   }
See attached file for output. I removed/re-inserted the SD card between iterations of the loop but it seems to make no difference. So can you tell if my SD card reader working or not or is it a software issue?

Attached Files




#8964 SD Card Issues.

Posted by alanb on 04 February 2011 - 12:30 AM in Netduino 2 (and Netduino 1)

alanb,

Do you get \SD? Also, Netduino Plus (and .NET MF's SD_SPI driver) support cards up to 2GB. 4GB _may_ work, but we recommend <=2GB.

If you don't see \SD, then a valid card is not inserted.

Chris

No didnt see /SD so I will get a 2GB card .
Alan



#8945 SD Card Issues.

Posted by alanb on 03 February 2011 - 08:00 PM in Netduino 2 (and Netduino 1)

Sorry, Me being stupid, I had not added System.IO to the references. Ran it and just got \ROOT and \WINFS with the SD card both in and out.



#8943 SD Card Issues.

Posted by alanb on 03 February 2011 - 07:55 PM in Netduino 2 (and Netduino 1)

Sorry for the Newbie question but which assembly contains Directory. I cant seem to find it. Alan



#8933 SD Card Issues.

Posted by alanb on 03 February 2011 - 06:43 PM in Netduino 2 (and Netduino 1)

Hi,
I put a SanDisk 4GB SD card (in hope) into my N+ and then ran
VolumeInfo[] vols = VolumeInfo.GetVolumes();
foreach (VolumeInfo vi in vols)
{
  Debug.Print(vi.RootDirectory.ToString());
  Debug.Print(vi.TotalFreeSpace.ToString());
  Debug.Print(vi.IsFormatted.ToString());
  Debug.Print(vi.VolumeID.ToString());
}

OutputPort SdPower = new OutputPort((Cpu.Pin)25, false); // ensure that the SD card is powered

InputPort sdDetected = new InputPort((Cpu.Pin)57, false, Port.ResistorMode.PullUp);
Debug.Print("sd detected: " + (!sdDetected.Read()).ToString());
sdDetected.Dispose();

And got

\ROOT
0
False
0
\WINFS
20000000
True
1
sd detected: True

But my point here is that I got sd detected: True in both instances i.e. when the card was in and again when ejected!! I expected the result to be False with no card inserted. To check I unplugged the N+ before running the code again but got the same result. Is this to be expected? Is \ROOT the card ?

I bought the card yesterday at the local supermarket, I assumed it was pre formatted!!



#8917 Help required with Update firmware to 4.1.1

Posted by alanb on 02 February 2011 - 11:02 PM in Netduino Plus 2 (and Netduino Plus 1)

Chris, Tried all first with 4.1.0.5 TinyBooter build 3 was the one that worked in that vs debug deployment did not hang up all others did. So flashed 4.1.1 alpha 6 and tried that on build 3 again worked without hanging in vs. Also did not hang when used MFDeploy to clear code. I have attached output from vs and MFDEploy for 4.1.1 alpha 6. Just gone through vs debug , MFDeploy clear cycle half a dozen times without need to unplu/plugin N+. Havent tried any of the others do you want me to try all the other builds with 4.1.1 alpha6? By the way when using MFDEploy used to flash chip it still hangs up after finishing with Application executing message so I have to unplu/plug there but beginning to think that is an MFDeploy bug. You can catch me on Chat now.

Attached Files




#8902 Help required with Update firmware to 4.1.1

Posted by alanb on 02 February 2011 - 08:14 PM in Netduino Plus 2 (and Netduino Plus 1)

Chris, I have received the builds. All contain config and flash. Which version of TintbootDecompressor do you wish me to try them with from 4.1.0.5 or from 4.1.0.6 ? Alan



#8834 Help required with Update firmware to 4.1.1

Posted by alanb on 01 February 2011 - 08:10 PM in Netduino Plus 2 (and Netduino Plus 1)

Chris, Sorry message above is not much help, as when reflashing 4.1.0.5 again I get the hanging initially in MFDeploy as with snapshots of 4.1.0.6 and have to unplug netduino and reattach. (had forgotten that). So I tried 4.1.0.6 RC1 again and unplugged and reattached. But then ran visual studio with small test app. The difference between 5 and 6 is that when running the program in 5 after downloading to the N+ the reboot is successful and the debugger continues and code runs. In version 6 the reboot hangs until the N+ is physically unplugged and re-attached. I have included a screenshot of running in version 5. When running version 6 nothing appears on the vs output window after the word rebooting until as I said the N+ is unplugged and then re-attached but obviously the debugger is not attached and it just exits. The code however is executed on the N+. Alan

Attached Thumbnails

  • reboot.png



#8828 Help required with Update firmware to 4.1.1

Posted by alanb on 01 February 2011 - 07:34 PM in Netduino Plus 2 (and Netduino Plus 1)

Chris, Tried ubdating from 4.1.0.5 but MFDEploy hung waiting for bootloader so reflashed both 4.1.0.6 (and 4.1.0.6 48K just in case ) however both hung see snapshots.

Attached Thumbnails

  • 4.1.0.png
  • 4_1_0_6_48k.png



#8819 Project to run my machine

Posted by alanb on 01 February 2011 - 06:30 PM in General Discussion

Hi, I have built a small Rose engine which is a type of lathe used in ornamental turning (see http://blog dot alanbattersby dot co dot uk/). Currently I run EMC to control the steppers but my aim is to write the necessary code so that my shiny new Netduino plus controls the rose engine. Basically whilst rotating the spindle at the cutting speed (often 1-2 rpm) I need to move the headstock laterally from side to side and also forwards and backwards. So there are three steppers to control but each only moving by small ammounts. The stepper driving the spindle is 200 steps per rev with 2* microstep and is connected to a 16:1 gearbox so claculations give 17.778 steps per degree. I calculate that issuing a step every 1ms will give a top rotation speed of roughly just over 9rpm, this is fine as the normal speed when cutting a pattern is around 1-2 rpm. The steppers driving the headstock movement are again as before but connected to a ball screw of 5mm pitch so one rotation of 400 seteps moves the headstock by 5mm giving 80 steps per mm. Typically cutting a wave pattern of 20mm amplitude and a frequency of 6 giving a maximum lateral offset movement of approx 2.1mm per degree of rotation so max 168 steps per degree or max 9.5 steps laterally for each rotational step. So again at 1ms per step laterally the rotational speed will be just under 1 rpm. So maybe I should generate steps every 500us to cover this and again give a rotational speed of around 2rpm. But not bothered if rotational speed is less than 1 rpm. I can generate the tables giving the number of steps to move so from software I have already written, I want to be able to download these to the N+ store them on the micro sd card then press a button to start the machine. So much for the background, now for the code running on the Netduino I anticipate spawning at least one thread fom main and then using the main thread for communication to-from a simple keyboard and display. I want to use the internal PIT to set an interrupt every 500us say and the ISR should load the necessary values onto output pins to determine the direction and step if any of each motor. The thread is to host a simple trajectory controller that should accelerate the stepping at the start and decellerate whenever the next move has a change in direction. I am not trying to implement the full functionality of a sophisticated piece of software such as EMC. So that is what I want to acheive my questions are 1) Is it possible on the N+ 2) Where can I find references to examples of using ISR and the internal timer etc? I am a retired ex programmer with 20+ years experience at least 8 in c# and then java before that. I appreciate that the N+ is a young product with little documentation but I have to start somewhere. So thanks in advance for any suggestions and pointers to docs code etc. Hopefully I will put links to anything I discover / write on my blog. Alan (PS I noticed whilst writing this my web site had gone down. We are having a little trouble with this over the last few days and I am aware of it so thanks again)



#8814 Help required with Update firmware to 4.1.1

Posted by alanb on 01 February 2011 - 05:16 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi Alan,

Are you running inside a virtual machine? If not, what version of Windows are you using (and is it 32-bit or 64-bit)?

Chris


Chris,
I am running a 32bit version of XP with service pack 3 on an Esprimo with Intel core2 CPU 6300 @ 1.86 GHz showing 2.99 GB of ram although there is 5GB on board. I usually run Ubuntu but installed the only version of XP I own which is the 32 bit version from a previous machine. Not running on a virtual machine.

Alan




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.