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.

Szymon's Content

There have been 108 items by Szymon (Search limited from 28-April 23)


By content type

See this member's


Sort by                Order  

#3101 How to use the SD card and StreamWriter

Posted by Szymon on 28 September 2010 - 07:16 AM in Netduino Plus 2 (and Netduino Plus 1)

P.S.

I am able to reproduce the behavior from your second post. Interesting. It does appear like buffers aren't getting cleaned up properly. We'll dig into the .NET MF SD SPI and System.IO code and see what's going on...

It appears to be the ReadLine() function that's causing the issue, interestingly enough... Take that out, and all is well. Curious.

Chris


Chris,
Thanks for looking into this. If you change to use ReadToEnd() the behavior is the same. So this might be memory leak inside the StreamReader itself.



#3050 uIP Introduction

Posted by Szymon on 27 September 2010 - 07:07 PM in General Discussion

Hi Pascal, Thank you for detailed explanation. I would really love to have all devices communicate over IP. But as a short term goal with Netduino I agree that we should concentrate on the IPv4 stack first. I hope that you will manage to squeze it take less of Netduino ROM than implementation in current Netduino Plus firmware. Please keep us posted on your progress. -Szymon



#3000 Trying to make sense of PWM

Posted by Szymon on 27 September 2010 - 08:12 AM in Netduino 2 (and Netduino 1)

According to this post the PWM is currently set to fixed clock of 10KHz http://forums.netdui...findpost__p__42 Current implementation of PWM.SetDutyCycle uses values in range 0 from 100 to express the duration of high state in the cycle as percentage. So duty cycle 0 is always off and duty cycle of 100 is always on. But if I understand correctly this is with the default 10KHz clock. On the other hand PWM.SetPulse lets you control the period and duration of the waveform directly. So you should use one of the functions - not both at the same time. Chris also mentioned they want to expose more PWM functions in next firmware.



#2997 Trying to make sense of PWM

Posted by Szymon on 27 September 2010 - 07:53 AM in Netduino 2 (and Netduino 1)

Hi Pete,

Did you look at this thread
http://forums.netdui...__fromsearch__1


Actually I think this explains it better http://forums.netdui..._2411#entry2411



#2950 Colin Miller explains the Gadgeteer hardware system

Posted by Szymon on 26 September 2010 - 07:28 PM in General Discussion

It's using GHI's EM module on the back, so i wouldn't be surprised. Is it just me, or did just about everything he tried to show working... not?


Oh, I haven't noticed the GHI EM module on video but indeed this looks similar to FEZ components. Anyway, I think the software side of this might be interesting as well. I hope they will release the code as open source so we can get a good library of drivers for bunch of cool modules.



#2938 Colin Miller explains the Gadgeteer hardware system

Posted by Szymon on 26 September 2010 - 05:35 PM in General Discussion

Take a look here: http://blog.makezine..._gadgeteer.html Gadgeteer is very interesting project for rapid prototyping of embedded devices built by Microsoft Research team in Cambridge. Of course .NET MF is heart of a project. http://research.micr...er/default.aspx Not much information on the project page right now but I hope we can find out more soon. In particular it would be interesting to learn what board they use, and if it can be made compatible with Netduino (maybe via a dedicated component shield).



#2937 Segmented LED Displays

Posted by Szymon on 26 September 2010 - 05:32 PM in General Discussion

Hi Eric, Maybe this example will help you get started: http://geekswithblog...nking_leds.aspx It shows how to use a shift register to talk with two 7 segment LED modules.



#2861 How to use the SD card and StreamWriter

Posted by Szymon on 25 September 2010 - 07:55 AM in Netduino Plus 2 (and Netduino Plus 1)

Chris,
Today I tried to run a very simple example. And following code works fine if I put it at the start of the program:

using (var fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None, 512))
using (var sw = new StreamWriter(fs))
{
    sw.WriteLine("hello from netduino");
    sw.WriteLine("done.");
}

However if I try to iterate all files and display their content I immediately get an OutOfMemoryException. I use the same pattern to dispose FileStream and StreamReader in each iteration but this doesn't help. I only have 5 files with only few bytes of content so I think this is behavior is strange.

