GHI Electronics NETMF SDK 2015 R1 Pre-Release 3

I know you know this C-Born, you’re doing this stuff for a living, but I’ll still say it - seems to me this should be easy to create a simple repro code, which will help GHI confirm it and work towards addressing it.

I’ll also ask - did you try on an earlier release of 4.3 at all ? 2014 R5 ? Any different ?

@ Brett - Yes, that is the next stage. But I like to throw the question out there before spending too much time on it, in case the answer comes back “Yes, we know, we are working on it!” :slight_smile:

I’ve been away from the project (and the country) for a bit, and only just got onto setting up a branch for 4.3, so I don’t know if the same problem was there in previous releases. If nobody else has had a similar experience I’ll see if I can set up to capture it on a CRO, but it will have to take a back-seat while I do some work on the 4.2 branch for a new Brazilian client.

There’s a slight issue with USB Mouse.

If you click the…
left button: e.Which == None
right button: e.Which == Left
middle button: e.Which == Right

So, basically it seems like everything is off by one. Easy enough to compensate for, but figured you’d want to know. The issue was also present in R2.

@ Skewworks - have you tried a different mouse. Maybe this mouse does not use a standard configuration.

@ Gus - I’ve tied 4 of them. :wink:

What kind of knot did you use?

1 Like

A Bachmann knot. :slight_smile:

@ Skewworks - We were able to reproduce the issue, we’ll take a look at it.

1 Like

@ C-Born - We haven’t seen anything like that. If you have some code that reproduces the issue on our character display, we can give it a try.

@ andre.m - it will likely be fixed for the next release.

@ andre.m - No ETA yet.

I’m a little closer to teasing this one out. Having the debugger disconnect in Hibernate doesn’t help.
Watching it on the storage CRO, the problem isn’t with the display E line, but with D6, which is attached to IO17 (pin 20) on the EMX.
After Hibernate all the other lines start back pulsing, but IO17 just sits there.

So I added two lines after Hibernate, to Dispose() the output port and then recreate it, and everything works as it should again.

Next step is to see if I can get a minimal build that demonstrates this, but it will have to wait until tomorrow.

1 Like

@ John - Here is a fairly minimal demonstration of the problem. I don’t know if IO17 is unique in being lost in Hibernate, but all of the other IO lines we use seem to be ok.


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

/*
 * Minimal code demonstration of  failure of EMX output port IO17 (Pin 20) to return after Hibernate (DeepSleep) in 4.3.7.9
 * IO17 is pulsed from main loop, until enters hibernate.
 * Interrupt from button (Right button, IO1, Pin 4) wakes board from hibernate, but no output from IO17
 * 
 * All green and red LED PWM can be removed, it is just in there for me to track what is happening on my hardware
 * Run this code with debugger detached, as it can hang at hibernate otherwise
 * DAV 11JUL15
 */

namespace EMXHiberTest
{
    public class Program
    {
        private static InputPort _buttonPort;
        static readonly PWM GLedFader = new PWM(Cpu.PWMChannel.PWM_2, 10000, 0.5, false);
        static readonly PWM RLedFader = new PWM(Cpu.PWMChannel.PWM_3, 10000, 0.5, false);

        private static Cpu.Pin LCD_Data_6 = EMX.IO17;
        private static OutputPort _dataPort;

        public static void Main()
        {
            
            GLedFader.Start();
            RLedFader.Start();
            GLedFader.DutyCycle = 0;
            RLedFader.DutyCycle = 0;
            
            _buttonPort = new InterruptPort(EMX.IO1, false, Port.ResistorMode.PullUp,Port.InterruptMode.InterruptEdgeHigh);
            _buttonPort.OnInterrupt += new NativeEventHandler(ButtonPort_OnInterrupt);

            _dataPort = new OutputPort(LCD_Data_6, false);

            int count = 0;

            for ( ; ; )
            {
                Thread.Sleep(50);
                _dataPort.Write(true);
                RLedFader.DutyCycle = 0.25;

                Thread.Sleep(50);
                _dataPort.Write(false);
                RLedFader.DutyCycle = 0.0;

                if (GLedFader.DutyCycle > 0.0)
                    GLedFader.DutyCycle -= 0.01;

                if (++count > 30)
                {
                    count = 0;
                    Hibernate();
                }
            }
        }

        static void ButtonPort_OnInterrupt(uint data1, uint data2, DateTime time)
        {
            GLedFader.DutyCycle = 0.25;
        }

        static void Hibernate()
        {
            PowerState.WakeupEvents |= HardwareEvent.OEMReserved1;
            PowerState.Sleep(SleepLevel.DeepSleep, HardwareEvent.OEMReserved1);
        }
    }
}

@ C-Born - We were able to reproduce the issue but we don’t have a timeline on a fix yet.

@ John - Thanks for the feedback, I’ll switch back to working with 4.2 for now. Let me know when you have it figured out.

@ C-Born -

"I’ll switch back to working with 4.2 for now."
Do you mean the bug does not happen in 4.2?

@ Dat - Correct, this came up when porting 4.2 production code to 4.3 and our LCD stopped working after hibernate.

Suggestions for GHI.Pins assembly:

  1. Newly added products (like G80) have [em]Gpio[/em] class, while older ones (like G120) does not. Unify it.
  2. Add description for Socket pins. For example, Cobra II’s third pin on Socket 1 could be described as “P2.13/LCD_B0”, the same pin on Socket 4 - “P0.25/AD2”.
  1. Is left like that for backwards compatibility. Will be changed on the next major release. This is actually listed in the changes document found in the support page.

  2. Possible

In [em]SoftwareI2CBus[/em] class there are multiple typos of “sendt”.

@ iamin - Fixed, thanks.