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.
Photo

Netduino 1 Firmware v4.1.1 BETA 1


  • Please log in to reply
42 replies to this topic

#1 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 March 2011 - 08:00 AM

Version: 4.1.1 BETA 1 (version 4.1.1.0 b1)

A BIG THANK YOU to the following community members:

    [*]KodeDaemon (David Stetz) who contributed SD card enhancements to support 4GB SDHC cards (8GB+ cards may work...but not tested).
    [*]CW2 who contributed his I2C "repeated start bit" enhancements.
    [/list]WARNING: This firmware is pre-release firmware. It may temporarily cause your Netduino to cease functioning properly. If this firmware does not work for you, you will likely need to erase your Netduino completely and re-flash the production v4.1.0.6 bootloader using Atmel SAM-BA tools (on a 32-bit Windows installation) and the production v4.1.0.6 firmware using MFDeploy.

    With that warning out of the way, we've added the first two new features to the Netduino: SD/FAT16/FAT32 support and variable bit SPI. We have also added support for "repeated start bit" I2C and some debugger enhancements.

    If you're an early adopter and would like to help us test and refine these new features, this beta release may be for you.

    This firmware includes the following updates:
    1. Early support for some 4GB+ MicroSD cards (courtesy of community member KodeDaemon)
    2. Early UsbClient support (requires deploy/debug via serial)
    3. Support for any SD "chip select" pin and "card detect" pin
    4. Card detect feature enables RemovableMedia.Insert and RemovableMedia.Eject events.
    5. Pushbutton (SW1) now returns true when pushed, false when not pushed

    This firmware also includes the following previous updates:
    1. I2C internal address ("repeated start bit") support
    2. Bugfixes: SerialPort.DataReceived event should now fire properly
    3. Bugfixes: SerialPort.Read() timeout now implemented properly
    4. Bugfix: SD card support no longer interferes with digital pin 2
    5. Variable-bit SPI (9 to 15 bit) capabilities (courtesy of community member CW2)
    6. Enhanced Parallels, VMWare, and VirtualBox compatibility
    7. RS232 and TTL UART deployment now selectable via software tool
    8. Exception thrown when mounting incompatible/non-existent SD card
    9. Reduced memory usage for SD card access
    10. Faster mounting and communication with SD cards
    11. Garbage collection 'status messages' updated
    12. SD card support using SPI
    13. Visual Studio debugger should connect to Netduino easier during deployment (on non-virtual machines)
    14. SPI bugfixes

    You may update to this pre-release firmware using the MFDeploy tool:
    1. Download and unzip the attached file to a directory on your computer.
    2. Go to the Start Menu > Programs > Microsoft .NET Micro Framework 4.1 > Tools
    3. Run MFDeploy.exe. Be careful to run MFDeploy.exe and not MFDeploy.exe.config (as file extensions are hidden by default)
    4. Plug your Netduino into your PC using a Micro USB cable. If your Netduino does not connect successfully, try plugging the USB cable into your Netduino first...and then your PC.
    5. In the Device section at top, select USB instead of Serial. Your Netduino should appear in the drop-down; if not, select it.
    6. Click "Browse..." and select the unzipped files from step #1 (ER_CONFIG and ER_FLASH).
    7. Press "Deploy". It will take a few minutes to update your Netduino.

    Chris

    Attached Files



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 March 2011 - 08:05 AM

Notes on new SD card support
This firmware includes support for SD cards and System.IO filesystem support.

It includes two functions in the new SecretLabs.NETMF.IO namespace:
StorageDevice.MountSD(...);
StorageDevice.Unmount(...);

Both the MountSD(...) and Unmount(...) features are fully implemented.

You will need to manually add the SecretLabs.NETMF.IO assembly as a reference in your project to use the SD feature. You will also need to add the System.IO assembly.

