Main Site Documentation

PWM exception on EMX after 4.2.8.0 upgrade


#1

Hi All,

I have just updated my EMX’s to 4.2.8.0 - for the much anticipated UDP fix.
All looks good so far - however - some previously working PWM code (backlight fade in / fade out) now throws an exception:

In the implementation below the following exception is thown when declaring:
var pwm = new PWM(PWM_BACKLIGHT, PWM_BACKLIGHT_FREQUENCY, PWM_BACKLIGHT_FADEOUT_START, false);

The output and exception trown is:

Assembly: mscorlib (4.2.0.0) Assembly: Microsoft.SPOT.Native (4.2.0.0) Assembly: Microsoft.SPOT.Security.PKCS11 (4.2
.0.0) Assembly: System.Security (4.2.0.0) Loading Deployment Assemblies.

Attaching deployed file.

Assembly: Microsoft.SPOT.Hardware.OneWire (4.2.0.0) Attaching deployed file.

Assembly: Microsoft.SPOT.Touch (4.2.0.0) Attaching deployed file.

Assembly: System.Xml (4.2.0.0) Attaching deployed file.

Assembly: Intellitouch.Repository (1.0.0.0) Attaching deployed file.

Assembly: GHI.Premium.Net (4.2.8.0) Attaching deployed file.

Assembly: Microsoft.SPOT.Net (4.2.0.0) Attaching deployed file.

Assembly: GHI.Premium.IO (4.2.8.0) Attaching deployed file.

Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1) Attaching deployed file.

Assembly: Microsoft.SPOT.Hardware.SerialPort (4.2.0.0) Attaching deployed file.

Assembly: Microsoft.SPOT.Ink (4.2.0.0) Attaching deployed file.

Assembly: Intellitouch.Common (1.0.0.0) Attaching deployed file.

Assembly: GHI.Premium.System (4.2.8.0) Attaching deployed file.

Assembly: System (4.2.0.0) Attaching deployed file.

Assembly: Intellitouch.Domain (1.0.0.0) Attaching deployed file.

Assembly: Intellitouch.IO (1.0.0.0) Attaching deployed file.

Assembly: Intellitouch.Services (1.0.0.0) Attaching deployed file.

Assembly: GHI.Premium.Hardware (4.2.8.0) Attaching deployed file.

Assembly: MFDpwsExtensions (4.2.0.0) Attaching deployed file.

Assembly: Intellitouch.UI (1.0.0.0) Attaching deployed file.

Assembly: Intellitouch.HTTP (1.0.0.0) Attaching deployed file.

Assembly: Microsoft.SPOT.TinyCore (4.2.0.0) Attaching deployed file.

Assembly: System.IO (4.2.0.0) Attaching deployed file.

Assembly: Microsoft.SPOT.Hardware (4.2.0.0) Attaching deployed file.

Assembly: Microsoft.SPOT.Graphics (4.2.0.0) Attaching deployed file.

Assembly: Microsoft.SPOT.IO (4.2.0.0) Resolving.

GC: 1msec 39696 bytes used, 7299972 bytes available

Type 0F (STRING ): 24 bytes

Type 15 (FREEBLOCK ): 7299972 bytes

Type 17 (ASSEMBLY ): 35556 bytes

Type 1E (BINARY_BLOB_HEAD ): 4044 bytes

Type 34 (APPDOMAIN_HEAD ): 72 bytes

GC: performing heap compaction…

The debugging target runtime is loading the application assemblies and starting execution.
Ready.

‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\mscorlib.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Native.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Security.PKCS11.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.Security.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.OneWire.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Graphics.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Touch.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.Xml.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Net.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.SerialPort.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.System.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Users\James\Desktop\Intellitouch.UI\Intellitouch.ZigBee\bin\Debug\le…\GHI.Premium.IO.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.PWM.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.TinyCore.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Users\James\Desktop\Intellitouch.UI\Intellitouch.Common\bin\Debug\le\Intellitouch.Common.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.IO.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.IO.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Users\James\Desktop\Intellitouch.UI\Intellitouch.ZigBee\bin\Debug\le\Intellitouch.IO.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Users\James\Desktop\Intellitouch.UI\Intellitouch.Domain\bin\Debug\le\Intellitouch.Domain.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\MFDpwsExtensions.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Users\James\Desktop\Intellitouch.UI\Intellitouch.Repository\bin\Debug\le\Intellitouch.Repository.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.Net.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Ink.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Users\James\Desktop\Intellitouch.UI\Intellitouch.Services\bin\Debug\le\Intellitouch.Services.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.Hardware.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Users\James\Desktop\Intellitouch.UI\Intellitouch.HTTP\bin\Debug\le\Intellitouch.HTTP.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Users\James\Desktop\Intellitouch.UI\Intellitouch.UI\bin\Debug\le\Intellitouch.UI.exe’, Symbols loaded.
The thread ‘’ (0x2) has exited with code 0 (0x0).
*** Application is starting up ***

