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 Firmware v4.1.1 ALPHA 7


  • Please log in to reply
20 replies to this topic

#1 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 14 February 2011 - 07:29 AM

This firmware has been superceded by Netduino Firmware v4.1.1 beta 1

#2 Benjamin

Benjamin

    New Member

  • Members
  • Pip
  • 3 posts
  • LocationThe Netherlands

Posted 14 February 2011 - 07:00 PM

Thanx Chris, I appreciate all the effort. I am going to tryout the advanced SPI feature to control a TLC5940 led-driver (12-bit), I will keep you informed :) Greetz Benjamin

#3 Benjamin

Benjamin

    New Member

  • Members
  • Pip
  • 3 posts
  • LocationThe Netherlands

Posted 16 February 2011 - 09:29 PM

Variable bit-SPI is working fine. However I got some other problems with my LED_driver (timing of GSCLK) but noticed I was not the only one.
This LED-driver seems not to be the best choice in combination with the netduino. Anyway.. I will continue my search but keep up the good work!

Greetzz

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 16 February 2011 - 09:51 PM

Variable bit-SPI is working fine. However I got some other problems with my LED_driver (timing of GSCLK) but noticed I was not the only one.
This LED-driver seems not to be the best choice in combination with the netduino. Anyway.. I will continue my search but keep up the good work!

Greetzz


Hi Benjamin,

Did the LED driver work with the v4.1.0.5 firmware (but not the new v4.1.0.6/v4.1.1alpha firmware)?

Also, what are the particulars of clock timing that are causing troubles?

Chris

#5 MioTheGreat

MioTheGreat

    New Member

  • Members
  • Pip
  • 1 posts

Posted 17 February 2011 - 03:42 PM

What's the progress on the HID driver?

#6 Benjamin

Benjamin

    New Member

  • Members
  • Pip
  • 3 posts
  • LocationThe Netherlands

Posted 17 February 2011 - 07:09 PM

Hi Chris,

this led-driver uses two kind of clocks. One is ment for the datatransmission (thus SPI-clk) and the other one for the PWM-timing. The SPI transfer which I use at 12-bit works fine. However this grayscale clock (GSCLK) is causing me a headache.

The problem with this is that the internal counter of the driver is using the grayscale clock as a trigger (for counting). When it reaches 4096 (12 bit) it does not reset automatically. This has to be done by activating(BLANK) exactly after 4096 GSCLK cycles. While blank is active, the outputs are off.
One of the other things is that new data can be shifted in during a "grayscale cycle" but only can be latched at the end of it. So this driver needs some specific timing and I think native code is a better solution at this point in time because of performance.

I have really tried to make it work (e.g. by using the PWM class for blank and gsclk) but for now I think I will look for another driver.

By the way, do you think there is another solution?

#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 17 February 2011 - 10:01 PM

What's the progress on the HID driver?


The .NET MF and desktop code is done, but we're still waiting on a bugfix to the .NET MF platform kit. Working on it...

Chris

#8 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 17 February 2011 - 10:03 PM

By the way, do you think there is another solution?


If there's no wiggle room for a little latency in resetting the counter, then a native code driver is probably the best option.

Chris

#9 Stefan

Stefan

    Moderator

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

Posted 07 March 2011 - 11:32 AM

Don't know if this thread is the right spot for this, but lets give it a try :) With USB HID support, is it also possible to build in USB Storage 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

#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 March 2011 - 11:48 AM

Don't know if this thread is the right spot for this, but lets give it a try :)

With USB HID support, is it also possible to build in USB Storage support?


You could turn your Netduino into a USB Mass Storage device...yes. That wouldn't be using HID, and it might require native code, but I'm not aware of any limitations in the hardware that would preclude this. Fair warning: that could be quite a bit of work.

Chris

#11 Dezorian

Dezorian

    Member

  • Members
  • PipPip
  • 24 posts

Posted 07 March 2011 - 10:04 PM

I'm still having trouble writing to a file with the filestream class. The lines are correctly being written, but i get an exception afterwards. This is the code:

StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Cpu.Pin.GPIO_Pin8);
            FileStream filestream;
            if (File.Exists(@"SD\game.log"))
            {
                filestream = new FileStream(@"SD\game.log", FileMode.Append, FileAccess.Write, FileShare.None);
            }
            else
            {
                filestream = new FileStream(@"SD\game.log", FileMode.Create, FileAccess.Write, FileShare.None);
            }
            StreamWriter streamWriter = new StreamWriter(filestream);                
            streamWriter.WriteLine("HIT;Player" + player.ToString() +  ";Team" + team.ToString());
            streamWriter.Close();
            filestream.Close();
            StorageDevice.Unmount("SD");

This is all implemented in an EventHandler (SerialPortDataReceived), and i get an exception when the thread for that event is exited...

The thread '<No Name>' (0x2) has exited with code 0 (0x0).Step into: Stepping over non-user code    System.IO.Ports.SerialPort.DataEventHandler
    #### Exception System.IO.IOException - CLR_E_FILE_IO (5) ####
    #### Message: 
    #### Microsoft.SPOT.IO.VolumeInfo::.ctor [IP: 0000] ####
    #### Microsoft.SPOT.IO.RemovableMedia::MessageHandler [IP: 0022] ####
A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll
An unhandled exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll

Any ideas?

#12 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 08 March 2011 - 05:49 AM