string[] files = Directory.GetFiles(@"\SD");
for (int i = 0; i < files.Length; i++)
{
    Debug.Print("filename: " + files[i]);

    using (var fs = new FileStream(files[i], FileMode.Open, FileAccess.Read, FileShare.None, 512))
    using (var sr = new StreamReader(fs))
    {
        Debug.Print("contents: ");
        Debug.Print(sr.ReadLine());
    }
}

Here is the exception:
Failed allocation for 685 blocks, 8220 bytes

Failed allocation for 685 blocks, 8220 bytes

    #### Exception System.OutOfMemoryException - CLR_E_OUT_OF_MEMORY (1) ####
    #### Message: 
    #### System.IO.StreamReader::ReadLine [IP: 000a] ####
    #### FileSystemTest.Program::Main [IP: 012b] ####
A first chance exception of type 'System.OutOfMemoryException' occurred in System.IO.dll
An unhandled exception of type 'System.OutOfMemoryException' occurred in System.IO.dll


Maybe the FileStream buffers dont get released properly ?

Can anyone else try to run this code and see if it works fine on their Netduino Plus?



#2827 How to use the SD card and StreamWriter

Posted by Szymon on 24 September 2010 - 10:05 PM in Netduino Plus 2 (and Netduino Plus 1)

Szymon, does this also happen on a regular Netduino with the v4.1.1 alpha firmware? I know that at least one user reported an issue with the order in which objects were closed/disposed.

Also, what happens if you don't do Append--but do open or create instead?

Chris


Chris,
I tried to close FileStream before StreamWriter and it didn't crash, but nothing was written to the file.
So then I tried to call Flush before closing and this crashes with similar exception.

I also changed FileMode to Open and OpenAndCrate and both don't work too.

But this is part of larger project so maybe there is some other dependency. Tomorrow I will try to test it with simple program.



#2825 How to use the SD card and StreamWriter

Posted by Szymon on 24 September 2010 - 09:45 PM in Netduino Plus 2 (and Netduino Plus 1)

I'm trying to get the SD card working but get an error when closing the StreamWriter.

Here is the code:
var fs = new FileStream(fileName, FileMode.Append, FileAccess.Write, FileShare.None, 512);
var sw = new StreamWriter(fs);
sw.WriteLine("Hello Netduino");
sw.Close();

and this is the error:

    #### Exception System.IO.IOException - CLR_E_FILE_IO (4) ####
    #### Message: 
    #### Microsoft.SPOT.IO.NativeFileStream::Write [IP: 0000] ####
    #### System.IO.FileStream::Write [IP: 002a] ####
    #### System.IO.StreamWriter::Flush [IP: 0021] ####
    #### System.IO.StreamWriter::Dispose [IP: 0016] ####
    #### System.IO.TextWriter::Dispose [IP: 0005] ####
    #### System.IO.StreamWriter::Close [IP: 0004] ####
    #### RoomMonitor.Application::DataLogUpdate [IP: 0090] ####
A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll
    #### Exception System.IO.IOException - 0x00000000 (4) ####
    #### Message: StreamWriter Flush. 
    #### System.IO.StreamWriter::Flush [IP: 002b] ####
    #### System.IO.StreamWriter::Dispose [IP: 0016] ####
    #### System.IO.TextWriter::Dispose [IP: 0005] ####
    #### System.IO.StreamWriter::Close [IP: 0004] ####
    #### RoomMonitor.Application::DataLogUpdate [IP: 0090] ####
A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll




#2790 uIP Introduction

Posted by Szymon on 24 September 2010 - 06:21 PM in General Discussion

Hi, Few months ago there was discussion about 802.15.4 support in .NET MF core and according to the last entry it will be included in the next release after .NET MF 4.1: http://www.netmf.com...62-a93f5d3fc110 Can anyone confirm that .NET MF is in fact working on this? And if so I wonder what will be the relationship to uIP project? Personally I'm very interested in the 6lowPAN standard, but I guess this will require appropriate hardware as well. So if Secret Labs can add member to Netduino family with built in 802.15.4 radio this will be perfect. -Szymon