Configuring display
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message:
#### Microsoft.SPOT.Hardware.Port::ReservePin [IP: 0000] ####
#### Microsoft.SPOT.Hardware.PWM::.ctor [IP: 004d] ####
#### Intellitouch.IO.LCD.LCDBacklightManager::FadeIn [IP: 0020] ####
#### Intellitouch.UI.Program::StartApplication [IP: 0049] ####
#### Intellitouch.UI.Program::Main [IP: 0008] ####
A first chance exception of type ‘System.InvalidOperationException’ occurred in Microsoft.SPOT.Hardware.dll
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message:
#### Microsoft.SPOT.Hardware.Port::ReservePin [IP: 0000] ####
#### Microsoft.SPOT.Hardware.PWM::Dispose [IP: 0017] ####
#### Intellitouch.IO.LCD.LCDBacklightManager::FadeIn [IP: 0020] ####
#### Intellitouch.UI.Program::StartApplication [IP: 0049] ####
#### Intellitouch.UI.Program::Main [IP: 0008] ####
A first chance exception of type ‘System.InvalidOperationException’ occurred in Microsoft.SPOT.Hardware.dll
An unhandled exception of type ‘System.InvalidOperationException’ occurred in Microsoft.SPOT.Hardware.dll

The program ‘[2] Micro Framework application: Managed’ has exited with code 0 (0x0).

Any ideas guys?

Cheers,
James

#region Using Directives

using System.Threading;
using Microsoft.SPOT.Hardware;
using GHI.Premium.Hardware;
using GHI.Premium;

 #endregion

namespace Intellitouch.IO.LCD
{
    public class LCDBacklightManager : ILCDBacklightManager
    {

        #region Private Members

        private const Cpu.PWMChannel PWM_BACKLIGHT = Cpu.PWMChannel.PWM_4;
        private const double PWM_BACKLIGHT_FADEIN_START = 0.001;
        private const double PWM_BACKLIGHT_FADEOUT_START = 0.999;
        private const double PWM_BACKLIGHT_FREQUENCY = 10000;
        private const int BACKLIGHT_TIMEOUT = 30;

        private Timer _lcdFadeTimer = new Timer(Timer_Tick, null, BACKLIGHT_TIMEOUT * 1000, BACKLIGHT_TIMEOUT * 1000);
        private static bool _lcdOn;

        #endregion

        #region Public Methods

        public void TouchGestureReceived()
        {
            _lcdFadeTimer = new Timer(Timer_Tick, null, BACKLIGHT_TIMEOUT * 1000, BACKLIGHT_TIMEOUT * 1000);
            if (!_lcdOn)
                FadeIn();
        }

        public void FadeOut()
        {
            if (_lcdOn)
            {
                var pwm = new PWM(PWM_BACKLIGHT, PWM_BACKLIGHT_FREQUENCY, PWM_BACKLIGHT_FADEOUT_START, false);
                var i = PWM_BACKLIGHT_FADEOUT_START;
                while (i >= PWM_BACKLIGHT_FADEIN_START)
                {
                    pwm.DutyCycle = i;
                    pwm.Start();
                    i -= 0.002;
                    Thread.Sleep(5);
                }
            }
            _lcdOn = false;
        }

        public void FadeIn()
        {
            if (!_lcdOn)
            {
                var pwm = new PWM(PWM_BACKLIGHT, PWM_BACKLIGHT_FREQUENCY, PWM_BACKLIGHT_FADEIN_START, false);
                var i = PWM_BACKLIGHT_FADEIN_START;
                while (i <= PWM_BACKLIGHT_FADEOUT_START)
                {
                    pwm.DutyCycle = i;
                    pwm.Start();
                    i += 0.002;
                    Thread.Sleep(1);
                }
            }
            _lcdOn = true;
        }

