Netduino 1 Firmware v4.1.1 BETA 1
#21
Posted 08 April 2011 - 05:39 AM
The StorageDevice.MountSD() calls is generally the one throwing the exceptions. If that doesn't crash, the first I/O call throws the same exception:
using (var reader = new StreamReader(SdMountPoint + @"\" + resourceManifest)) {...}
You can see the source code that I'm using here http://netduinohelpe...sourceLoader.cs
or this one for basic regression testing:
http://netduinohelpe...Test/Program.cs
I was using the 'Beta 1' version of the SecretLabs.NETMF.IO.dll, along with firmware 4.1.1 Beta 1 after I re-flashing the netduino from scratch with SAM-BA 2.0.
Cheers,
-Fabien.
#22
Posted 08 April 2011 - 05:43 AM
#23
Posted 08 April 2011 - 05:49 AM
#24
Posted 08 April 2011 - 06:42 AM
#25
Posted 08 April 2011 - 06:45 AM
Hi Fabien,
We'll dig into this.
BTW, are you using @"\SD\filename.ext" to access files...or @"SD\filename.ext"? It looks like the code is using the latter...I'd highly recommend using an absolute path (including the initial backslash) if possible. Not sure that has anything to do with the issue at hand or not though.
Chris
No, the path is not the issue here. The same code works on one build but not the other.
#26
Posted 08 April 2011 - 06:51 AM
Hi Fabien,
One more thing really quick.
As of v4.1.1 beta 1, the "chip select" and "spi module" properties passed into the MountSD card are used. Before, we had it hardcoded to "SPI1...pins D11-D13" and "SPI_CS on pin D10".
Would it be possible to have you attach a small repro project which shows the exact issue at hand...and also list which shield or accessory you're using to connect MicroSD? [A Fritzing diagram would also be wonderful--but I know that's asking a lot.]
When we first switched over to beta 1, we found that quite a few users were using "Cpu.Pin.###10" instead of "Pins.###_D10", etc. etc. So it's possible (though not certain) that this is a configuration issue.
Chris
That's a good thought but the pin assignment is not the issue either.
The SD card reader is attached to SPI through pin 10 to 13 on the netduino.
I've attached the project that I've been using to do the regression testing along with the file being read by the test.
I hope this helps.
Attached Files
#27
Posted 08 April 2011 - 03:37 PM
Out of curiosity, has SecretLabs tested with the AdaFruit microSD card reader? http://www.adafruit....products_id=254
-Fabien.
#28
Posted 09 April 2011 - 04:10 AM
#29
Posted 09 April 2011 - 05:07 AM
Yes, this is actually our test platform for making sure MicroSD is working on Netduino Mini. We have also tested it with the regular Netduino.Out of curiosity, has SecretLabs tested with the AdaFruit microSD card reader? http://www.adafruit....products_id=254
Ah, very interesting. There could be an issues with .NET MF switching back and forth between the two. Perhaps something we need to tweak in the SD or SPI drivers, etc.I have found a repro which works 100% of the time with Alpha 7. Before I go into too much details, I have two questions: what is the configuration of SPI for SD I/O in Alpha 7 and Beta 1? Are you aware of possible issues when other SPI devices are configured differently than the StorageDevice class?
We can certainly pick up a MAX7219 LED driver to do some more in-depth testing if you have a bit of repro code. [If/when you post it, please verify that the code _does_ work with v4.1.1 a7 but no with v4.1.1 b1.]
Thanks, Fabien!
[BTW, I'm headed to Microsoft MIX. I'll be checking into the forums a bit while I'm gone...but coordinating firmware updates and such will be a bit delayed for 3-4 days...]
Chris
#30
Posted 09 April 2011 - 09:25 PM
I've been narrowing down the SD card issues that I've been observing, starting with 4.1.1 Alpha 7.
Test setup (see attached picture)
- netduino mini
- firmware 4.1.1 a7
- a 64 MB SD card
- a 1GB micro SD card + SD adapter
- a Futurlec SD card reader
- resources.txt : a file with a few lines of random text located at the root of each SD card
public static void Main() { #if NETDUINO_MINI StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_13); #else StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_D10); #endif 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"); }
Test steps:
- Insert the 1GB micro SD card in the SD adapter
- Insert the SD adapter into the SD card reader
- Execute the test code under the debugger
- Observe the results in the output window -> the test succeeds and the content of 'resources.txt' is displayed
- Swap out the SD adapter with the 1GB micro SD card for the 64 MB SD card
- Execute the test code under the debugger
- Observe the results in the output window -> the test fails with #### Exception System.IO.IOException - CLR_E_VOLUME_NOT_FOUND (1) #### on the following call: StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_D10);
- Pull the 64 MB SD card out of the SD card reader
- Re-insert the 64 MB SD card out of the SD card reader (note: on occasions, steps 8, 9 & 10 must be repeated a few times for step 11 to succeed)
- Execute the test code again
- Observe the results in the output window -> the test succeeds and the content of 'resources.txt' is displayed
- Repeating this test consistently produces the same results.
- On a netduino mini running firmware 4.1.1 a7, it appears that swapping between different types of SD cards, specifically going from a 1GB microSD card mounted in an SD card adapter to a regular 64MB SD card causes the netduino to fail recognizing the card every single time. Re-inserting the 64 MB card appears to resolve the issue most of the time.
- Is the .Net MF on the netduino mini preserving some state about the SD device and file system being mounted when it should not?
Attached Files
#31
Posted 09 April 2011 - 09:54 PM
- netduino
- firmware 4.1.1 a7
- a 1GB micro SD card + SD adapter
- an AdaFruit microSD card reader
- resources.txt : a file with a few lines of random text located at the root of each SD card
public static void Main() { #if NETDUINO_MINI StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_13); #else StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_D10); #endif 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"); }
Test steps:
- Insert the 1GB micro SD card in the AdaFruit microSD card reader
- Execute the test code under the debugger
- Observe the results in the output window -> the test fails with #### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (1) #### on the following line: using (var filestream = new FileStream(@"SD\resources.txt", FileMode.Open))
- Eject the micro SD card from the AdaFruit reader
- Re-insert the microSD card into the AdaFruit reader
- Execute the test code under the debugger
- Observe the results in the output window -> the test fails with #### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (1) #### on the following line: using (var filestream = new FileStream(@"SD\resources.txt", FileMode.Open)). The test will continue to fail no matter how many times the microSD card gets ejected / re-inserted into the AdaFruit reader.
- Eject the microSD card from the AdaFruit reader
- Execute the test code under the debugger
- Observe the results in the output window -> the test fails with #### Exception System.IO.IOException - CLR_E_VOLUME_NOT_FOUND (1) #### on line StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_D10); which is expected.
- Re-insert the microSD card into the AdaFruit reader
- Execute the test code under the debugger
- Observe the results in the output window -> the test succeeds and the content of 'resources.txt' is displayed
Note: in this test, switching between two different types of microSD cards did not cause the test to succeed.
Conclusion
- On a regular netduino running 4.1.1 Alpha 7, reading a 1GB microSD card using an AdaFruit microSD reader will always fails until a CLR_E_VOLUME_NOT_FOUND exception occurs. Subsequent attempts to read / write to the microSD card will succeed after that.
- What kind of state is being reset by the .Net MF on the netduino when a CLR_E_VOLUME_NOT_FOUND exception occurs?
Update: This test results in the same exact behavior under 4.1.1 Beta 1 on a regular netduino.
Additional data point: attempting to run this test sequence outside of the debugger, using the reset button of the netduino after an exception occurs and ejecting/re-inserting the microSD card, always fails.
Attached Files
#32
Posted 17 April 2011 - 09:35 PM
#33
Posted 24 May 2011 - 07:51 PM
#34
Posted 25 May 2011 - 04:48 PM
#35
Posted 30 May 2011 - 05:43 PM
I've got myself into troubles today with my Netduino.
Got the 4.1.1 b1 firmware. The Echo app worked well, so I moved to the Keyboard sample.
I think I've followed all the steps as posted, but for some reason it didn't work.
I got the message that I should reconnect the USB. After reconnecting, it still was stuck in the
status polling loop. I never got a "Running" PortState, got "Attached" and then it turned to "Suspended" for some
reason.
After that problem, I couldn't deploy via serial anymore. Each attempt would get VS stuck (I did had external AC and all
the requirements as posted here). MFDeploy also couldn't ping the device through Serial or USB.
My only solution was to use the erase pad and reprogram with SAM-BA.
Didn't tried it again though, hope it won't reproduce. I'll be glad if someone could
explain what happened to my board. Is it a common faulty behavior?
I've noticed that in the "Safely Remove Hardware" (win xp sp3) I had a device called
"USB Serial Converter" - trying to remove it caused my OS to stuck for a while. Also, trying disabling it through the
Device manager - made the mmc console to crash lol. Hard reset solved everything . I'm wondering if that device could
make the netduino not recognized as a HID? I'm thinking that the "converter device" mentioned above is related to my FTDI 3.3v basic breakout board which required special VCP drivers. After restarting it didn't appeared again and everything was back to normal.
I wish the MSDN could be more informative about that PortState enumeration. Here you can see how funny it's documented.
#36
Posted 30 May 2011 - 06:06 PM
#37
Posted 30 December 2011 - 10:43 AM
#38
Posted 30 December 2011 - 04:24 PM
#39
Posted 13 January 2012 - 09:58 PM
Version: 4.1.1 BETA 1 (version 4.1.1.0 b1)
Is source available for this version of the firmware? I couldn't find a link for it...
#40
Posted 14 January 2012 - 03:56 AM
It should be on CodePlex. Go to the Source page...then select the v4.1.1.x branch.Is source available for this version of the firmware? I couldn't find a link for it...
Chris
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users