Notes on SDHC (4GB+ SD card) support
Community member KodeDaemon has graciously contributed enhancements to the SD implementation to support some MicroSDHC cards (4GB+). This feature is new and has not been extensively tested. Please post here with the make and model of your SDHC card if it works (or if it doesn't work). Please make sure it is formatted as FAT32.

Notes on new "variable bit SPI" feature:
We've created an "ExtendedSpiConfiguration" class. To use it:
1. Add the attached ExtendedSpiConfiguration.cs class to your project.
2. Instead of creating a SPI.Configuration instance, use ExtendedSpiConfiguration. It is a subclass of SPI.Configuration and can be used in its place.
3. In the ExtendedSpiConfiguration constructor, you can provide the number of bits per transfer (data bits) as the final paramter.

Notes on new "I2C internal address/repeated start bit" feature:
To use the enhanced I2C capabilities, we've posted a set of easy-to-use functions in another thread.

Please note that we will be including the final version of these new classes in the Netduino v4.1.1 SDK--so you will not need to add them manually. Also, we may change the names of classes, methods, etc.

If you use these new features, please post your experiences here...

Attached Files



#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 March 2011 - 08:08 AM

We'll be cooking up a number of HID examples for the new UsbClient feature.

To start with, here's a "Netduino Virtual Keyboard" sample.

Parts required:
  • Serial cable for your Netduino (FTDI 3.3V USB-TTL or an RS232 shield)
  • 7.5V-12V AC/DC adapter for your Netduino. You can also power Netduino via the VIN or 5V headers.
  • Netduino and its MicroUSB cable

Switching from USB debugging to serial debugging:
  • Grab our enhanced version of MFDeploy.
  • Run the enhanced MFDeploy. Select USB transport, and make sure your Netduino is selected.
  • In MFDeploy, select the Target Menu > Configuration > Deployment Transport
  • Switch deployment from USB to COM1. You can switch back anytime (via serial).

Using the NetduinoVirtualKeyboard sample:
  • Load the NetduinoVirtualKeyboard solution into Visual Studio like normal, but select Serial for transport (project properties > .NET Micro Framework)
  • Plug your Netduino into external power and its serial cable into your computer.
  • Run the solution (F5).
  • Once the program starts, you'll see a message to reconnect your USB cable to a PC. [Disconnect it if it's already attached, first.]
  • Windows will automatically install the HID driver for the keyboard.
  • The sample program will then type "helloworld" in the current window.

Since the Netduino will be typing, I'd recommend either plugging it into a separate computer or opening up notepad before plugging the USB cable into your computer.

Enjoy!

Chris

Attached Files



#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 March 2011 - 08:11 AM

One more note:

Some Netduino Plus users may want to disable its Ethernet feature to free up codespace and RAM. You can now do this.

To convert your Netduino Plus into a "Netduino + SD card":
1. Erase your Netduino Plus
2. Use SAM-BA to flash the Netduino bootloader (TinyBooterDecompress.bin from the zip file, first post of this thread).
3. Deploy the Netduino firmware to your Netduino Plus
4. Add the SecretLabs.NETMF.IO.dll assembly to your project

Then, add the following line of code at the beginning of your Netduino app:
SecretLabs.NETMF.IO.StorageDevice.MountSD("SD", SPI.SPI_module.SPI2, (Cpu.Pin)21, (Cpu.Pin)57);
Your Netduino Plus will now automatically mount your MicroSD cards just like normal. Plus you'll have a full 128KB of codespace and 62+ KB of RAM.

Chris

#5 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 26 March 2011 - 04:57 PM

Tested with these codes:

Reading:
StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_D10);
FileStream filestream = new FileStream(@"\SD\test.txt", FileMode.Open);
StreamReader reader = new StreamReader(filestream);
Debug.Print(reader.ReadToEnd());
reader.Close();
StorageDevice.Unmount("SD");
Writing:
StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_D10);
FileStream filestream = new FileStream(@"\SD\test.txt", FileMode.Open);
StreamWriter streamWriter = new StreamWriter(filestream);
streamWriter.WriteLine("Test 123");
streamWriter.Close();
filestream.Close();
StorageDevice.Unmount("SD");

Results:

1GB Sandisk: mount/read/write works
8GB Sandisk: mount/read/write works
16GB A-Data: doesn't work :)

Output on the 16GB:

Ready.
#### Exception System.IO.IOException - CLR_E_FILE_IO (1) ####
#### Message:
#### Microsoft.SPOT.IO.NativeFileStream::Read [IP: 0000] ####
#### System.IO.FileStream::Read [IP: 0028] ####
#### System.IO.StreamReader::FillBufferAndReset [IP: 0031] ####
#### System.IO.StreamReader::Read [IP: 003c] ####
#### System.IO.StreamReader::ReadSeekableStream [IP: 0015] ####
#### System.IO.StreamReader::ReadToEnd [IP: 000f] ####
#### NetduinoApplication1.Program::Main [IP: 001c] ####
#### Exception System.IO.IOException - 0x00000000 (1) ####
#### Message: m_stream.Read
#### System.IO.StreamReader::FillBufferAndReset [IP: 0062] ####
#### System.IO.StreamReader::Read [IP: 003c] ####
#### System.IO.StreamReader::ReadSeekableStream [IP: 0015] ####
#### System.IO.StreamReader::ReadToEnd [IP: 000f] ####
#### NetduinoApplication1.Program::Main [IP: 001c] ####
Uncaught exception
Done.


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 March 2011 - 05:03 PM

1GB Sandisk: mount/read/write works
8GB Sandisk: mount/read/write works
16GB A-Data: doesn't work :)


8GB works? Woot! That's great!

I'll see if we can get a 16GB Sandisk card and a 32GB Sandisk card and see if we can get those sizes working too. I was only expecting to be able to get limited 4GB cards working--so what Kode has put together here is superb.

Chris

#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 31 March 2011 - 04:18 AM

Stefan, We just purchased an 8GB Sandisk MicroSD(HC) card to test with the new v4.1.1 firmware. It worked here as well. Reading and writing. Awesome. Chris

#8 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 31 March 2011 - 06:43 AM

Glad to hear that. The 16GB is of another brand, that could be the issue. Nice feature though, SDHC support! :)
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#9 Ryan Mick

Ryan Mick

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts
  • LocationSacramento, CA

Posted 04 April 2011 - 04:01 AM

Chris, it doesn't look like calling StreamWriter.Flush is writing to the SD card.

#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 04 April 2011 - 04:30 AM

Chris, it doesn't look like calling StreamWriter.Flush is writing to the SD card.


Does FileStream.Flush push the data to the card?

It's possible that there's a disconnect between the two in .NET MF. If so, we'll dig into it and ping Microsoft to see if we can get it fixed (either in beta Netduino firmware...or in .NET MF 4.2).

Chris

#11 Ryan Mick

Ryan Mick

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts
  • LocationSacramento, CA

Posted 04 April 2011 - 02:36 PM

FileStream.Flush is not pushing data to the card as well. But if I call them both then data is flushed to the card.

#12 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 04 April 2011 - 06:51 PM

FileStream.Flush is not pushing data to the card as well. But if I call them both then data is flushed to the card.


Hi Ryan,

Thank you very much for this additional info. We have assigned bug #74 to this issue.

Do you happen to have a small project (perhaps a dozen lines of code?) that reproduces this issue? Also, what sort of shield are you using...or is this on a Netduino Plus?

Chris

#13 Ryan Mick

Ryan Mick

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts
  • LocationSacramento, CA

Posted 04 April 2011 - 08:48 PM

This is a standard Netduino and I am using the Futurlec SD/MMC Mini Board.

Unfortunately I am away from my code at the moment but basically I have a class with the FileStream and StreamWriter declared at the class level and every second or so I make a call to a method that writes a line to the StreamWriter and calls the flush methods. I call first the StreamWriter then the FileStream and that seems to put it on the SD. If I called one or the other nothing would be written to the SD.

#14 Fabien Royer

Fabien Royer

    Advanced Member

  • Members
  • PipPipPip
  • 406 posts
  • LocationRedmond, WA

Posted 05 April 2011 - 01:07 AM

Hi Chris,

I discovered an issue with firmware v4.1.1 Beta 1 using various SD card types. See below.

  • All cards are from SanDisk
  • All cards were formatted using SD Formatter 3.0
  • All cards were FAT formatted, erased and cluster-adjusted according to size (16K clusters)
  • The SD card reader used in all tests was a Futurlec SD/MMC Mini Board, identical to Ryan Mick's above. I also tested the cards with an AdaFruit microSD card reader and got the same results.
Results:

SanDisk 64 MB TransFlash
#### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (1) ####
#### Message:
#### Microsoft.SPOT.IO.NativeIO::GetAttributes [IP: 0000] ####
#### System.IO.FileStream::.ctor [IP: 005c] ####
#### System.IO.FileStream::.ctor [IP: 0010] ####
#### SDCardTest.Program::Main [IP: 0012] ####

This specific model used to work with firmware v4.1.1.a7

SanDisk 1GB miniSD
Works