        #endregion

        #region Private Methods

        private static void Timer_Tick(object sender)
        {
            if (_lcdOn)
            {
                var pwm = new PWM(PWM_BACKLIGHT, PWM_BACKLIGHT_FREQUENCY, PWM_BACKLIGHT_FADEOUT_START, false);
                var i = PWM_BACKLIGHT_FADEOUT_START;
                while (i >= PWM_BACKLIGHT_FADEIN_START)
                {
                    pwm.DutyCycle = i;
                    pwm.Start();
                    i -= 0.002;
                    Thread.Sleep(5);
                }
            }
            _lcdOn = false;
        }

        #endregion

    }
}


#2

Try disposing PWM object when you are done with it. This should free the pin so the next ReservePin call will not through the exception.


#3

Thanks for the reply!!

I have wrapped all PWM declarations in using constructs - unfortunately still the same exception…
Service is served up via an IoC container - using singleton pattern.

Any other ideas?

Cheers,
James

Service implementation now looks like this:

#region Using Directives

using System.Threading;
using Microsoft.SPOT.Hardware;
using GHI.Premium.Hardware;
using GHI.Premium;

 #endregion

namespace Intellitouch.IO.LCD
{
    public class LCDBacklightManager : ILCDBacklightManager
    {

        #region Private Members

        private const Cpu.PWMChannel PWM_BACKLIGHT = Cpu.PWMChannel.PWM_4;
        private const double PWM_BACKLIGHT_FADEIN_START = 0.001;
        private const double PWM_BACKLIGHT_FADEOUT_START = 0.999;
        private const double PWM_BACKLIGHT_FREQUENCY = 10000;
        private const int BACKLIGHT_TIMEOUT = 30;

        private Timer _lcdFadeTimer = new Timer(Timer_Tick, null, BACKLIGHT_TIMEOUT * 1000, BACKLIGHT_TIMEOUT * 1000);
        private static bool _lcdOn;

        #endregion

        #region Public Methods

        public void TouchGestureReceived()
        {
            _lcdFadeTimer = new Timer(Timer_Tick, null, BACKLIGHT_TIMEOUT * 1000, BACKLIGHT_TIMEOUT * 1000);
            if (!_lcdOn)
                FadeIn();
        }

        public void FadeOut()
        {
            if (_lcdOn)
            {
                using (var pwm = new PWM(PWM_BACKLIGHT, PWM_BACKLIGHT_FREQUENCY, PWM_BACKLIGHT_FADEOUT_START, false))
                {
                    var i = PWM_BACKLIGHT_FADEOUT_START;
                    while (i >= PWM_BACKLIGHT_FADEIN_START)
                    {
                        pwm.DutyCycle = i;
                        pwm.Start();
                        i -= 0.002;
                        Thread.Sleep(5);
                    }
                }
            }
            _lcdOn = false;
        }

        public void FadeIn()
        {
            if (!_lcdOn)
            {
                using (var pwm = new PWM(PWM_BACKLIGHT, PWM_BACKLIGHT_FREQUENCY, PWM_BACKLIGHT_FADEIN_START, false))
                {
                    var i = PWM_BACKLIGHT_FADEIN_START;
                    while (i <= PWM_BACKLIGHT_FADEOUT_START)
                    {
                        pwm.DutyCycle = i;
                        pwm.Start();
                        i += 0.002;
                        Thread.Sleep(1);
                    }
                }
            }
            _lcdOn = true;
        }

        #endregion

        #region Private Methods

        private static void Timer_Tick(object sender)
        {
            if (_lcdOn)
            {
                using (var pwm = new PWM(PWM_BACKLIGHT, PWM_BACKLIGHT_FREQUENCY, PWM_BACKLIGHT_FADEOUT_START, false))
                {
                    var i = PWM_BACKLIGHT_FADEOUT_START;
                    while (i >= PWM_BACKLIGHT_FADEIN_START)
                    {
                        pwm.DutyCycle = i;
                        pwm.Start();
                        i -= 0.002;
                        Thread.Sleep(5);
                    }
                }
            }
            _lcdOn = false;
        }

        #endregion

    }
}


#4

Is it possible to reuse the PWM object?


#5

Ok - good suggestion - I have tried that and i’m still getting the same exception (in my Setup() method now)
I can also confirm the PWM pin isnt being used anywhere else apart from this class.

