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!”
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.
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.
@ 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);
}
}
}
Newly added products (like G80) have [em]Gpio[/em] class, while older ones (like G120) does not. Unify it.
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”.
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.