#2584 LCD Library

Posted by Szymon on 21 September 2010 - 08:21 PM in Project Showcase

Hi, I have finally published the library on CodePlex. You can grab it here http://microliquidcr...l.codeplex.com/ Basically the same code as previously published on my blog, just with few renames. Please let me know if you have any suggestions on what can be improved.



#2426 LCD Library

Posted by Szymon on 18 September 2010 - 04:03 PM in Project Showcase

Hi, The pin assignment looks exactly the same as one that I used. If you look at the diagram on my blog the pins on the LCD are numbered from right to left. Thus as you can see pin 3 is connected to potentiometer to adjust the display contrast. I use output pin 0 on shift register to turn backlight on or off so it should be reserved. Then pins 1,2,3 on shift register are connected to pins 4,5,6 on the display (rs, rw, enable). Finally pins 4 through 7 are connected to pins 11 to 14 on display. Because it uses 4-bit mode display pins 7 to 10 are not connected. I hope this helps. -Szymon



#2121 How to make movie-like video clips?

Posted by Szymon on 11 September 2010 - 06:53 AM in General Discussion

I shoot the video either with Logitech QuickCam 9000 Pro or with Canon 550D camera. For editing I simply used Movie Maker from Windows Live Essentials. Was sufficent to Combine two videos and add title and end pages. Some cool transition animations are in the new beta version. You can download it free here http://explore.live....essentials-beta I upload my videos to vimeo:



#2047 NetDuino upgrade path

Posted by Szymon on 09 September 2010 - 08:39 PM in Netduino 2 (and Netduino 1)

And if you really need a much more powerful device maybe you should take a look at http://beagleboard.org/



#2008 OneWire ALPHA

Posted by Szymon on 09 September 2010 - 09:19 AM in Beta Firmware and Drivers

Does anybody from those who downloaded the firmware and possibly tried it have any feedback? How should I interpret the silence, with regard to initial eager requests? Please let me know whether it works or not with your device, so I can fix possible problems and publish the code. Thanks in advance.


Hi CW2,
I finally got to look at this. I uploaded your firmware and tested with one DS18B20 sensor. I'm happy to report that it works fine with your demo app :-)

Did you managed to implement the search function? I think this is the only important thing missing from the native code. I compare it to arduino version http://www.pjrc.com/...bs_OneWire.html

The Skip and Select methods can be implemented in managed code because it only sends a command with WriteByte. We can also compute the Crc.

I can send you my version of Micro DallasTemperature library if you want to test it.


Edit: Oh, and I would definitively move the managed OneWire class to another assembly (at least until it makes to official firmware). Having two versions of the same assembly totally messed my project references.



#1999 HD44780 LCD display in 4-bit mode using 4 data wires

Posted by Szymon on 09 September 2010 - 06:52 AM in General Discussion

That's a great point. And one of the beauties of open source: we can build off each other's work, and people get credit and kudos for what they've done. It's really a fantastic system in many ways.

Please note that if the source you're building off of is GPL or otherwise share-alike that you'll need to note that in your derivative code. Share-alike code is fantastic, but businesses will often stay away from it due to legal concerns (founded or unfounded).

Chris


I couldn't find what license is covering Arduino libraries. From the Arduino FAQ I understand that the Arduino environment is covered by GPL but this doesn't prevent it's use in comercial products: http://arduino.cc/en/Main/FAQ

The footer on the LiquidCrystal library page says about "Creative Commons Attribution-ShareAlike 3.0 License" but I think this applies to documentation. http://arduino.cc/en...e/LiquidCrystal

I'm not sure how this applies to the code that was ported to different language or platform so if anyone can clarify this I'll be happy to change the licensing or take any other actions as appropriate.

Maybe this is another good reason to publish the project on CodePlex, because it ensures that users accept the license for each download.



#1996 HD44780 LCD display in 4-bit mode using 4 data wires

Posted by Szymon on 09 September 2010 - 06:36 AM in General Discussion

Totally agree Chris - it just came up as a big stink on the Fez boards so I figured I'd post here to try to remind folks that not all code is free (as in beer).