SanDisk 1GB microSD
Works

Test Code:


using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using SecretLabs.NETMF.IO;
using System.IO;

namespace SDCardTest
{
    public class Program
    {
        public static void Main()
        {
            StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_D10);

            using (var filestream = new FileStream(@"\SD\resources.txt", FileMode.Open))
            {
                StreamReader reader = new StreamReader(filestream);
                Debug.Print(reader.ReadToEnd());
                reader.Close();
            }

            using (var filestream = new FileStream(@"\SD\dontpanic.txt", FileMode.Create))
            {
                StreamWriter streamWriter = new StreamWriter(filestream);
                streamWriter.WriteLine("This is a test of the SD card support on the netduino...This is only a test...");
                streamWriter.Close();
            }

            StorageDevice.Unmount("SD");
        }
    }
}


Cheers,
-Fabien.

#15 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 05 April 2011 - 01:40 AM

Hi Fabien,

SanDisk 64 MB TransFlash

This specific model used to work with firmware v4.1.1.a7


Thank you very much for bringing this to our attention.

Do you happen to know where we can buy a SanDisk 64MB Transflash card like the one you have? Or perhaps we could arrange a temporary swap for a larger card?

Could you also reflash your Netduino with the v4.1.1 alpha 7 firmware and verify that the card still works there (if you haven't done so)?

The code changes should not affect smaller cards, but it's possible (and apparently affecting you).

Thanks, Fabien.

Chris

#16 Fabien Royer

Fabien Royer

    Advanced Member

  • Members
  • PipPipPip
  • 406 posts
  • LocationRedmond, WA

Posted 05 April 2011 - 03:39 AM

Hey Chris, Sure, I can test this on a netduino running v4.1.1.a7 to validate the regression. I'll let you know what I find shortly. I can also send you the card for further testing. Just let me know where to send it... Cheers, -Fabien.

#17 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 05 April 2011 - 04:15 AM

Hey Chris,

Sure, I can test this on a netduino running v4.1.1.a7 to validate the regression. I'll let you know what I find shortly.
I can also send you the card for further testing. Just let me know where to send it...

Cheers,
-Fabien.


Hi Fabien,

You have PM...

Chris

#18 Fabien Royer

Fabien Royer

    Advanced Member

  • Members
  • PipPipPip
  • 406 posts
  • LocationRedmond, WA

Posted 05 April 2011 - 06:32 AM

Hi Chris,

Quick update:
  • I tried to repro the issue on 4.1.1.a7 on a netduino mini and the results are identical: the 64 MB micro TransFlash fails. I tested with another regular 64 MB SD card and it worked which leads me to believe that I got confused between the two 64 MB cards Posted Image
  • I also tested with a Dane/Elec 512 MB SD card which worked fine.
  • In all cases, the cluster size was 16K
I will test on a friend's netduino running 4.1.1.a7 on Wednesday and will report my findings here. In any event, it may still be interesting to figure out why the micro TransFlash doesn't work (there's literally no difference between a TransFlash and a microSD card).

Cheers,
-Fabien.

#19 Fabien Royer

Fabien Royer

    Advanced Member

  • Members
  • PipPipPip
  • 406 posts
  • LocationRedmond, WA

Posted 08 April 2011 - 04:49 AM

Hi Chris,


I've been experiencing too many weird SD card-related issues with Beta 1 to continue working with it and I had to revert back to Alpha 7.


The weirdness is best described as "things stopped working for no apparent reason". I know, this is not terribly helpful...


For instance, the basic piece of code in my post above started throwing CLR_E_NOT_SUPPORTED exceptions all of a sudden after deploying various projects for regression testing. After re-flashing the netduino to Alpha 7, it works fine and things have been stable again.


Am I the only person to have reported this?


Cheers,
-Fabien.

#20 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 08 April 2011 - 05:03 AM

Hi Fabien, We haven't had any other similar reports with v4.1.1 Beta 1. But I'd like to see if we can take care of the issue you're experiencing. When you get the CLR_E_NOT_SUPPORTED exception, what line of code is that happening on? Also, I know we were talking about versioning in another thread...but are you using the "beta 1" version of the SecretLabs.NETMF.IO.dll? We're getting ready to release v4.1.1 beta 2, so if we can get this issue sorted out at the same time for you...I'd like to. Chris




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

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.