Service now looks like:

#region Using Directives

using System.Threading;
using Microsoft.SPOT.Hardware;
using GHI.Premium.Hardware;
using GHI.Premium;

 #endregion

namespace Intellitouch.IO.LCD
{
    public class LCDBacklightManager : ILCDBacklightManager
    {

        #region Private Members

        private const Cpu.PWMChannel PWM_BACKLIGHT = Cpu.PWMChannel.PWM_4;
        private const double PWM_BACKLIGHT_FADEIN_START = 0.001;
        private const double PWM_BACKLIGHT_FADEOUT_START = 0.999;
        private const double PWM_BACKLIGHT_FREQUENCY = 10000;
        private const int BACKLIGHT_TIMEOUT = 30;

        private Timer _lcdFadeTimer = new Timer(Timer_Tick, null, BACKLIGHT_TIMEOUT * 1000, BACKLIGHT_TIMEOUT * 1000);
        private static bool _lcdOn;
        private static PWM _pwm;

        #endregion

        #region Public Methods

        public void TouchGestureReceived()
        {
            _lcdFadeTimer = new Timer(Timer_Tick, null, BACKLIGHT_TIMEOUT * 1000, BACKLIGHT_TIMEOUT * 1000);
            if (!_lcdOn)
                FadeIn();
        }

        public void Setup()
        {
            _pwm = new PWM(PWM_BACKLIGHT, PWM_BACKLIGHT_FREQUENCY, PWM_BACKLIGHT_FADEOUT_START, false);
        }

        public void FadeOut()
        {
            if (_lcdOn)
            {
                var i = PWM_BACKLIGHT_FADEOUT_START;
                while (i >= PWM_BACKLIGHT_FADEIN_START)
                {
                    _pwm.DutyCycle = i;
                    _pwm.Start();
                    i -= 0.002;
                    Thread.Sleep(5);
                }
            }
            _lcdOn = false;
        }

        public void FadeIn()
        {
            if (!_lcdOn)
            {
                var i = PWM_BACKLIGHT_FADEIN_START;
                while (i <= PWM_BACKLIGHT_FADEOUT_START)
                {
                    _pwm.DutyCycle = i;
                    _pwm.Start();
                    i += 0.002;
                    Thread.Sleep(1);
                }
            }
            _lcdOn = true;
        }

        #endregion

        #region Private Methods

        private static void Timer_Tick(object sender)
        {
            if (_lcdOn)
            {
                var i = PWM_BACKLIGHT_FADEOUT_START;
                while (i >= PWM_BACKLIGHT_FADEIN_START)
                {
                    _pwm.DutyCycle = i;
                    _pwm.Start();
                    i -= 0.002;
                    Thread.Sleep(5);
                }
            }
            _lcdOn = false;
        }

        #endregion

    }
}


#6

I am running out of suggestions. One more thing stop/start timer instead of creating it on touch. You also have it created in declaration.


#7

Ok - i’ll give that a whirl.
Can you think of anything significant that has changed between 4.2.5.0 and 4.2.8.0??
This class used to work before I applied the update from 1st Feb!

Thanks again for you help,
James


#8

Also, im using the PWM implementation from Microsoft.SPOT.Hardware.PWM.dll, v4.0.30319, is this correct??


#9

Are you sure that pin is not used anywhere else in the code? The version number of the assembly is correct.


#10

Yep, I have done a solution-wide search and the only instance is in this class.
I have also tried some of the other pins (Cpu.PWMChannel.PWM_1 / 2 / 3 etc) and still getting the exception.
Have also tried removing and adding the MS.SPOT references again - and GHI.Premium.Hardware + IO + System refrences are all 4.2.8.0

James


#11

Just converted the class to a true singleton instance (no longer served via IoC container)
Definitely sure only 1 instance in memory - same issue.

James


#12

I’d go for a simple test app to repro this.

I am also unsure why a new version of the SDK would introduce something like this - do you have another PC with the older SDK still on it and can show your repro works successfully?


#13

Brett,