Actually that was the main reason I wrote my own version of LCD library from scratch (and the Wii Nunchuck as well). They are based on open source Arduino libraries and I attributed the creators in source code header or in the coresponding blog post so I hope everything is fine from legal perspective there.



#1995 FEZ Panda

Posted by Szymon on 09 September 2010 - 06:22 AM in General Discussion

I think the point that he was making is that the company who makes that board is holding back their actual NETMF source which enables the board's peripheral features (ADC, PWM, etc.)--so if you want to flash your own NETMF firmware you have to start from the more barebones implementation that Microsoft provides in the porting kit (and you're on your own--they won't let you flash the original closed-source firmware back onto it).


Actually according to this post http://www.tinyclr.com/forum/14/875/ this time they are going to release the firmware source code for this board. If thats true I really like the change of direction.

Whats more Guss Issa writes a new ebook about the porting kit. You can download it here http://www.tinyclr.c...rting NETMF.pdf



#1932 UART 2 hardware flow control

Posted by Szymon on 08 September 2010 - 01:00 PM in Netduino 2 (and Netduino 1)

Have a look at SerialPort.Handshake property.


Thanks CW2, it didn't occured to me that this property would be related. However there is only Handshake.RequestToSend (RTS) value, so should I assume it will enable CTS as well?

@greg
Probably I don't need it right now, but asked out of curiosity since it was mentioned in Netduino tech spec. I'm also reading the documentation for XBee module that mentioned flow control (p.27) thus I wanted to see how this works.
http://ftp1.digi.com.../90000976_F.pdf

Slightly out of topic: does anyone here looked at the ZigBee application profiles? I wonder if it would be hard to implement one in .NET MF. In particular I'm looking at the home automation profile: http://www.zigbee.or...n/Overview.aspx



#1921 UART 2 hardware flow control

Posted by Szymon on 08 September 2010 - 07:11 AM in Netduino 2 (and Netduino 1)

Hi, In the tech specs the digital pins 7-8 are labeled as UART 2 RTS, and CTS. I'm thinking to use it with XBee since the RTS and CTS is nicely available on the header in adafruit's xbee adapter that I'm using. But I'm not sure how to enable the hardware flow control. I looked at the SerialPort class and don't see any options in the constructor or otherwise. Did I missed something here? Thanks, -Szymon



#1886 LCD Library

Posted by Szymon on 07 September 2010 - 06:05 AM in Project Showcase

I'm glad that some of you found my library useful, and posted about your results: http://forums.netdui...-seeeduino-lcd/ I was thinking to put it on CodePlex so that we can keep a better track of all code changes and extensions. What do you think? Should I keep the name MicroLiquidCrystal for the project?



#1783 LCD Library

Posted by Szymon on 05 September 2010 - 07:46 PM in Project Showcase

Or just cheat and get a SerLCD from Sparkfun. ;-)


Meh, that would be no fun. Besides I didn't wanted to wait for the order ;-)



#1780 LCD Library

Posted by Szymon on 05 September 2010 - 06:20 PM in Project Showcase

Hi, In my third blog post I'm demonstrating how to connect an alpahnumeric 16x2 LCD display to the Netudino. I created a library based on Arduino LiquidCrystal lib and earlier work done by Pavel Bansky. The LCD can be connected both directly (in 4-bit and 8-bit modes) or via a 74HC595 shift register. Here is the blog post: http://geekswithblog...id_crystal.aspx The source code is here: http://cid-4c7ec0c21...l^_20100905.zip



#1762 Allegro A6281 Library

Posted by Szymon on 04 September 2010 - 07:17 PM in Project Showcase

Give my new library a try.

Use it to control Allegro A6281 based RGB LED boards (Brilldea PolkaDOT and various from Macetech.)
I have a daisy chain of 8 running off my Netduino (only USB power so far.)
It is a little light on documentation, but the sample application should get you going.

Let me know what you think.

uA6281 on Codeplex.com


Hi SupraBitKid,
You beat me to it! I have my lib for already working with ShiftBrites and was ready to publish it soon :-)
Now I guess I will look at yours to see if I can contribute anything.

Great work. Thanks for posting!




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.