Hi Dezorian, Your code looks good at first glance. Is the error occuring on a line of code--or just showing up in the debug output? Also, is it stopping your program...or just creating worries about data corruption? Finally, just curious: if you add a small sleep (say Thread.Sleep(25) between fileStream.Close() and StorageDevice.Unmount() do you still see the same issue? Chris

#13 Dezorian

Dezorian

    Member

  • Members
  • PipPip
  • 24 posts

Posted 08 March 2011 - 07:23 AM

That's the weird thing, the exception is being thrown right after the closing bracket of the event handler. So it seems all lines are being executed correctly,
but its not finished yet or something, i've put thread.sleeps for 1 second behind the unmount method and between filestream and unmount but still i get the same exception.
It's a "real" exception, the program hangs:
An unhandled exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll
If i "break" i get the "No symbols available", because the exception is being thrown after the closing bracket of the eventhandler, so there's no real code visible on the break, and no dissasembly is visible :huh:

#14 Dezorian

Dezorian

    Member

  • Members
  • PipPip
  • 24 posts

Posted 08 March 2011 - 09:32 PM

So i did some testing... there seems to be something conflicting with event triggering and SD card functionality. - When writing to the SD card in an event, the data is correctly being written to the SD but you get the exception as written above, after the event is exited. - When writing to the SD card in the Program Main(), no exception is being thrown, but the UART events stop working (no interrupt anymore), and the watchdog LED on my prototype board (infinite while loop in main() ) doesn't blink anymore. I've rolled back the the 4.1.0.6 RC firmware because Omar (OZ) said he got it to work without the Mount() and UnMount(). I've tried that but no luck for me. I'm now back to 4.1.1 a7. I really think this is something in the firmware. Anything more I could try?

#15 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 08 March 2011 - 10:24 PM

Dezorian, Could you create a simple project which reproduces the issue consistently...and post it? Also, this is on Netduino correct, not Netduino Plus or Mini? Chris

#16 Dezorian

Dezorian

    Member

  • Members
  • PipPip
  • 24 posts

Posted 09 March 2011 - 07:07 AM

Its on the Netduino "normal". I'll try to post the simple project asap.

#17 Dezorian

Dezorian

    Member

  • Members
  • PipPip
  • 24 posts

Posted 09 March 2011 - 06:39 PM

Ok, ive made a program which reproduces the error, i've also send a pm to you. Here is the link to the project zip file.

This is the simple program:

using System;
using System.Text;
using System.Threading;
using System.IO;
using System.Diagnostics;
using System.Reflection;
using System.IO.Ports;
using Microsoft.SPOT;
using Microsoft.SPOT.IO;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.IO;
using SecretLabs.NETMF.Hardware.Netduino;

namespace SDBugTest
{
    public class Program
    {
        private static OutputPort _led1 = new OutputPort(Pins.ONBOARD_LED, false);        
        private static InterruptPort _button = new InterruptPort(Pins.ONBOARD_SW1, true, Port.ResistorMode.PullUp,Port.InterruptMode.InterruptEdgeHigh);
        private static bool _enableLed = true;
        public static void Main()
        {            
            _button.OnInterrupt += new NativeEventHandler(button_OnInterrupt);

            //This works, no problemo
            WriteToSD();

            //Watchdog LED on the prototype board to keep the main thread alive
            while (true)
            {
                if (_enableLed)
                {
                    _led1.Write(true);
                    Thread.Sleep(500);
                    _led1.Write(false);
                    Thread.Sleep(500);
                }
            } 
        }

        private static void button_OnInterrupt(uint data1, uint data2, DateTime time)
        {
            _enableLed = !_enableLed;            

            //This seems to work only after the closing bracket "}", you get an exception
            WriteToSD();            
        }
        //An unhandled exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll

        private static void WriteToSD()
        {
            StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Cpu.Pin.GPIO_Pin8);
            FileStream filestream = new FileStream(@"\SD\game.log", FileMode.Append);
            StreamWriter streamWriter = new StreamWriter(filestream);
            streamWriter.WriteLine("TestingDate: " + DateTime.Now.ToString("HH:mm"));
            streamWriter.Close();
            filestream.Close();            
            StorageDevice.Unmount("SD");
        }

    }
}



#18 Stefan

Stefan

    Moderator

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

Posted 12 March 2011 - 10:23 AM

Dezorian asked me to test it on my hardware and I can confirm Dezorian's problem. Tested it on my Netduino with firmware v4.1.2 ALPHA 0.
The weirdest thing is though, that it doesn't break at a line, see this screenshot.

The thread '<No Name>' (0x2) has exited with code 0 (0x0).
#### Exception System.IO.IOException - CLR_E_FILE_IO (4) ####
#### Message:
#### Microsoft.SPOT.IO.VolumeInfo::.ctor [IP: 0000] ####
#### Microsoft.SPOT.IO.RemovableMedia::MessageHandler [IP: 0022] ####
A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll
An unhandled exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll
"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

#19 Dezorian

Dezorian

    Member

  • Members
  • PipPip
  • 24 posts

Posted 17 March 2011 - 09:36 AM

Chris, did you have any time trying to test the SD Card Bug Test project? I'm anxious to continue my project, but with this bug it's really not possible...

Thanks!

#20 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 17 March 2011 - 12:04 PM

Chris, did you have any time trying to test the SD Card Bug Test project? I'm anxious to continue my project, but with this bug it's really not possible...

Hi Dez,

It's a really odd issue... I'll see if we can create a workaround while we're fixing the bug for the next beta.

I'll post back in this forum with updates.

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.