It’s a great shout.
I dont have the older SDK anymore - but will downgrade to test this if all else fails.
I have created a brand new solution with the following code - to eliminate anything else in my existing solution.
Same exception is bubbling up!

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace EMX_Application1
{
    public class Program
    {

        private const Cpu.PWMChannel PWM_BACKLIGHT = Cpu.PWMChannel.PWM_4;
        private const double PWM_BACKLIGHT_FADEIN_START = 0.001;
        private const double PWM_BACKLIGHT_FADEOUT_START = 0.999;
        private const double PWM_BACKLIGHT_FREQUENCY = 1000;
        private const int BACKLIGHT_TIMEOUT = 30;

        public static void Main()
        {
            var pwm = new PWM(PWM_BACKLIGHT, PWM_BACKLIGHT_FREQUENCY, PWM_BACKLIGHT_FADEIN_START, false);
            var i = PWM_BACKLIGHT_FADEIN_START;
            while (i <= PWM_BACKLIGHT_FADEOUT_START)
            {
                pwm.DutyCycle = i;
                pwm.Start();
                i += 0.002;
                System.Threading.Thread.Sleep(1);
            }
        }

    }
}


#14

I am going to try this later. Does your solution has only one project?


#15

In the last ‘demo’ example - yes - just 1 one project - brand new just now.

In my main project where the problem first manifested, I have 7 projects in an SOA style pattern.
All projects refs have been dropped and recreated and I have checked all version numbers.

I have several identical PCB’s for my product prototype all with EMX’s.
I’m going to try and reflash this board again with 4.2.8.0, to see if that helps, and reflash another one up from 4.2.5.0 to 4.2.8.0 and test on that one too.

Thanks all for your ongoing help.

James


#16

Can you show exception trace for the last demo, please?


#17

Found debugger!

Create TS.

Loading start at a0e00000, end a0e1383c

Assembly: mscorlib (4.2.0.0) Assembly: Microsoft.SPOT.Native (4.2.0.0) Assembly: Microsoft.SPOT.Security.PKCS11 (4.2
.0.0) Assembly: System.Security (4.2.0.0) Loading Deployment Assemblies.

Attaching deployed file.

Assembly: Microsoft.SPOT.Graphics (4.2.0.0) Attaching deployed file.

Assembly: EMX Application (1.0.0.0) Attaching deployed file.

Assembly: GHI.Premium.System (4.2.8.0) Attaching deployed file.

Assembly: GHI.Premium.IO (4.2.8.0) Attaching deployed file.

Assembly: GHI.Premium.Hardware (4.2.8.0) Attaching deployed file.

Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1) Attaching deployed file.

Assembly: Microsoft.SPOT.Hardware (4.2.0.0) Resolving.

GC: 1msec 17580 bytes used, 7322088 bytes available

Type 0F (STRING ): 24 bytes

Type 15 (FREEBLOCK ): 7322088 bytes

Type 17 (ASSEMBLY ): 13440 bytes

Type 1E (BINARY_BLOB_HEAD ): 4044 bytes

Type 34 (APPDOMAIN_HEAD ): 72 bytes

GC: performing heap compaction…

The debugging target runtime is loading the application assemblies and starting execution.
Ready.

‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\mscorlib.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Native.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Security.PKCS11.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.Security.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Graphics.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.PWM.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘c:\users\james\documents\visual studio 2010\Projects\EMX Application1\EMX Application1\bin\Debug\le\EMX Application.exe’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.System.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.IO.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded 'C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.Hardware.dll’
The thread ‘’ (0x2) has exited with code 0 (0x0).
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message:
#### Microsoft.SPOT.Hardware.Port::ReservePin [IP: 0000] ####
#### Microsoft.SPOT.Hardware.PWM::.ctor [IP: 004d] ####
#### EMX_Application1.Program::Main [IP: 0018] ####
A first chance exception of type ‘System.InvalidOperationException’ occurred in Microsoft.SPOT.Hardware.dll
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message:
#### Microsoft.SPOT.Hardware.Port::ReservePin [IP: 0000] ####
#### Microsoft.SPOT.Hardware.PWM::Dispose [IP: 0017] ####
#### EMX_Application1.Program::Main [IP: 0018] ####
A first chance exception of type ‘System.InvalidOperationException’ occurred in Microsoft.SPOT.Hardware.dll
An unhandled exception of type ‘System.InvalidOperationException’ occurred in Microsoft.SPOT.Hardware.dll


#18

What puzzles me is PWM::Dispose in the trace.


#19

I know, i try and instantiate the object - then PWM::Dispose


#20

Has anyone managed to reproduce this yet?
Rolled back to 4.2.5.0 and the problem goes away!
James